我们如何在android应用程序中跟踪/取消跟踪instagram?
当我在instagram中使用Follow/Unfollow API时。我给我这样的错误 错误:我们如何在android应用程序中跟踪/取消跟踪instagram?,android,api,instagram,Android,Api,Instagram,当我在instagram中使用Follow/Unfollow API时。我给我这样的错误 错误: {"meta":{"error_type":"OAuthPermissionsException","code":400,"error_message":"This client has not been approved to access this resource."}} 我的Post方法调用在这里 public static AllMessage postAction(String act
{"meta":{"error_type":"OAuthPermissionsException","code":400,"error_message":"This client has not been approved to access this resource."}}
我的Post方法调用在这里
public static AllMessage postAction(String action, String UserID, String mAccessToken, DefaultHttpClient httpClient) {
AllMessage ReturnMessage = new AllMessage();
String url = String.format(RELATIONSHIP_URL, new Object[]{UserID, mAccessToken});
Log.v("log_tag", "FolURL " + url);
try {
HttpParams params = new BasicHttpParams();
params.setParameter("http.protocol.version", HttpVersion.HTTP_1_1);
params.setParameter("action=", action);
if (httpClient == null) {
httpClient = OpenHttpClientConnection();
}
HttpPost httpPost = new HttpPost(url);
List<NameValuePair> arrayList = new ArrayList(2);
arrayList.add(new BasicNameValuePair("action", action));
httpPost.setHeader("Accept", "application/json");
httpPost.setHeader("Content-type", String.valueOf(arrayList));
UrlEncodedFormEntity ent = new UrlEncodedFormEntity(arrayList, "UTF-8");
httpPost.setEntity(ent);
String mHttpReturnedData = readInputStreamToString(httpClient.execute(httpPost).getEntity().getContent());
Log.v("log_tag", "Return " + mHttpReturnedData);
} catch (Exception e4) {
ReturnMessage.MessageType = "Unsupported Format";
ReturnMessage.MessageError = "Unsupported data format Error -1000";
ReturnMessage.ActionSucess = false;
ReturnMessage.ActionID = 0;
ReturnMessage.PrvAction = action;
}
return ReturnMessage;
}
public static AllMessage postAction(字符串操作、字符串用户ID、字符串mAccessToken、DefaultHttpClient httpClient){
AllMessage ReturnMessage=新建AllMessage();
String url=String.format(关系_url,新对象[]{UserID,mAccessToken});
Log.v(“Log_标签”,“FolURL”+url);
试一试{
HttpParams params=新的BasicHttpParams();
setParameter(“http.protocol.version”,HttpVersion.http_1_1);
params.setParameter(“action=”,action);
if(httpClient==null){
httpClient=OpenHttpClientConnection();
}
HttpPost HttpPost=新的HttpPost(url);
List arrayList=新arrayList(2);
添加(新的BasicNameValuePair(“action”,action));
setHeader(“接受”、“应用程序/json”);
setHeader(“内容类型”,String.valueOf(arrayList));
UrlEncodedFormEntity=新的UrlEncodedFormEntity(arrayList,“UTF-8”);
httpPost.setEntity(ent);
字符串MHTTPreturneData=readInputStreamToString(httpClient.execute(httpPost.getEntity().getContent());
Log.v(“日志标签”,“返回”+mHttpReturnedData);
}捕获(例外e4){
ReturnMessage.MessageType=“不支持的格式”;
ReturnMessage.MessageError=“不支持的数据格式错误-1000”;
ReturnMessage.ActionSuces=false;
ReturnMessage.ActionID=0;
ReturnMessage.PrvAction=操作;
}
返回消息;
}
请帮助我获取此代码。您需要先注册应用程序才能使用Instagram API 链接在这里 然后与端点通信
https://api.instagram.com/v1/tags/nofilter/media/recent?access_token=ACCESS_TOKEN
并打适当的电话
目前,我还没有听说过他们制作的Android SDK,但我很确定肯定会有第三方
希望有帮助。我使用POST方法时只有一个错误。在Get方法中没有任何错误。那个么你们有什么建议吗?你们能用邮政编码更新你们的问题信息吗?我使用了Asynctask方法。我在asynctask上调用此函数。PostData.postAction(“unfollow”,str_UserID,mApp.getTOken(),httpClient);上面是该方法的代码。发现了您的问题,它与您的代码无关,您的代码很好。一旦获得批准,您需要访问并提交一份权限审查,以了解您正在尝试完成的任务。抱歉耽搁了。