Outlook REST API: How to page through $search results, when searching for messages - outlook-restapi

I have troubles paging through message search results with the rest API.
I have a request looking like this:
outlook.office.com/api/v2.0/me/messages/?$search="deni"
the request returns a proper result and also includes a 'next page' looking like this:
"#odata.nextLink": "https://outlook.office.com/api/v2.0/me/messages/?%24search=%22deni%22&%24top=10&%24skiptoken=aT01NjMzYWQ3OS02MmJjLTQ5ZDEtODg4ZC0zYTgwNDlhOTY3Nzkmcz0xMA%3d%3d"
I guess this link is URL encoded so I URL decode it to get this:
outlook.office.com/api/v2.0/me/messages/?$search="deni"&$top=10&$skiptoken=aT01NjMzYWQ3OS02MmJjLTQ5ZDEtODg4ZC0zYTgwNDlhOTY3Nzkmcz0xMA==
However, when i try to make request with the next link I'm getting 405 Method Not Allowed with the following error:
"The OData request is not supported."
I've tried it in the sandbox as well (oauthplay.azurewebsites.net) - same result. What could it be that I am doing wrong. What is the right way to page through the search results?
I know that there is a limit of 250 messages that could be searched, but this is not the case here. I have 10 and I am trying to read the next 10.
Of course I have tried paging with the $skip and $top parameters, but $kip is not supported together with $search.
I can't seem to find a definitive answer in the documentation on how to page through search results and is it possible at all.
Thanks to anyone willing to help.

Related

How can I paginate Pagerduty REST API results when requesting incident lists?

I'm building an application which pulls down incident listings for my org via Pagerduty's REST API.
The GET /incidents endpoint does respond with more, offset, and other keys that are indicative of pagination being supported, and it does make intuitive sense on this endpoint, but I haven't been able to actually paginate these results:
Passing offset or limit as a query param returns a 403
Passing these in various forms in request headers just gets ignored entirely
Is there a way to paginate these results at all?
it might help to include the code you're using to make the request, or a curl request from the command line. Including pagination parameters shouldn't lead to a 403, so I'm thinking something else might be missing.
You should be able to paginate the lists using GET parameters, e.g
https://api.pagerduty.com/incidents?limit=20&offset=100
limit has a maximum value of 100, and limit + offset together must be less than 10,000. That might be why you were getting an error?
See here for additional details on the pagination parameters
Yes, it's possible to paginate the results.
After invoking the API method for the first time, you need to check the more response field value. If true, then you can call the API method again with an updated offset.
offset is related to the total results, and not the total pages.
The 403 error code response you're getting is most likely related to the user permissions and not with paginating results.

Instagram max_id not working

We have been using below end point to fetch the Instagram feeds
https://www.instagram.com/saintgobaingroup/?__a=1&max_id=
Later, for further feeds we use to fill the max_id parameter with last entry's id. It was working fine but now Instagram end point seems to have change the response format.
We are able to update the piece of code to match the response. However the max_id parameter seems to be not working now.
We are getting same 12 records even when we have more than 400 records. We are properly updating the max_id parameter like we use to do earlier. But we are unable to get further records only 12 records being getting repeated.
Any idea on this?
Note : As of now we're not focusing on using the Instagram API. We would like to get it done with end point ?__a=1
The answer doesn't work with ?__a=1, but it does get you pagination here: https://stackoverflow.com/a/49266320/929540

Youtube search using the google API

I am using the google API and I wanted to do a youtube search.
I request a search with https://www.googleapis.com/youtube/v3/search?part=snippet&q=[word that I searched for]&key=my_keyto get the items array. I noticed though that the items array does not return the results in the same order as when you search youtube yourself.
Ex: if I search for the word 'bad' the first result in the items array is the "Young Lex ft AwKarin - BAD ( Official Music Video Clip )" while if I searched like a youtube user its the "Michael Jackson - Bad (Shortened Version)".
Perhaps they are not ordered and I have to order them using a property or something I have missed.
So my question is how can I make the items array return as the first item the first result that would have appeared in the youtube search.
edit: I have tried adding chart=MostPopular leaving to default videoCategoryId, but it still showed the same first result.
Well, it seems that the YouTube acts like that and it is a natural behavior of it. The only possible way that you can do to match the API and the YouTube site itself is by passing the same filter for it. Example is upload date and viewCount.
Here is the example request for viewCount.
https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.search.list?part=snippet&maxResults=10&order=viewCount&q=spider&_h=1&
and this is for the YouTube site
https://www.youtube.com/results?q=spider&sp=CAM%253D
Hope this slight information helps you.

Amazon Api Item Search

I am using Amazon Api to search for item. I am doing a simple
amazon.ItemSearch(Keywords="Sachin Tendulkar", SearchIndex="All", ResponseGroup="ItemAttributes")
But the result is not a popular Sachin Tendulkar book or the best search I would want.
How can I get multiple results in Item Search ?
How can I get the most popular search result?
amazon.ItemSearch(Keywords="UC Berkeley", SearchIndex="All", ResponseGroup="ItemAttributes")
gives even worse results.
Is there an option in the API that I am missing? Thanks
If you're not getting the results you expect, adjusting the SearchIndex option to something other than "All" can often help improve the results by making a less broad search.
If you change it to "Books", do you get the expected results for "Sachin Tendulkar"?
In case that doesn't fix the problem, do you get expected results for really common searches like "Apple TV"? And when you search for "Sachin Tendulkar" or others on Amazon.com do you the items returned by your API request show up at all (perhaps even pages down)?

YouTube API - Retrieve results specific page

I'm trying to get paginated results from Youtube Data API v3,
https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=UUCj956IF62FbT7Gouszaj9w&key={YOUR_API_KEY}
now, in the response there's the handy parameter nextPageToken that links to the next page of the results set
"nextPageToken": "CAUQAA"
Is there any way to jump to a specific page of the results, say the 6th?
Apologies, but no, there is not. This is intentional. You can only move forward one page of results at a time.

Resources