Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

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.

0 votes

Comments

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

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

@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.

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

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

showing 5 of 6 show 1 more comments


One answer

Permanent link

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).  

0 votes

Comments

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.

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

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.

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 log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 12,027
× 480

Question asked: Apr 24 '18, 10:18 a.m.

Question was seen: 2,651 times

Last updated: May 02 '18, 11:35 p.m.

Confirmation Cancel Confirm