|
Re: is "perpage" query param supported for data API? [message #17751 is a reply to message #17750] |
Tue, 21 May 2019 17:56 |
Trevor-DHS
Messages: 802 Registered: January 2013
|
Senior Member |
|
|
Hi,
For the first link, there should be no semicolon (;) in the call (the link is correct, but the display here is adding a semicolon that should not be there):
http://api.dhsprogram.com/rest/dhs/v7/data?countryIds=EG& ;perpage=1000
However, you are right that there is a bug and the API is only returning 100 records instead of the number specified in the call.
For the second link, the call should use a question mark (?) before the perpage parameter. The reason is that the API supports two types of parameters:
1) RESTful parameters and Query-based parameters. RESTful parameters follow a slash (/) following the basic endpoint (e.g. FE_FRTR_W_TFR is a RESTful parameter). RESTful parameters are separated by commas (,).
2) Query based parameters can then follow the RESTful parameters, and follow a question mark (?). Query based paramters are of the form param=value, so perpage=1000 is a restful parameter, as is countryIds=EG. Query based parameters are separated by ampersands (&).
In the second example you have a RESTful parameter (FE_FRTR_W_TFR) and a query based parameter (perpage=1000).
You could also write the following:
http://api.dhsprogram.com/rest/dhs/data/FE_FRTR_W_TFR,EG?per page=1000&f=html
which has two RESTful parameters (FE_FRTR_W_TFR and the country code EG, separated by a comma) and, following the question mark, two query based parameters (perpage=1000 and f=html separated by an ampersand (&)).
I hope this helps. We will get the perpage parameter corrected quickly.
[Updated on: Tue, 21 May 2019 18:02] Report message to a moderator
|
|
|
|
|