http - How to create a new content in Google Sites by sending a POST request using Android or Curl? -


currently, working on creating android app read , create google sites content. seems java api doesn't work android, use google protocol https://developers.google.com/google-apps/sites/docs/1.0/developers_guide_protocol#contentfeedpost. can content on google site request https://sites.google.com/feeds/site/domainname. have no idea how send post request create content beside on google api guide. hope me this. need how send request in curl. thanks!

you can try curl command this:

curl -h "content-type: your-content-type" -x post -d 'your-data' https://localhost:8080/api/login 

and post data using httpurlconnection class use following:

httpurlconnection connection = null;       try {       //create connection       url = new url(targeturl);       connection = (httpurlconnection)url.openconnection();       connection.setrequestmethod("post");       connection.setrequestproperty("content-type",             "your-content-type");//set required content type        connection.setrequestproperty("content-length", "" +                 data.getbytes().length);//set content-length header using data length in bytes       connection.setrequestproperty("content-language", "en-us");           connection.setdoinput(true);       connection.setdooutput(true);        //send request       dataoutputstream wr = new dataoutputstream (                   connection.getoutputstream ());       wr.writebytes (data);//write data o/p stream       wr.flush ();       wr.close ();        //get response           inputstream = connection.getinputstream();       bufferedreader rd = new bufferedreader(new inputstreamreader(is));       string line;       stringbuffer response = new stringbuffer();        while((line = rd.readline()) != null) {         response.append(line);         response.append('\r');       }       rd.close();       return response.tostring();      } catch (exception e) {      } {       if(connection != null) {         connection.disconnect();        }     } 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -