Instagram/Facebook deprecating many APIs [duplicate] - facebook

I use some self developed script to get info about my posts and followers. Recently I discovered that Instagram changed rate limits for my app. I see following info in headers:
x-ratelimit-limit: 200
I learned Instagram blog and page with changes but found no mentions about any changes since Oct 1, 2017.
Is this new limit related only to my token or to entire platform? Could you check your token?

Yes It is, Although no official communication.
I also experienced that.
I found this in their documentation.
The Instagram API uses the same rate limiting as the Graph API (200 calls per user per hour) with one exception: the /media/comments edge limits writes to 60 writes per user per hour. Please refer to the Graph API's rate limiting documentation for more information.
https://developers.facebook.com/docs/instagram-api/overview/#rate-limiting
https://techcrunch.com/2018/04/02/instagram-api-limit/
Hope this will be helpful.
Update:-
Further on 4th April few more APIs deprecated by Instagram.
https://www.instagram.com/developer/changelog/

Some perspective:
This 200 per hour call has been in the Graph API documentation for at least a month (according to wayback machine).
Facebook must have panicked over the weekend and pressed the "require Graph API permissions" button, thus our current situation. :\

Yes,
The limit has been reduced.
Here are some reference links for detailed documentation:
Instagram API limit reduced to 200 from 5000
https://techcrunch.com/2018/04/02/instagram-api-limit/
https://developers.facebook.com/docs/instagram-api/overview/#rate-limiting
Hope it helps
Thanks

Here's our answer: https://www.instagram.com/developer/changelog/
The API deprecated immediately. So really the limits probably don't matter that much anymore. I really don't see myself building another app based on their API...

Here is The New Instagram's Public Api Update , unfortunately Limit rates are worthless for some Features in Instagram .
April 4, 2018
The following endpoints are deprecated immediately:
Follows and Relationships
GET /users/self/follows
GET /users/self/followed-by
GET /users/self/requested-by
GET /users/{user-id}/relationship
POST /users/{user-id}/relationship
Commenting on Public Content
GET /media/{media-id}/comments (Deprecation not relevant when fetching comments for self media)
POST /media/{media-id}/comments
DEL /media/{media-id}/comments/comment-id
Media
GET /media/{media-id}
GET /media/shortcode/{shortcode}
Likes
GET /media/{media-id}/likes
POST /media/{media-id}/likes
DEL /media/{media-id}/likes
User Search
GET /users/{user-id}
GET /users/{user-id}/media/recent
GET /users/self/media/liked
GET /users/search
Subscriptions - to receive notifications when media is posted
Some information on Public Content returned through hashtag and location search will be removed - Name, Bio, Comments, Commenters, Follower Count, Following Count, Post Count, and Profile Picture

Related

Facebook graph API response size limiting (error code 1)

Just sharing some information I came across while testing my application.
Facebook Graph API implements rate limiting as described on their documentation page. Today I was trying to retrieve the feed from CNN facebook page and I got the following 500 error:
{"error":{"code":1,"message":"Please reduce the amount of data you're asking for, then retry your request"}}
This is the query I was trying to test:
https://graph.facebook.com/v2.3/5550296508/feed?fields=id,actions,application,caption,created_time,description,from,icon,is_hidden,link,message,message_tags,name,object_id,picture,place,privacy,properties,source,status_type,story,story_tags,to,type,updated_time,with_tags,shares,likes.limit(50),comments.filter(stream).limit(50){attachment,created_time,from,id,like_count,message,message_tags,comments{attachment,created_time,from,id,like_count,message,message_tags}}&access_token=xxxxxxx
I tried to set different limit values to reduce the size, and eventually it worked. By inspecting the response size and playing around with it a bit, I found that the error is thrown when the response reaches (roughly) the 200k threshold.
I tested with Graph API versions 2.3 - 2.4 - 2.5 - 2.6
I found no documentation about this response size limit on the facebook APIs documentation, so it's possible that it will be changed in the future.
Just thought it might be useful to share if you are modelling something using their API.
I originally misready the error message Please reduce the amount of data you're asking for, then retry your request and assumed I was getting rate-limited -- i.e. making too many API calls in a short time period. Thanks Dieghito for your answer, which helped me realize the error is about the response size.
In my case it was fetching /comments that was exceeding the response size limit. I had the limit set to 1000, which was fine for most posts. But for posts with a lot of lengthy comments, the response size grew too large. I had paging already setup, so simply requesting fewer comments per page (limit: 50 or 100) solved the problem for me. Just posting that here for people whose problem could be related to comments.

Empty response to API call to Facebook Graph

I have been hammering away at this problem for the last day. I really hope someone can help me out. I would be very grateful.
What I am trying to do is fetch event data from a Facebook Page. I looked over the documentation, which says this about reading Pages data:
Reading
A Facebook page
Permissions
For pages that are published, you need:
An app or user access token to view fields from fully public pages.
So what I did was I obtained an app access token via:
GET https://graph.facebook.com/oauth/access_token?
client_id=YOUR_APP_ID
&client_secret=YOUR_APP_SECRET
&grant_type=client_credentials
which then returned
access_token=MY_APP_ID|MY_APP_ACCESS_TOKEN
After this I followed the documentation and made the following call
https://graph.facebook.com/v2.4/129511477069092/events?fields=id,cover,name,venue,description&access_token=MY_APP_ID|MY_APP_ACCESS_TOKEN
This returned:
{
"data": [
]
}
So after some fiddling around I was able to make the call by switching to version V2.2 and by creating an access key with Facebook API Graph explorer tool(no permissions granted).
GET https://graph.facebook.com/v2.2/129511477069092/events?
fields=id,cover,name,venue,description&
access_token=ACCESS_TOKEN_FROM_FACEBOOK_API_EXPLORER_TOOL
The page I am trying to retrieve data from is public and so are the events, so I can't figure out what is going on. I know I am super close since I am able to retrieve the data with the token provided by the Facebook API Graph Explorer Tool. The thing with using this token is that it only last a few hours and I need something that is going to last longer such as an app access token. I have done some research on Stackoverflow and found similar questions, but none of them solve my problem. Any help will be appreciated to the max! Thanks.
Looks like a bug of v2.4 to me. It works with v2.3 if you remove the deprecated venue field:
https://developers.facebook.com/tools/explorer/145634995501895/?method=GET&path=129511477069092%2Fevents%3Ffields%3Did%2Ccover%2Cname%2Cdescription&version=v2.3
If the version is changed to v2.4, it returns an empty result.
https://developers.facebook.com/tools/explorer/145634995501895/?method=GET&path=129511477069092%2Fevents%3Ffields%3Did%2Ccover%2Cname%2Cdescription&version=v2.4
There's no documentation about this in the changelog at
https://developers.facebook.com/docs/apps/changelog#v2_4
so I guess it's a bug. There's already a bug report at
https://developers.facebook.com/bugs/443054055873667/
with status assigned. If you have an app that supports v2.3, I'd suggest you prefix your request like this:
GET /v2.3/129511477069092/events?fields=id,cover,name,description

How to get facebook share, like, comment count for a url with graph api only (in a non-deprecated way)

The problem is that after v2.1 of graph api fql will be deprecated.
Can someone tell me how to get separate likes, share count for given url using only graph api? I was looking for some documentation, but there isn't any, i can get only total "shares" which is likes + shares + comments.
Yes i know there is immortal http://api.facebook.com/restserver.php?method=links.getStats&urls, but what if facebook shuts it down at last?
The REST API (with calls like http://api.facebook.com/restserver.php?method=links.getStats&urls) was announced as deprecated with the introduction of the Graph API v2.1: https://developers.facebook.com/docs/apps/changelog#v2_1_deprecations but also already in 2011: https://developers.facebook.com/blog/post/616/
So, from my understanding, this will yield in the inoperability of this feature at two years after the introduction of v2.1 on 7th August 2016:
https://developers.facebook.com/docs/apps/versions#howlong
The closest you can get to the "old" REST of FQL API call results with the Graph API is this afaik:
https://developers.facebook.com/docs/graph-api/reference/v2.3/url/
but it omits the like_count metric (don't ask me why...).
My personal opinion is that you should continue to use the FQL calls to the link_stat (https://developers.facebook.com/docs/reference/fql/link_stat/) table, because this will be available for nearly the next 2 years. This is only possible if you have a v2.0 app. Maybe there'll be some additional endpoints for the Graph API until then.
I suggest using a tool like SharedCount, it offers a lot more platforms too. Here is how they get the data: http://www.sharedcount.com/documentation.php (Scroll down to "Sources")
So for Facebook it would be like this:
https://api.facebook.com/method/links.getStats?urls=%%URL%%&format=json
You get a JSON object like this one:
..."share_count":66,"like_count":15,"comment_count":1,"total_count":82...
Edit: This is deprecated now, but there is another possibility, explained in this thread: Get FB likes, shares and comments for a URL using PHP - with no limit
You can use facebook graph api like https://graph.facebook.com/?ids=http://mycodingtricks.com and it will return a json code like
{
"http://mycodingtricks.com":{
"id":"http://mycodingtricks.com",
"shares":1
}
}
I have developed my own php script on which you can all social count using that api.
http://mycodingtricks.com/share/social.php?url=YOUR-URL-HERE and it will return data like:
{
"facebook":[
{
"share_count":1,
"like_count":0,
"comment_count":0,
"total_count":1,
"click_count":0,
"comments_fbid":567687199998199,
"commentsbox_count":0
}
],
"googleplus":10,
"twitter":3,
"buffer":0,
"pinterest":0,
"stumblupon":1,
"reddit":"<html><body><h1>403 Forbidden<\/h1>\nRequest forbidden by administrative rules.\n<\/body><\/html>\n",
"linkedin":0
}
But if you wants to use on your own Here is a complete article about how to count facebook share,like and all.
http://mycodingtricks.com/php/2-ways-to-count-facebook-likes-shares-and-comments-using-php/
actually the correct way for getting the like number is this:
http://graph.facebook.com/v2.5/?id=YOUR_URL&fields=og_object{engagement}
the brackets after the og_object is the second level of og_object.
see documentation here:
https://developers.facebook.com/docs/graph-api/reference/url
you might need to encode the url and brackets so it will look something like:
https://graph.facebook.com/v2.5/?id=ENCODED_URL&fields=og_object%7Bengagement%7D&id=http%3A%2F%2Fwww.cnn.com
see a working example in
graph explorer (hit the submit button)
All answers are wrong or incomplete since latest shut down of API 2.1!
I am the author of the social media plugin MashShare and i recently had to do exact observations for this issue as it seriously affected the share count of our plugin.
Verified data by observations:
https://graph.facebook.com/v2.7/?id=https://www.mashshare.net contains shares and likes.
As far as i found out the only way to get a number near the real share count of a post is to get first the likes of a url. Than take this number and subtract it from the total number of shares and likes.
To get the like count you need to take the object id of the url and create another API request:
https://graph.facebook.com/v2.7/14206851986099/likes?summary=true
If you know how to merge both requests into one please let me know.
As of August 19th 2016 facebook completely shutdown their rest API.
The only alternative is to use the graph API as suggested above.

Facebook FQL posts limit issue

Currently i am using following FQL query :-
https://api.facebook.com/method/fql.query?query=select post_id,likes FROM stream WHERE source_id=XXXXXXXX LIMIT 0,10000&access_token=XXXXXXXXXXXXX&format=json
I have two Facebook Accounts / pages & able to download data using above API. Able to retrieve posts & post likes count.
But, from last three days, for one Facebook account above FQL query is not working. it is returning message :- "error": "Request failed" . For other account it is working fine.
For each facebook Account / pages i have generated separate Access Tokens.
But, if i update limit from : -
Limit 0,50
Limit 50,100
then it is working & returning posts from page but not returning all post which i have previously getting from Limit 0,10000
Please help me, if any one have idea about this issue ?
Thanks
Facebook will cancel queries which take too long or too many resources to execute. In general, I would never use LIMITs which are that high. There's a high probability that they will fail, and you can't really incfuence the query execution "load" other than setting the LIMIT to a reasonable number (which means implementing a paging mechanism).

Facebook Places API 500 result limit

Facebook OpenGrap API limit results of [id]/checkins to 500. Is there are way to retrieve more than 500. Example if I want to retirve all the place someone has checkin for year 2011. What are possible available methods. Is there a premium service provided by Facebook.
Regards,
Waruna.
As the open grpah documentation describes, there should be a "paging" object at the end of the api response if there is more content than you could load at one time. You can test this by clicking the example links inthe documentation. So, the solution is: Loop your requests until there is no "next" property in the "paging" object of the response.
Also there are possibilites to batch your requests, maybe this is also useful for you.