Text after "
How do I apply the following curl command in Java URLConnection
Curl -X put \ h "X-parse-application-number:" \ h "x-parse-rest-api key:" \ h "content type: application / json" \ -d '{"score": 73,453}'
< / Pre>thanks in advance
using the derived square of which do you do it easily You can.
URL myURL = new URL (serviceURL); HttpURL connection myURLConnection = (HttpURLConnection) myURL.openConnection (); MyURLConnection.setRequestMethod ("put"); MyURLConnection.setRequestProperty ("X-parse-application-id", ""); MyURLConnection.setRequestProperty ("X-parse-rest-API-key", ""); MyURLConnection.setRequestProperty ("content-type", "app / json"); MyURLConnection.setUseCaches (wrong); MyURLConnection.setDoInput (true); MyURLConnection.setDoOutput (right); MyURLConnection.connect (); JSONObject jsonParam = new JSONObject (); Jason Parm ("Score", "73453"); OutputStream OS = myURLConnection.getOutputStream (); Os.write (URlencoder.encode (jsonParam.toString (), "UTF-8")); Os.close (); For the curl -x received \ "x-parse-application-number:" \ h "x-parse-rest-api key:" \ g \ - Data-urlencode 'contains = game
string charset = "UTF-8"; String query = String.Format ("include =% s", URLEncoder.encode ("game", charset)); URL myURL = new URL (serviceURL + "?" + Query); HttpURL connection myURLConnection = (HttpURLConnection) myURL.openConnection (); MyURLConnection.setRequestMethod ("GET"); MyURLConnection.setRequestProperty ("X-parse-application-id", ""); MyURLConnection.setRequestProperty ("X-parse-rest-API-key", ""); MyURLConnection.setUseCaches (wrong); MyURLConnection.setDoInput (true); MyURLConnection.setDoOutput (right); MyURLConnection.connect ();
No comments:
Post a Comment