Welcome, Guest
Username: Password: Remember me

Rest Response Link Headers Pagination

Posts 1 to 3 of 3
5 days 22 hours ago #6958
Hi All,
Working on a Rest/Jason application using Delphi Berlin. Requests patient appointment data and returns the appointments for a given date range. Currently have it working except for the response is paginated 100 per page.
My question is how to request the link header information that contains the pagination information?
Thanks,
Mike B.
Log in to reply.
3 days 11 hours ago #6991
Hi,
What you say is the following things?



System::DynamicArray<System::Net::Urlclient::TNameValuePair> a;
_di_IHTTPResponse res = NetHTTPClient1->Head("ap-northeast-1.amazonaws.com/", a);
UnicodeString out;
for (int i1 = 0; i1 < res->GetHeaders().Length; i1++)
{
out = (res->GetHeaders())[i1].Name +"="+ (res->GetHeaders())[i1].Value + "\n";
}
Last Edit: 3 days 11 hours ago by haruyuki mohri.
Log in to reply.
3 days 1 hour ago #7024
Hi Haruyuki,
We aren't using Indy, we are using the RestClient,RestRequest and RestResponse compontents. The response is JSON but it is paginated. So they return 100 records per page. You must pass the request the page number to get the next page of data.
Something like this.. [url=https://xxxxxx/xx/appointments?start_date=2017-02-01&end_date=2017-02-10]https://xxxxxx/xx/appointments?start_date=2017-02-01&end_date=2017-02-10[/url]&Page=1
[url=https://xxxxxx/xx/appointments?start_date=2017-02-01&end_date=2017-02-10]https://xxxxxx/xx/appointments?start_date=2017-02-01&end_date=2017-02-10[/url]&Page=2
[url=https://xxxxxx/xx/appointments?start_date=2017-02-01&end_date=2017-02-10]https://xxxxxx/xx/appointments?start_date=2017-02-01&end_date=2017-02-10[/url]&Page=3
This returns the first page only. But the specs say it also returns a link header that tells you the number of pages. Trying to figure out how to access that part of the headers with the RestResponse.
[url=https://xxxxxx/xx/appointments?start_date=2017-02-01&end_date=2017-02-10]https://xxxxxx/xx/appointments?start_date=2017-02-01&end_date=2017-02-10[/url]
Thanks
M Bryan
Log in to reply.
Moderators: Carlos Perez