It's all about the answers!

Ask a question

How to get REST API call repsonse body to return the next page data


Masizane Marivate (2317) | asked Apr 24 '18, 10:18 a.m.
edited May 02 '18, 3:23 a.m.

I ran an the following REST API call:

Headers:
  • <label class="" style="color: rgb(51, 51, 51); display: inline-block; font-family: Cousine; font-size: 12px; margin-right: 5px;"> accept: </label> "application/atom+xml"
  • <label class="" style="color: rgb(51, 51, 51); display: inline-block; font-family: Cousine; font-size: 12px; margin-right: 5px;"> oslc-core-version: </label> "2.0"
Get https://<my host url>/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/_yG3bADHBEeWfYafF4ht9rQ/testcase?fields=feed/entry/content/testcase/(webId|title|category[(@value='Automated TH' or @value='Automated UX') and (@value='Regression' or @value='Automation IR Issues') and (@value='Explora 1 %26 Explora 2A')]|state|estimate|customAttributes)
The response body is a paged atom feed with 50 testcases on page 0, so far so good. If I then use the links in the atom feed's link nodes, or run the previous API call and manually append a page no.(&page=1), I still get the same 50 testcases even though, according to the atom feed in the response body, I'm on a new page. This can be confirmed by "self","next", "previous", "last" attributes of the link nodes.

I have tried using "limit" and "offset" parameters in the API call to try and see if this would advance me to the next 50 results but have had no luck with that.

If I run the above call without any filters I get almost all 9713 testcases(don't know why not all are returned) in our project which, when I page through them using links, I get 26 pages of 50 unique records, thereafter each page starts repeating, until i've gone through 9000+ records. This results in 1300 unique records each repeated(duplicated) roughly 26 times, and in my inability to manually filter the results in my client, which I'm forced to do because the filter parameters bring back only 50 unique records, duplicated 86 times. 1300 is an improvement on 50, however still not the desired outcome.


Comments
Donald Nong commented May 01 '18, 3:49 a.m.

Just curious, if you access the link in the "next" attribute, what do you get?


Paul Slauenwhite commented May 01 '18, 1:17 p.m. | edited May 01 '18, 1:17 p.m.
FORUM MODERATOR / JAZZ DEVELOPER

The 'next' attribute should be the next page of the feed (see https://jazz.net/wiki/bin/view/Main/RqmApi#Feeds). 


Masizane Marivate commented May 02 '18, 3:17 a.m.

@Donald, With category filters, using the next link results in a new  page being loaded, as evidenced by the "self","next", etc. links. however the same 50 test cases that were listed on page 0 are on page 1, and on and on it goes as I page through 80 pages. The total no. of test cases returned equals the same filter if i entered it on the Jazz UI.
Without category filters, using the next link results in a new  page being loaded, as evidenced by the "self","next", etc. links. However this time I get a new set of 50 test cases for the next 25 pages(page 0 - 25), thereafter page 26 returns the same 50 that were on page 0, and on and on it goes as I page through 192 pages. The total no. of test cases returned is slightly less than the same unfiltered query if  entered on the Jazz UI.

As stated in my original questions, the filtered query results in 50 unique records as opposed to the expected +-3000, the unfiltered query results in 1300 unique records instead of +-9700. The issue is not whether or not I can page, it's returning unique records across all the pages.


Paul Slauenwhite commented May 02 '18, 3:39 a.m.
FORUM MODERATOR / JAZZ DEVELOPER

Are you able to reproduce the symptom in the jazz.net sandbox?  If so, please open a RQM defect. 


Masizane Marivate commented May 02 '18, 12:30 p.m.

I was able to reproduce. How do I go about logging a defect?


Paul Slauenwhite commented May 02 '18, 11:35 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
showing 5 of 6 show 1 more comments

One answer



permanent link
Paul Slauenwhite (8.4k12) | answered Apr 25 '18, 12:38 p.m.
FORUM MODERATOR / JAZZ DEVELOPER

Please read https://jazz.net/wiki/bin/view/Main/RqmApi#Feeds. 


Note, you're using the OSLC-Core-Version header (not required), which is for the OSLC QM API (see https://jazz.net/wiki/bin/view/Main/RqmOslcQmV2Api).  


Comments
Masizane Marivate commented May 01 '18, 1:59 a.m.

I regularly switch between REST calls and OSLC calls as I'm currently trying to figure out the best way to get data out of Jazz. Thanks for poinitng out the headers, but I've found it makes no difference to the problem in the main question even if I leave out all headers accidentally.


Paul Slauenwhite commented May 01 '18, 1:18 p.m.
FORUM MODERATOR / JAZZ DEVELOPER

You're probably not URL-decoding the &amp; (&) in the next page link. 


Masizane Marivate commented May 02 '18, 3:14 a.m.

I am when using the link, when directly accessing the url by appending page no. then I don't need to, and as stated in the questions above, the pages are changing, the content is not. If the url had an error, page 0 would be consistently returned. however, in my case, even if I'm on page 79 ("self" link = "....page=79") the content(testcases) is the same as page 0.

I would do a dump of the XML received if it were possible.


Paul Slauenwhite commented May 02 '18, 3:36 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
The page URL contain the original request URL plus the following request parameters:

-token
-page

It's best to use the 'next' link URL (requires URL-decoding) as-is to access the next page of the feed. 

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.