Get more than 20 last messages - twitter

Twitter API documentation says that I can get only 20 last messages (proof link). I'm just wondering if there is any other possibility to get more messages, for example - "all the messages from specific point in time".

I think you can specify count, which can be upto 200 and number of pages as well which allows you to retrieve upto 3200 status messages. And since_id allows you to retrieve messages after that particular message.http://twitter.com/statuses/friends_timeline.xml?count=100&page=5&since_id=23323

Check the parameters in the link you've pasted. There's a parameter count that allows you to get up to 200 messages in one call. If you want more then that you can change since_id parameter value to get even older entries or use page_id.

http://apiwiki.twitter.com/Twitter-REST-API-Method:-statuses-user_timeline
See the count parameter.
For example:
http://twitter.com/statuses/user_timeline.xml?screen_name=someuser&count=50
That would get 50 messages, instead of the default 20.

Related

Twilio Showing Wrong Number of Segments

I am calling Twilio API to fetch messages history. The number of messages and segments returned by the API are different than it shows in the Twilio Usage section. The end point I am calling to fetch the messages list is:
https://api.twilio.com/2010-04-01/Accounts/Account_SID/Messages.json
Please see the stats returned by Usage API for April 14, 2021 in the screenshot below:
You can see in the screenshot that the number of messages returned are 685 while the messages API is returning only 561 messages. Why is there such discrepancy?
The difference has to do with message segments. The /Messages resources and has a field called, "num_segments": "X" - so one message may be made up of multiple segments.
/Messages will be less than the result of the Usage API if you sent a message with more than one segment. A segment is what you are charged for. You can use this tool to see how many segments a message has, or view the results using the field mentioned above, num_segments.
Message Segment Tool

Is there a way to get more than 50 results from maxResults with the Youtube API?

I am trying to get a list of my subscribers using the Subscriptions: list. Is there a way to get values for all of my subscribers, or is it only possible to get 50 max? Is there another way to get values for all of my subscribers? I am aware the documentation says you can only get 50 results max, but I wanted to see if there was another way to get all the values. Thanks!
The max results you can get with 1 call is 50.
To get more results, you would need to make multiple calls. After the first call finishes and there are more results that can be obtained, the API call should return a string for the nextPageToken property. Use this for the optional pageToken parameter for your next API call. Repeat this process until you've obtained all the results.
Yes! Take a look at the pageToken parameter listed in the docs:
The relevant description is:
The pageToken parameter identifies a specific page in the result set that should be
returned. In an API response, the nextPageToken and prevPageToken properties identify
other pages that could be retrieved.

Twitter GET friends/lost API limitaion

In the case of standard plan, more than 15 times GET friends/list fetching isn’t be allowed within 15min. How can I increase this limit?
You cannot increase the limit - but you can increase how many results are returned.
According to the documentation, normally you will only get 20 results per API call. You can increase this to up to 200 by using the count parameter.
For example, friends/list.json?screen_name=edent&count=200 will get you the first 200 of my friends. You can then use the cursor to get more.

Youtube Data API V3 Number of results not equal to maxResults/pageInfo.resultsPerPage

Good day. I'm trying to get the top videos for gaming within the specified publish dates ordered by view count. I'm having a problem with the number of items that it is returning in the JSON response because it's less than 50 items even though I have set the maxResults parameter to 50 and the JSON response returns pageInfo.resultsPerPage equal to 50. The pageInfo.totalResults also returns a lot more than 50 so it should be displaying 50 items in the result. As an example, I'm using the followng URL
https://www.googleapis.com/youtube/v3/search?key={API_Key}&part=snippet&maxResults=50&order=viewCount&publishedAfter=2017-02-01T00%3A00%3A00Z&publishedBefore=2017-02-01T00%3A01%3A59Z&type=video&videoCategoryId=20
The returned result here the last time I ran this query has 20 items even though there are 161,307 total results. I would like to ask a solution that will make sure that I will always get the number of items equal to the maxResults if possible. Hope someone can help me on this. Thank you very much.
EDIT: I know how to use the page token, but I'm not aiming for getting the items that I need for more than one request (as the Data API have limited credits per day). The issue that I'm trying to resolve is to make sure that I always get 50 items everytime I invoke the request.
Although there are 160k+ total results, your publishedAfter/publishedBefore filters cut the number returned down to the videos published in that time range, which is 20.
Well, I got 50 results with the URL request that you provided. Just make sure that you place right value on the parameter that you use, especially the value in publishedAfter. You can also use the parameter pageToken to get the next page or next 50 results.
For more information, check this SO question on how to use pageToken

Max-results value is too high.YouTube API

I'm trying to load the first 100 videos of a YouTube channel and I can only load 50 videos. I always get this error message
Max-results value is too high. Only up to 50 results can be returned per query.
and I'm using this URL.
http://gdata.youtube.com/feeds/api/users/shaytards/uploads?&max-results=100
I'm not sure if I need any kind of developer key to load 100 results. Even if you know a way to load videos 75-100 would be great but any help would be appreciated.
The Youtube data API requires you to set up your own pagination if you need to get more than 50 results. In this case, then, you would set max-results to 50 and do the query, then on your page have some sort of "next" button (or however you want to implement your pagination) that would trigger a new call (either through ajax, a new page, or whatever your own workflow is). This new call would be to the same data feed, but you'd append the parameter &start-index=51 so that you'd get 50 more results, numbered 51-100. You can continue on like this up to 1000 results.
See https://developers.google.com/youtube/2.0/reference#Paging_through_Results for more details.
In the YouTube Data API V3 it is a little different. Each search query returns a "nextPageToken" that can be used in a subsequent query for more results. Documentation: https://developers.google.com/youtube/v3/guides/implementation/pagination

Resources