Is there any way to limit the number of records returned in the search artist endpoint of Spotify's metadata api?
Currently, it seems the default is one hundred, and we're only really interested in the first record.
This has been answered previously; Spotify Web Apps - limit results to 50 instead of the default 100. To my knowledge, this has not changed and you are unfortunately still given page with up to 100 results.
However, I'd strongly recommend that you stay tuned for news regarding the Web API in the near future.
Edit: We've launched a new version of the Web API, allowing for limiting search results.
Example: https://api.spotify.com/v1/search?q=elvis&type=artist&limit=1
Please check out the official documentation for more information.
Related
I am currently using Facebook's OpenGraph to obtain taggable_friends. By default and as of FB API > 2.1 the request only returns 25 objects. You can add a limit and increase your data response but you have no parameters you can pass. It just doesn't feel right to increase the limit with a hard coded number. So, one of the features of that app is that you can search for taggable_friends and select them. If you return a large limit to obtain (in most cases) all of your friends can take a while. Let's say you only get the first 25 and you search for a person that is in a batch - you don't know where. Since you have no parameters to pass to your request, a searchTerm for your your API call is out of the question.
Has anyone ever done a batch call? Facebook allows for multiple requests using some sort of batch calls. How would that look like in JS code?
I can use my users information to obtain the amount of friends he/she has and set a reasonable limit. That helps in the majority of cases but doesn't solve the problem.
Did someone ever encounter that problem and solved it?
I'm using Facebook Marketing API to get ad campaingn from Facebook. I'm getting the data, but the problem is, they are sending the data with pagination. I have the url for the next set of data, so I need to call the Facebook API multiple times. I can set the data limit in the request to a huge number so that I can get all the data at a time.
Is there any other option to get all the data?
I tried with until & since parameter and sending the timestamp of current time & 0, but it didn't worked.
So is there any other way out?
Paging through the data is the way to go. There is no alternative.
There are indeed different ways to use paging, one of which would be to use the next/previous links provided in a response. Another way is to use so-called Cursor-Based Pagination, where you construct your own next/previous links using a provided cursor tokens. This is documented here.
Please not that you can indeed change the requested limit to some huge number, but Facebook's API may silently reduce that number to whatever it thinks is sensible, or it may return an error saying that you requested too much data. Summarized, this means you will need to use paging.
So I'm struggling to find where this is documented (if at all), but I'm getting the following error message when requesting data from the FB GraphAPI.
"Please reduce the amount of data you're asking for, then retry your request"
The call I'm making is:
/v2.3/user1/posts?fields=object_id&limit=100
If I change it to:
/v2.3/user2/posts?fields=object_id&limit=100
It returns 100 items.
Why would it work for one user, and not the other?
Both requests are authenticated via an access token (not belonging to either user) and I get the same error whether running it from my code, or the Facebook Graph API console of developers.facebook.com
The response from CBroe is correct. Facebook returns this error if it finds that too many internal resources are needed to respond to your request.
Therefore you have to do what the response says: limit it.
This can be done in (afaik) 2 ways:
Use the limit parameter and reduce the amount of responses you expect from the API
Provide a timeframe (using since and / or until) to fetch only data (posts / videos) for a specific timeframe.
We had the same issue as you, but with retrieving videos from a page. Unfortunately using the limit parameter did not work, even when I set it to limit=1. But by using the since / until parameters we finally got results.
Therefore I suggest to implement a timeframe in order to reduce the amount of data, or alternatively, split the amount of requests you make. e.g. if you want all posts from the past 3 months and run into the mentioned error: split your requests in half using since and until. If that still does not work: keep splitting...
=> Divide and conquer ;)
Hope it helps,
KR, ebbmo
Recent bug filed on FB talks about the same error. They seem to accept that this could be a bug, but not much other information forthcoming.
https://developers.facebook.com/bugs/1904674066421189/
There are both app-level and user-level rate limits that are enforced on Graph API calls. In your case, it could be that you've made a large number of calls in a short time with user1.
You can check out this page for more about Facebook's rate limits: https://developers.facebook.com/docs/marketing-api/api-rate-limiting (even though the URL refers to the Marketing API, the information also applies to the Graph API.)
I've started working with Facebook Graph API this month and I'm currently experiencing some odd behaviors with it.
To start, I'm using the Graph API 1.0 (which supports public post searching), with queries such as those below.
https://graph.facebook.com/v1.0/search?q=foo bar&type=post
https://graph.facebook.com/v1.0/search?q=foo&type=post
The weird behavior in this case is that the first query returns almost the same number of results that the second one. Thus, no matter how "vague" my query is, I'm getting a limited number of posts (yeah, I'm already considering pagination).
So how does this work? The Graph API Documentation isn't clear about this subject, so any clarification would be really appreciated.
As I understood so far, Facebook does not return all public posts containing the researched terms. Some old questions here in StackTrace support this assumption (example)
Different apps or different users may retrieve different results (which is another "odd" behavior I found). (example)
Am I correct? If so, is there ANY way to improve my recall? Any paid services from Facebook or specific permissions that I should get for my app? Searching from multiple views (users or apps) would help? Is there any way to query only recent results and therefore obtain more results?
Thank you.
P.S.: I'm aware that Facebook has been planning to remove this functionality by 2015, but for now it's working and I wanted to give a try :-)
Hi this might eventually turn out to be a stupid question but i'd rather ask!! Its regarding GET search/tweets Twitter API v1.1. As documented by Twitter this particular API is designed to accept numerous parameter against which a search is performed and tweets are returned. One of these parameters is "geocode" which accepts value is specified by "latitude,longitude,radius", where radius units must be specified as either "mi" (miles) or "km" (kilometers) https://dev.twitter.com/docs/api/1.1/get/search/tweets.
Its quite alright if is set those parameter values.
My question is since it is "geocode" optional will not setting them return me universal tweets? or is there any other way I could find universal tweets using GET search/tweets Twitter API v1.1.
Also, Ive tried Streaming API POST statuses/filter with very indifferent/unsatisfactory results
P.S As per requirement of my app I need to search apps both universally and locally, as per users choice.
It seems if you skip the "geocode" parameter, Universal Tweets are returned!!