How to get REST API call repsonse body to return the next page data
I ran an the following REST API call:
Headers: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.
showing 5 of 6
show 1 more comments
|
One answer
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.
You're probably not URL-decoding the & (&) 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.
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
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.
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?
Please open a RQM defect.