How to get the result of a GET request "splitted" with REST API
I created a java application to make GET requests with REST API.
It works for small results, but if the XML page returned is too big, the connection is lost and i get only a small part of the data I need.
The url I'm using is something like this:
https://address:9443/jazz/oslc/queries/_hFblYPIREeO27NaQrcNhvA/rtc_cm:resultsI thought that if i were able to get the data I need in distinct pages, i could get them all without problems.
So I made some research and discovered that it is actually possible to split the page, but I none of the solution given worked for me.
So my question is: how can I get the data splitted in different pages, so i can navigate them and get all the datas?
2 answers
I tried some URLs but the server just ignores them and tries to give me the whole page. I'm currently testing it on my browser, but my java app does not work.
I tried these:
https://address:9443/jazz/oslc/queries/_hFblYPIREeO27NaQrcNhvA/rtc_cm:results?oslc.paging=true&oslc.pageSize=5&_startIndex=0
https://address:9443/jazz/oslc/queries/_hFblYPIREeO27NaQrcNhvA/rtc_cm:results?oslc.paging=true
https://address:9443/jazz/oslc/queries/_hFblYPIREeO27NaQrcNhvA/rtc_cm:results?
oslc.paging=true&
oslc.pageSize=10
https://address:9443/jazz/oslc/queries/_hFblYPIREeO27NaQrcNhvA/rtc_cm:results?paging=true&pageSize=5
Am I missing something or writing the URLs the wrong way?
Resource Paging section of
http://open-services.net/bin/view/Main/OslcCoreSpecification?sortcol=table;up=#Query_Capabilities
here is an extract from the above link :
Another solution is to use Resource Paging; here's how it works. To get a paged version of a resource, a client adds the "key=value" pair
oslc.paging=true
to the query component of the resource URI and the server MAY respond by returning a representation that contains partial information about the resource; only a subset of the resource's property values.
When a page is returned and it is NOT the last page in the sequence, then it SHOULD include an
oslc:ResponseInfo
(defined below), which that contains a resource-valued property
oslc:nextPage
that links to a resource that represents the next page of property-values. Because paging is unstable (see below), by the time a client follows an
oslc:nextPage
link there may no longe be a next page, in this case the server MAY respond with an HTTP 404 Page Not Found status code.
oslc.pageSize
to the query string component of the resource URI. By adding this, a client requests that the server respond with a specific number of property values. For example,
oslc.pageSize=20
indicates to the server that the client would like 20 values per page. OSLC Services MAY ignore
oslc.pageSize
hope it helps.