简体   繁体   中英

Instagram API getTagMedia with Sandbox

This is my first time working with the Instagram API and I am having some issues. I'm not sure if I am doing something wrong, or if perhaps it's related to the changes from Instagram. In short, I simply want to query Instagram for all pictures of a given tag.

I have setup an API client and it is currently in Sandbox. I am using the PHP API from Cosenary which can be found at the URL below. By the way is there an official PHP API wrapper? Anyways, I have setup everything correctly as far as I can tell, doing regular queries from the examples worked just fine, however trying to get pictures by tag returns this error:

"This request requires scope=public_content, but this access token is not authorized with this scope. The user must re-authorize your application with scope=public_content to be granted this permissions."

Well, it's in Sandbox so I can't give any permissions... But whats really confusing me is that the API documentation states that when grabbing by a tag in sandbox that it will return 20 images from a authorized user that has photos with that tag, however it's not doing this for me. I have my user authorized and there are photos with that tag in them...

Docs say: "As another example, let's consider an endpoint that returns a list of media: /tags/{tag-name}/media/recent. The response returned by this endpoint will contain only media with the given tag, as expected. But instead of returning media from any public Instagram user, it will return only media that belongs to your sandbox users, restricted to the last 20 for each user."

PHP API Wrapper: https://github.com/cosenary/Instagram-PHP-API

Thanks

In their docs it is mentioned that you will need scope as public_content for calling apis at Tags Endpoint .

So the error that you are getting

"This request requires scope=public_content, but this access token is not authorized with this scope. The user must re-authorize your application with scope=public_content to be granted this permissions."

It is because you are not adding "public_content" scope while authenticating user.

I checked the link to your code. in your scope array you have these permissions:

private $_scopes = array('basic', 'likes', 'comments', 'relationships');

Adding the scope as "public_content" in your scopes array will solve the problem

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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