Is there any way to do paging with the HTTP API? For instance I’d like to retrieve the first 10 results, then the next 10, etc. I’m particularly interested in doing paging with search results, although I think it would be helpful for any kind of results.
Hi dgileadi, and welcome to the forums 
You can do paging by passing two HTTP headers (you can also pass them via querystring as the last parameters):
<br />
X-Plex-Container-Start: 10<br />
X-Plex-Container-Size: 20<br />
(to request offset 10, page size of 20).
Hope that helps.
Thanks, that’s perfect!
Hmm, I wasn’t able to get this to work in a browser. No matter what I did the full search results were returned in the XML.
I tried it both as query parameters and as HTTP headers (I added the headers via the Modify Headers add-on and verified that they were present using the HttpFox packet sniffer add-on). The URL I tried was http://localhost:32400/search?query=c; with the extra parameters it was http://localhost:32400/search?query=c&X-Plex-Container-Start=10&X-Plex-Container-Size=20. My version of Plex Media Server is 0.9.5.2.
Am I doing something wrong? Did I misunderstand what you were saying?
Apparently I lied and paging is not yet supported in the search endpoint. It does work other places, like:
<br />
http://localhost:32400/library/sections/1/all?query=c&X-Plex-Container-Start=10&X-Plex-Container-Size=20<br />
Fixed it in the code, so this will work in the release after the upcoming one.
Wow, thanks for the quick reply and for the fix.
Is there anyway to include the guid when browsing by recently added like this? I’d like to cross reference the tvdb or imdb ids when getting recently added content but currently the response back does not include guid infomation.
We leave that out to keep the responses smaller. Details XML (/library/metadata/X) will have the GUID.
with server version 0.9.6.7 i now get '500 internal server error' when i try paging??
That’s because of a new advanced query syntax on that endpoint. Try the old-school way of searching:
<br />
curl "http://localhost:32400/library/sections/1/search?type=1&query=Dict&X-Plex-Container-Start=0&X-Plex-Container-Size=20"<br />
Also found
http://localhost:32400/library/sections/1/all?X-Plex-Container-Start=0&X-Plex-Container-Size=20
to work like
http://localhost:32400/library/sections/1/all?query=c&X-Plex-Container-Start=10&X-Plex-Container-Size=20
use to
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.