It's all about the answers!

Ask a question

How to get the result of a GET request "splitted" with REST API


emanuele roccotelli (633) | asked Jun 23 '14, 3:18 a.m.
Hello,

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:results
I 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



permanent link
Dinesh Kumar B (4.1k413) | answered Jun 23 '14, 4:23 a.m.
JAZZ DEVELOPER
edited Jun 23 '14, 4:24 a.m.
have you tried the Resource Paging as mentioned in :

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.

A client can also request paging by adding the "key=value" pair 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.

permanent link
emanuele roccotelli (633) | answered Jun 23 '14, 8:54 a.m.
I tried that too, but is seems to do not work. I don't know exactly how to make queries or set parameters in this URL.

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?

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.