Instagram API - Getting feed of private user whom the authorised user follows - api

I am using Instagram API for my application. I need access to the feed of private users whom I am following, but the response is:
code: 400
error_type: APINotAllowedError
error_message: you cannot view this resource
I could not find anything in the documentation regarding this.
I was hoping that as I am able to see the user's feed on my app, I would be able to retrieve the same using the API.
Any way around this?
Please help.

[As instagram changes their api, this tips may not work forever]
I faced same issue and the cause is it happens when the posts are private , even if user access token is passed with endpoints this errors happen.
Solution: just in place of userid use 'self' for private profile. means if a profile has private posts then who connects should be the same person of the profile and other person can not view his/her posts.
Example:
https://api.instagram.com/v1/users/USER_ID/media/recent/?access_token=USER_ACCESS_TOKEN_HERE if this endpoints shows error then use
https://api.instagram.com/v1/users/self/media/recent/?access_token=USER_ACCESS_TOKEN_HERE
(just replace 'userid' with 'self')

Related

Implementing OAuth2 with Socrata API

I'm implementing the Socrata API to be able to parse publicly-available data from the City of Chicago open data set. I am really just concerned about the data itself, so I did not initially think that I would need to implement OAuth2 through an app exposed via ngrok to be able to GET the data.
My initial attempt was to take the GET requests mentioned in their documentation and try to get responses through Postman.
Here's an example of such an attempt:
I also added my Socrata App Token as a param in the querystring, but the same message was shown.
So I tell myself, ok, maybe they deprecated GET requests without making the client go through OAuth2. If they didn't deprecate these GET requests, I would prefer not to have to deal with OAuth2, but I began implementing the authentication process and everything went successfully until I got to the following instructions found here:
I have every single value that needs to be included in that POST request except for 'authorization_type'. Where does this come from? I tried leaving 'authorization_type' in as a string, but received a response similar to the 'Invalid username or password' message in the top image in this question.
Are you only accessing public datasets from Chicago's data portal? From your screenshot it looks like you're trying to access the Building Permits dataset, which is public.
Authentication is only required for modifying datasets or accessing private data, so chances are very good you don't even need to authenticate. Just include an application token with your request for throttling purposes.
Glad to help you figure out your OAuth workflow, but it sounds like it might be unnecessary.

Weibo error 20112 when attempting to access a user's post

I'm attempting to get a user's Weibo post with 2/statuses/show. I'm able to get posts made by my own account fine, but when I try to get another user's post I get the error:
{"error":"Permission Denied!","error_code":20112,"request":"/2/statuses/show.json"}
The Weibo docs say (via google translate):
20112: As the author privacy settings, you do not have permission to view this microblogging
Does this mean the author of the post needs to update their permissions to allow the developer account access?
I also encounter this issue. However, you can still access the post using its user_id and mid (in base62). For instance, you cannot get this post from the API (its id is 10031139424) but you can still see it from your webbrowser.
An alternative is to get the post from its mobile url. Then, you can get its json which is contained in the variable render_data from the body of the html.
Any posts can be setted to be unvisible but for microblogger himself or trusted groups.
So privacy settings lead to your problem.

Get Instagram login ID through API auth login

I'm trying to make a check for a specific user logging into Instagram and approving an app I've created. Is this possible?
Example flow :
User comes to my app
User clicks login/authenticate via Instagram
User logs in (or check is made if user is logged in via Instagram)
User is redirected to my app's callback URI.
When the user gets back to my app I would like to be able to check which user has authenticated - is this possible? At present I'm only able to get an access token.
Thanks for any help.
I've actually solved this by using the server-side flow mentioned in the API documentation (http://instagram.com/developer/authentication/) which gives me back a response including the details of the user logged in if following the extra step (code->access_code application, etc).
I also figured out what you mention above too, so both ways are good.
Thanks for you help.
The information is not directly returned to you in the OAuth process, but once you have the access token you can load user information using the https://api.instagram.com/v1/users/self/?access_token=XXXX endpoint. That will give you data about the currently logged in user (including ID and username)

Instagram Realtime Tag API w/private users

I know there are reports of various issues when trying to pull pictures posted by 'private' users. We are working on a project that we want to use the real-time api for. After a private user approves our account, we are able to view images posted by them through the api's as expected. In addition when searching by tag we see their images. The real-time API reports the image when we subscribe to the user endpoint. We want to subscribe to the tag api, the issue is that while everything else works with private users, for some reason when a private user posts an image with a tag for which our client has subscribed, the notification is not set. It is working fine for public users, and if we search (without real-time notification) we are able to see the image. The only thing I can think of is that for search to work we must use our access key for our account (not the posters), not our clientid, perhaps real-time needs to use the same security by accesskey rather than client id?
You are correct:
we must use our access key for our account (not the posters), not our clientid
Because the privacy permissions are per-account, if you are making authenticated API calls on behalf of the user, this will not work. In theory, if you kept your hourly API calls under the 5000 limit, you could technically proxy or cache the private photos, however, rather than looking at a complicated workaround, you're better to just adhere to the API ToU:
If your application has any cached copies of User Content that has become "private," you must remove such User Content as soon as reasonably possible.
The realtime API is a bit different than the regular API as well, in that while you may or may not receive a notification of a post (it's not the most reliable service), it does't contain any data, and you're still going out to fetch the relevant data using either your own access_token, your app client_id/secret, or an authenticated user token.

Likes not loading on photos from private accounts using Instagram API

Likes not loading on photos from private accounts using the Instagram API. Same access token works fine to load likes on photos from non private accounts. The user for this access token is following the private account and can see the profile and photos just fine. It displays this error:
{
"meta": {
"error_type":"APINotFoundError",
"code":400,
"error_message":"invalid media id"
}
}
It is an actual Instagram API bug on this endpoint, not specific to a token or a client id.
I reproduced this easily, setting my account as private and testing on several services (such as statigram or webstagram). And if a set my account as public, all is ok.
We have reported this issue using the bug tool (from http://instagram.com/developer/clients/manage/). We have thousands of examples of this, so it seems to be global.
I hope it will be fixed soon. It is not the most critical endpoint of the API, but of course it is better if it runs ;-)