Instagram API request more - pagination

https://api.instagram.com/v1/users/self/media/recent/?access_token=my_token&count=30
request only 20 data.
I want 30 data.
{
pagination: { },
meta: {
code: 200
},
data: [
{
attribution: null,
tags: [...
can't find pagination in next_max_id.
but https://api.instagram.com/v1/users/self/media/recent/?access_token=my_token&count=1
This code = next_max_id ok.
Do u know what i meen?
sorry, not wall English wirte..
Help Me~

In general, the endpoints are limited to a certain amount of items per request. In order to get around this, endpoints support pagination. Pagination is indicated by the pagination key in the response. It may look like this:
"pagination": {
"next_url": "https://api.instagram.com/v1/tags/puppy/media/recent?access_token=fb2e77d.47a0479900504cb3ab4a1f626d174d2d&max_id=13872296",
"next_max_id": "13872296"
}
In that case, you could pass next_max_id to the previously made request to get the next page which starts from the last id that wasn’t included in the current response. You can also simply request the URL at next_url which is automatically constructed for your by the Instagram API.
You can increase the page size for endpoints by supplying the count parameter. Note that each endpoint has a maximum page size which you cannot go above. So you will have to support paging at some point in order to access more items.
Finally, since you hit the number of 20 items in your response despite specifying a page size of 30, it’s very likely that you are hit by the sandbox mode.
Sandbox mode is a new restriction for Instagram applications created on or after November 17th, 2015. This restriction limits application in various ways, most notably, it limits all endpoints to return a maximum of the 20 most recent media items.
So if you have created your application after that date, this is exactly what you’re running into. Your application is essentially in a test mode. In order to lift these restrictions, you need to get your application reviewed and approved first. As stated in the documentation:
After your app has been reviewed and approved, you are ready to make it available to the general public. To switch your client from sandbox to live mode, you can use the button on the top section of the configuration screen for your app. When you are live, any Instagram user will be able to authorize your app, but you will have access only to the permissions that you were granted during the review.

Related

How to make more posts/data appear on instagram

I'm using this url: https://www.instagram.com/explore/tags/meugatonovet/?__a=1, to get hashtag data. With this parameter it shows a json, but returns only 39 posts/pots of 7,000 thousand.
Is there a tool, some parameter or something else that can make it return more data?
Using ?__a=1 parameter is a neat trick to get JSON data for any Instagram page, but it's not an official API; Instagram can block your IP address any time and the endpoint is not guaranteed to remain stable.
The official way to look up media via hashtag is with Graph API Hashtag Search.
See getting started for initial steps. You need a business account ID for your Instagram profile which is required parameter for hashtag search. Then you can do these steps:
Find the ID of the hashtag you are looking for, for example:
GET https://graph.facebook.com/v13.0/ig_hashtag_search?user_id=<business account ID>&q=meugatonovet&access_token=<user access token>
This will return a JSON of the hashtag:
{
"data": [
{
"id": "17878113037414936"
}
]
}
Use that ID in other requests, for example /recent_media:
GET https://graph.facebook.com/v13.0/17878113037414936/recent_media?user_id=<business account ID>&fields=id,media_type,comments_count,like_count,media_url&access_token=<user access token>
The response will also provide the pagination cursor which lets you read all the data within API limitations.
Other less official options are web scraping or using Instagram's private API (there are actively maintained libraries for that, like instagram-private-api), but mind that this might get you banned and it breaks Instagram's ToS. It's probably fine for a personal project, but not so fine for a commercial use.
This endpoint is not working anymore:
https://www.instagram.com/explore/tags/username/?__a=1
However, a possible solution is adding __d=dis to your payload:
https://www.instagram.com/explore/tags/username/?__a=1&__d=dis
Please, take into account that this is an unofficial method, and you can get banned as #jnv advised.
Best regards

Does the DocuSign Intermediate API plan let me use the API to get PDF and form fields?

I tried calling DocuSign sales and support (transferred around 3 times) and no one could give me a straight answer on this. Their "support" actually told be to try stackoverflow, so here I am...
I'm looking at their API pricing levels here: https://www.docusign.com/products-and-pricing/api-plans-b
If I have the Intermediate API, can I make the following API requests?
GET /restapi/v2.1/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}
GET /restapi/v2.1/accounts/{accountId}/envelopes/{envelopeId}/form_data
The part that's throwing me for a loop is the DocuSign Connect feature in the Advanced API plan. The description of it is:
The DocuSign Connect module lets you configure webhooks for envelope events and recipient actions for some or all users in your account. It can also be used to transport the completed documents back to your app or website and to retrieve any form field data entered by your recipients.
I don't need the webhooks, but I need to be able to get the completed documents as PDFs and get the form field data. Do I really need the DocuSign Connect feature for that?
You will be fine with the intermediate plan. Here is the basic distinction between polling and Connect - With Connect, we will proactively notify YOU when key envelope events occur.
Otherwise, it's up to you to call GET /envelopes and/or GET /form_data to retrieve that information. Be wary of the resource limits when you poll.
As a quick aside, instead of making two requests to retrive that information, just make one - GET /envelopes?include=recipients,tabs. This will provide you all the information you seek in one request.
The important excerpt from that guide:
You may not exceed one GET request per unique envelope endpoint per 15
minutes. If you exceed this limit the request will not fail, but it
will be flagged as a violation of rate limits which can cause your app
to fail review to go-live review.
For example, the following transactions violate API rules due to the repeated GET requests to the first document and second recipient:
[12:00:00] POST /accounts/12345/envelopes
[12:01:00] GET /accounts/12345/envelopes/AAA/documents/1
[12:02:00] GET /accounts/12345/envelopes/AAA/recipients/2
[12:03:00] POST /accounts/12345/envelopes
[12:04:00] GET /accounts/12345/envelopes/AAA/documents/1 *
[12:05:00] GET /accounts/12345/envelopes/AAA/recipients/2 *
However, the following set of requests comply with API rules and limits and would not be flagged by the platform:
[12:00:00] POST /accounts/12345/envelopes
[12:01:00] GET /accounts/12345/envelopes/AAA
[12:16:00] GET /accounts/12345/envelopes/AAA
[12:17:00] GET /accounts/12345/envelopes/AAA/documents/1
[12:32:00] GET /accounts/12345/envelopes/AAA/documents/1
[12:40:00] PUT /accounts/12345/envelopes/AAA/recipients/1
[12:41:00] PUT /accounts/12345/envelopes/AAA/recipients/1

Instagram search user api always return empty result with success code

We are invoking instagram search users api to get profile list as
https://api.instagram.com/v1/users/search?q={search-term}&access_token={access-token}
but we are getting always empty result with success code as
{"meta": {"code": 200}, "data": []}
Our search term would be always instagram username i.e. username portion from https://www.instagram.com/username/
I remember this was working before 2-3 months. Any other are facing similar issue?
Sounds like you already figured out your problem. In case anyone else is having the same problem, here's a short article summarizing how Instagram's Sandbox Mode works.
TL;DR
“Sandbox mode” is the (unintuitively-named) gatekeeper walling off
most of what you want to do. This is the default status for all
clients, that have not undergone the strict submission process. An API
client in sandbox mode has extremely limited permissions. In fact, it
has fewer permissions than an anonymous user viewing public content
because your app basically lives on a tiny desert island in which you
are the only Instagram user and only your past twenty posts exist. So,
for example, the /media/search endpoint will only return the media you
uploaded near a given location, excluding the media from everyone else
or any posts beyond your last twenty.
So your API call is succeeding. It just isn't finding any results because it can only "see" other sanbox users for your client.

Instagram API throwing OAuthAccessTokenException 400 error using client id

I was using the following api to get the latest 3 posts from public accounts to show on the website:
https://api.instagram.com/v1/users/{user-id}/media/recent/?client_id={client-id}&count=3
I had created an app to get the client-id.
However from today, this API has started throwing the following exception:
{
meta: {
error_type: "OAuthAccessTokenException",
code: 400,
error_message: "The access_token provided is invalid."
}
}
Could you please let me know as how to resolve this?
Based on the date, you probably have an older app that got hit by the API migration today, like mine. In short, Instagram decided to make developing for their platform WAY more annoying by requiring all API requests to be authenticated per user, even for data that users shares publicly. So you (like me) will likely be redesigning you app entirely.
To tell, log in to instagram.com/developer and click manage clients; then hit edit next to the set of keys your're trying to use. Up near the top, it will have a section called 'Client Status' -- if yours reads 'Sandbox Mode', fun times ahead! Hopefully you interact with less than 10 users and can stay in sandbox mode, otherwise you'll have to write an essay, film a video, and basically plead to get your permissions back (probably in a few months, when some Instagram intern finally digs his way down to you in the pile of applications). If it reads something eles, you've got another problem altogether and should thank your lucky stars.
In the meantime, I guess I'll get back to sending out dozens of emails to the maintainers of our many, many affiliated Instagram accounts to explain the issue and try to get permissions, so provided we get approved by then, all our social media displays aren't broken during a huge event Saturday. Another option might be to use the OAuth-less json response available here, but that might break terms of service.
I have a solution to this. If you are using the same code I am, which appears likely. I was pulling the last two images using this.
https://api.instagram.com/v1/users/{user-id}/media/recent/?client_id={client-id}&count=3
What I did to get this working is the following.
Login to your Instragram account you are using as the application.
Go to the developer (API) area. https://www.instagram.com/developer/clients/manage/
Manage clients. Make sure your website URL is the same as your valid redirect URL.
Add new Sandbox User. Put in the account of the IG photos you want to reach.
Hit this URL: https://api.instagram.com/oauth/authorize/?client_id=CLIENTID&redirect_uri=REDIRECT_URI&response_type=token where the client ID is the same one you used in your previous app above.
You should get back and access token URL. Copy your access token.
Login as your account that you want the IG photos of. The account you added as a sandbox user and go to developer and approve the Sandbox Invites.
Change your original URL above from https://api.instagram.com/v1/users/{user-id}/media/recent/?client_id={client-id}&count=3 to https://api.instagram.com/v1/users/self/media/recent/?access_token=ACCESS_TOKEN with your access token.
This is the IG API Media endpoint documentation: https://www.instagram.com/developer/endpoints/users/
After that, it all worked for me and while you are in the sandbox, you should be able to pull the last 3 photos or at this point, figure out how to read the JSON to do so.
Has your app been approved after the June 1st Instagram platform changes?
http://developers.instagram.com/post/145262544121/instagram-platform-update-effective-june-1-2016
If you want to retrieve the user media file then try this, It's working for me
https://graph.instagram.com/me/media?fields=id,caption,media_url,media_type&access_token=ACCESS_TOKEN
For some reason the token is no more valid. Request it again.
Possible reasons why a token is no more valid:
changed password
verified the account
logged-in from a different country

why do the posts seem to change when i look at the recent tagged instagram API

when i'm accessing the instagram API via the https://api.instagram.com/v1/tags/nofilter/media/recent and i click refresh on the browser, it seems to get more posts, but the count doesn't change on the app in iOS or on the API. Is there actually more posts being posted or is it just cycling through old ones?
There is a maximal limit of returned media per request: 33 (by now). By default the API should return 20 items. Regardless of refreshing the browser, the number of posts per request does not change.
I assume that you were getting the same number of media after refreshing the browser, but they were new, just being posted on the Instagram. However, they could have more data (longer descriptions etc.), which could give you an illusive impression of more fetched items.

Resources