Created
January 5, 2017 17:44
-
-
Save chashmeetsingh/f6dec99887ddaec1d042f8de0e9cce65 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<NameValuePair> someVariable = new ArrayList<NameValuePair>(); | |
nameValuePairs.add(new BasicNameValuePair("query", "{articles{id}}")); | |
HttpClient httpclient=new DefaultHttpClient(); | |
HttpPost httppost = new HttpPost("http://udacity-alumni-api.herokuapp.com/graphql"); | |
httppost.setHeader(HTTP.CONTENT_TYPE,"application/x-www-form-urlencoded;charset=UTF-8"); | |
try { | |
httppost.setEntity(new UrlEncodedFormEntity(someVariable, "UTF-8")); | |
} catch (UnsupportedEncodingException e) { | |
e.printStackTrace(); | |
} | |
// Execute HTTP Post Request | |
try { | |
HttpResponse response = httpclient.execute(httppost); | |
Log.d("Response:" , response.toString()); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment