Get JSON data from multiple pages in Articles RESTful API

572 views
Skip to first unread message

Alex Maina

unread,
Apr 7, 2020, 4:37:01 AM4/7/20
to Europe PMC Developer Forum
I am trying to get all JSON data for the url below.


However, the API default limit is 25 items per page. My objective is to get JSON data for the next 25 items in page 2(next page). To do this, i alter the url to:


Notice the page=2 in red.

The problem is that this new link returns same results as those in page = 1



NOTE:
I know i can set limit to 50 and get desired results. I don't want this. I want to get 25 items per page up until the last page.


Dayane Araujo

unread,
Apr 14, 2020, 7:45:55 AM4/14/20
to Europe PMC Developer Forum

Hi Alex, 


Thank you for your query and sorry for the delay in replying.


You will need to use the cursorMark parameter for pagination of the result list. You can find the documentation here: https://europepmc.org/RestfulWebService#!/Europe32PMC32Articles32RESTful32API/search.


For the first request, you can leave the cursorMark empty or use the default value * (asterisk sign). Then, use the value of the returned nextCursorMark element to get every following page.


Please, check the examples below: 


First request: https://www.ebi.ac.uk/europepmc/webservices/rest/search?query=malaria&resultType=lite&cursorMark=*&pageSize=10&format=json


Second request: https://www.ebi.ac.uk/europepmc/webservices/rest/search?query=malaria&resultType=lite&cursorMark=AoIIQLDIayg0MTM4NjMwOQ%3D%3D&pageSize=10&format=json


Let us know if there is anything else we can help with.


Kind regards,


Europe PMC team


Reply all
Reply to author
Forward
0 new messages