Posts

Showing posts from December, 2013

Send POST request with JSON data on Google App Engine

Tag: Fusion Table Rest API, Send POST request with JSON data on Google App Engine

1) Create fusion table using post request on Google App Engine

// postURL= "https://www.googleapis.com/fusiontables/v1/tables?access_token=**********"
// access_token - Use Oauth2 for this

public static String sendPostRequest(String postURL) throws Exception{
        String responseStr=null;
        //make POST request
        String jsonContent = "{'name': 'newIndia','columns': [{'name': 'Species','type': 'STRING'}],'description': 'Insect Tracking Information.','isExportable': true}";
        //String data = "{\"document\" : {\"_id\": \"" + id+ "\", \"context\":" + context +"}}";
        URL url = new URL(postURL);
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();

        connection.setDoOutput(true);
        connecti…