简体   繁体   English

Instagram API:什么时候提高我的客户端应用程序的速率限制?

[英]Instagram API: when is the rate limit increased for my client app?

I got an client app in sandbox for Instagram, was thinking of using it for showing a widget on client websites with their users recent media. 我在Instagram的沙箱中有一个客户端应用程序,当时正在考虑使用该应用程序在客户端网站上与用户的近期媒体一起显示小部件。

At the moment I am using GET requests towards this endpoint: 目前,我正在使用针对此端点的GET请求:
- api.instagram.com/v1/users/{user-id}/media/recent/?access_token=ACCESS-TOKEN -api.instagram.com/v1/users/{user-id}/media/recent/?access_token=ACCESS-TOKEN

This is done on the server side, and it works good with my sandbox user. 这是在服务器端完成的,与我的沙盒用户一起使用时效果很好。 I save the data response from the API to avoid reaching the rate limit of 500 each hour. 我保存了来自API的数据响应,以避免达到每小时500个的速率限制。 The saved response is then formatted to a html list, with links to the media. 然后将保存的响应格式化为html列表,并带有指向媒体的链接。 The request is only done once each day at the moment. 目前,该请求每天仅执行一次。

Is the rate limit only incremented on API calls as I thought? 是否按照我的想法仅在API调用上增加了速率限制? Do I avoid hitting the rate limit with this solution? 我是否可以避免使用此解决方案达到速率限制? If not: when is the rate limit incremented exactly? 如果不是,速率限制何时准确增加?

Thanks in advance! 提前致谢!

Yes, the rate limit will be decremented by 1 for your GET request. 是的,您的GET请求的费率上限将减少1。 One way to keep track of the rate limit is to check the response headers from Instagram for x-ratelimit-remaining [1]. 跟踪速率限制的一种方法是检查来自Instagram的响应标头是否x-ratelimit-remaining [1]。 This will be set to an integer value (eg, 4990) and applies to the access_token used for the request. 这将设置为整数值(例如4990),并应用于请求所使用的access_token。 This method works only for GET requests; 此方法仅适用于GET请求; POST requests do not return accurate x-ratelimit-remaining values. POST请求不会返回准确的x-ratelimit-remaining值。

[1] As described in the deprecated developer documentation but inexplicably omitted from the current documentation . [1]如过时的开发人员文档中所述,但从当前文档中莫名其妙地省略了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM