Android : How To Follow A Person On Instagram From Our Android App

on Tuesday, September 23, 2014


I am the following code it runs completely without error but not success to follow some one. Answer will be appreciated



String url = "https://api.instagram.com/v1/users/"+userId+"/relationship?access_token="
+ accessToken;

HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(url);

// httppost.setHeader("Accept", "application/json");
httppost.setHeader("Accept",
"application/x-www-form-urlencoded");
// httppost.setHeader("Content-type", "application/json");
httppost.setHeader("Content-Type",
"application/x-www-form-urlencoded");

// Add your data
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(
1);
nameValuePairs.add(new BasicNameValuePair("action",
"follow"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs,
"UTF-8"));

try {
HttpResponse response = httpclient.execute(httppost);

} catch (Exception e) {
e.printStackTrace();
}

0 comments:

Post a Comment