简体   繁体   English

Instagram API找不到沙箱用户喜欢的任何帖子

[英]Instagram API doesn’t find any liked posts for sandbox users

I'm using the Instagram API in sandbox mode. 我在沙盒模式下使用Instagram API。 I'm trying to access a User's liked posts from the Instagram API using their authenticated access token. 我正在尝试使用经过身份验证的访问令牌从Instagram API访问用户喜欢的帖子。 This user is one of the accepted sandbox users for my app, and has liked some posts. 该用户是我的应用程序可接受的沙箱用户之一,并且喜欢一些帖子。

If I call other endpoints with the same token, I get some data, but accessing /users/self/media/liked returns empty data. 如果我使用相同的令牌调用其他端点,则会得到一些数据,但是访问/users/self/media/liked返回空数据。

I'm using this URL: 我正在使用以下网址:

https://api.instagram.com/v1/users/self/media/liked?access_token={verified access token}

and this is the result I'm receiving: 这是我收到的结果:

{"pagination": {}, "meta": {"code": 200}, "data": []}

Because it has a 200 return code, the access token is valid. 由于它的返回码为200,因此访问令牌有效。 So why don't I see any liked posts? 那我为什么看不到任何喜欢的帖子?

When your app behaves in sandbox mode, it's restricted compared to normal behaviour. 当您的应用以沙箱模式运行时,与正常行为相比,它受到限制。 In particular (quoting from the API docs for the sandbox ): 特别是(引用沙箱的API文档 ):

The API behaves as if the only users on Instagram were your sandbox users, and the only media ever posted were the last 20 for each of these users. 该API的行为就好像Instagram上仅有的用户是您的沙箱用户,并且发布过的唯一媒体是这些用户中每一个的最后20个。

So the API can't see posts that the user has liked if those posts were made by non-sandbox users. 因此,如果这些帖子是由非沙盒用户发布的,则API无法看到用户喜欢的帖子。


Here's a scenario: 这是一个场景:

Assumptions: 假设:

  1. Say there are 100 instagram users all over the world(I know its more, just for example's sake!). 假设全世界有100个instagram用户(例如,我知道更多!)。
  2. An app named APP1 is live and not in sandbox mode. 名为APP1的应用程序处于活动状态,并且未处于沙盒模式。
  3. An app named APP2 is in sandbox mode[meaning not live yet!]. 名为APP2的应用程序处于沙盒模式(这意味着尚未生效!)。
  4. There are 5 verified and registered sandbox users for APP2. APP5有5个经过验证和注册的沙箱用户

Now, as Instagram document has said: Here will be the black box flow. 现在,正如Instagram文档所说:这将是黑匣子流程。

Situation 1:: APP1 tries to accept user likes for sandbox/non-sandbox users - Result: it gets their data. 情况1: APP1尝试接受沙盒/非沙盒用户的用户喜欢-结果:它获取了他们的数据。 Reason: For live apps, number of users visible to the app is the the number of users available on instagram. 原因:对于实时应用程序,该应用程序可见的用户数是instagram上可用的用户数。

Situation 2:: APP2 tries to accept user likes: For sandbox user - It will get only those data(likes here) for which the users are registered as sandbox users for this app. 情况2 :: APP2尝试接受用户喜欢: 对于沙盒用户 -它只会获取已将用户注册为此应用程序的沙盒用户的那些数据(在这里喜欢)。 Any other likes for non-sandbox users will be not visible here. 对于非沙盒用户的其他任何喜欢都不会在此处显示。 {As if 5 users existed, if any users like any content of those 5 users, it will be visible.} For non-sandbox users - Users are not visible! {好像存在5个用户,如果有任何用户喜欢这5个用户中的任何内容,它将可见。} 对于非沙盒用户 -用户不可见!

I missed the last part of visibility , which took me some research and co-relation to find out. 我错过了可见性的最后一部分,这需要我进行一些研究和相互关系来找出。 I guess there might me other developers who might have not understood the sandbox user's visibility part of the document. 我猜可能还有其他开发人员可能不了解沙箱用户文档的可见性部分。

If anyone has this problem since after 1st of June, there's a way to bypass that sandbox problem much easier with instagram.pixelunion.net 如果自6月1日以后有人遇到此问题,可以通过instagram.pixelunion.net轻松解决沙盒问题

Later I found a better working one services.chrisriversdesign.com/instagram-token/ 后来我发现一个更好的工作services.chrisriversdesign.com/instagram-token/ 。chrisriversdesign.com/ instagram- services.chrisriversdesign.com/instagram-token/

Simple solution, Like one of your own instagram pics. 简单的解决方案,就像您自己的instagram图片之一。 That way your "recent likes" will increase likes of another sandbox user (you), and will not be empty. 这样,您的“最近点赞”将增加另一个沙箱用户(您)的点赞,并且不会为空。

If still getting 如果仍然

{"pagination": {}, "meta": {"code": 200}, "data": []}

for other calls eg 对于其他电话,例如

https://api.instagram.com/v1/users/self/media/recent?access_token=732...

make sure to make calls to public account by going to Settings->Privacy & Security(tab)->Account Privacy(section), unchecking 'Private Account' . 确保通过转到“设置”->“隐私和安全性”(标签)->“帐户隐私”(部分), 取消选中“私人帐户” ,以拨打公共帐户电话。 Instagram redefines privacy lately with stricter API changes. Instagram最近通过更严格的API更改重新定义了隐私。

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

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