Is it safe to rely ?__a=1 for instagram feed? - instagram

Is it safe to use __a=1 parameter to retrieve the Instagram feed of a user in JSON format ?
Can't find official documentation about that parameter.

TL;DR: No, not safe.
I have built a statistics bot using that method. If you hit certain rate limit, Instagram might require solving a ReCaptcha or verification via code sent to email/phone.

In my experience, I can use that parameter from a logged browser, it will work fine.
Unfortunately, I cannot use it as a web-service call from a single HTTP call.

Related

How do I fetch my own Instagram media feed

I have a use case that Instagram does not seem to acknowledge. I am hoping that someone else has an idea for what I can do.
The website that I am maintaining has been using the API endpoint:
https://www.instagram.com/anyUser/media/
And I am aware that Instagram has recently stopped supporting this endpoint. So I am looking for a replacement.
My use case is that I do not want to allow the users of my website to authenticate and browse their own photos. Instead I want to show only the latest 20 images that "I" (aka my employer) have posted, one at a time in a loop.
Instagram's API documentation seems to be entirely focused on the use case of allowing users to authenticate and share their photos.
Is there an API call that will return the last 20 images that I have posted?
From its specs, the Sandbox will work fine for me, I cannot find a way to register with Instagram that does not require me to build a user authentication work flow that will NEVER be used.
You would want to use self feed endpoint.
https://www.instagram.com/developer/endpoints/users/#get_users_self
https://api.instagram.com/v1/users/self/?access_token=ACCESS-TOKEN

Is there a way to get Instagram #Mention History via API or otherwise?

The native application doesn't show all the activity, only the most recent.
Therefore I lose 70-90% of my notifications overnight. There must be a way to get all that historical data.
I told you can't, but, thinking.. you can. :)
The API don't provide that facility.. You can check all endpoints here: http://instagram.com/developer/endpoints/
But you can iterate over all your medias an get all comments and likes. If you store it locally, after, will be possible to request API again and check your new unseen interactions.
It will work for likes and comments.

How to grab instagram users based on a hashtag?

is there a way to grab instagram users based on a specific hashtag ?
I run contests based on re posting photos with specified hashtag then randomly pick a winner, i need a tool that can grab the usernames of those who reposted that photo and used that hashtag.
You can query instagram using the API. There are official clients for both python and ruby.
You didn't specify what language/platform you are using, so I'll give you the generic approach.
Query instagram using the Tag Recent Media endpoint.
In the response, you will receive a user object that has the user's username, id, profile url, and so on. This should be enough to do what you are describing.
As far as tools, there aren't great options to probably do things exactly how you want. If you just want a simple contest, you could use statigram, but it's not free.
If you roll your own solution, I highly recommend you also do the following:
Implement a rate limiting mechanism such as a task queue so you don't exceed your API calls (5000 per hour for most calls). Also useful for failures/network hicups, etc.
Have users authenticate so you can use OAuth to extend your API calls to 5000/per user/hour to get around #1.
Try the subscribe API if there won't be many items. You can subscribe to a specific tag as well, and you will get a change notification. At that point though you need to retrieve the actual media item(s), and this can cost a lot of API calls depending on how frequent and what volume these changes occur.
If your users don't have much photos/relatively small/known in advance, you can actually query the user's recent media instead and filter in your own code by hash tag.

how subscribing to instagram realtime api helps me to get user/media details

I have subscribed to instagram realtime api to receive POST updates for hashtag #sudhir
I am able to get updates to my server this way :
{"changed_aspect":"media", "subscription_id":2935881, "object":"tag", "object_id":"sudhir", "time":1362748903}
I don't find any user related or media related info in these updates. I found in SO that we have to hit their (instagram) endpoints explicitly to get photos/user info, inspite of subscribing to endpoints.
If we have to make request explicitly, then what is the use of subscribing to particular endpoint.?
What is the use of this json data ({"changed_aspect":"media","subscription_id":2935881,"object":"tag","object_id":"nofilter","time":1362748903}) we get in request body of our servlet. ?
Can we use this data in any way to get actual data of user/media ?
Any help or suggestions would be appreciated :)
Nothing useful I'm afraid. Once you have that information you know that something has changed on Instagram's end. You are then supposed to fire off the corresponding request. From your example it looks like you want to then do a tag/recent/ request and filter out anything earlier than the "time" variable.
Not the easiest way to do things unfortunately but they seem to have decided that the hard way of doing things is the way to go.

Like a page via foursquare API

Can't find an endpoint providing "Like a page" (not a page update) via the API. Any suggestions? Looking here https://developer.foursquare.com/docs/pages/pages
You won't find such an endpoint: "like a page" is explicitly intended to be done by users, never via an API. None of the major platforms that allow things like Likes provide API endpoints for that action (Facebook doesn't, Foursquare doesn't either) because they do not want developers gaming the system and inadvertently (or on purpose) performing those actions without user consent.
So no: you're probably never going to find an API endpoint for that.
Documentation for this endpoint is coming soon (we're in the process of auditing our API to document the new APIs introduced by #allnew4sq)
The endpoint is /pages/USER_ID/like and without any additional params probably does what you want it to do.

Resources