-
Bug
-
Resolution: Fixed
-
Low
-
3.1.4
-
4
-
Severity 3 - Minor
-
1
-
NOTE: This bug report is for JIRA Service Desk Server. Using JIRA Service Desk Cloud? See the corresponding bug report.
Summary
The Pagination used in JIRA Service Desk REST API does not return consistent results
Environment
JIRA Service Desk REST API
Steps to Reproduce
- Create a GET request for Customer Requests
<baseURL>/rest/api-name/resource-name?start=0&limit=100
- Observe the "size" from the result
Results
"size": 76, "start": 0, "limit": 100, "isLastPage": true,
- Change the start to a higher value and re-send the GET request
<baseURL>/rest/servicedeskapi/request?start=20&limit=100
- Observe the "size" from the result
Results
"size": 36, "start": 20, "limit": 100, "isLastPage": true,
- Change the start to a higher value and re-send the GET request
<baseURL>/rest/servicedeskapi/request?start=30&limit=100
- Observe the "size" from the result
Results
"size": 16, "start": 30, "limit": 100, "isLastPage": true,
Expected Results
From the above example, Pagination should return 56 and 46 respectively
Actual Results
Returned values are not 56 and 46 respectively
Notes
JIRA Service Desk REST API is still an experimental release as per this comment
Workaround
It seems that the Servicedesk api code actually skips “start” parameter amount of entires twice. So, if you add start=10, its actually doing start=20 internally. If you say start=100, its actually doing start=200.
In order to get it working correctly, you would need to use half of the value of the start parameter that you intend to use. For instance, I tried this :
http://localhost:8080/jira792/rest/servicedeskapi/request?start=0&limit=10
and then
http://localhost:8080/jira792/rest/servicedeskapi/request?start=5&limit=10
- relates to
-
JSDCLOUD-4187 Inconsistent JIRA Service Desk REST API Pagination
-
- Closed
-
-
JSDSERVER-5920 Running Servicedesk REST api to GET all requests posted by a customer does not fetch all issues
-
- Gathering Impact
-
-
JSDSERVER-4186 REST API 'limit' parameter has no effect
-
- Gathering Impact
-
-
JSMDC-2537 You do not have permission to view this issue
- was cloned as
-
SDECO-445 Loading...
[JSDSERVER-4187] Inconsistent JIRA Service Desk REST API Pagination
Remote Link | Original: This issue links to "JSDS-2537 (Bulldog)" [ 377156 ] | New: This issue links to "JSMDC-2537 (JIRA Server (Bulldog))" [ 377156 ] |
Workflow | Original: JSD Bug Workflow v5 - TEMP [ 2304711 ] | New: JAC Bug Workflow v3 [ 3126516 ] |
Status | Original: Done [ 10044 ] | New: Closed [ 6 ] |
Resolution | New: Fixed [ 1 ] | |
Status | Original: Awaiting Release [ 11372 ] | New: Done [ 10044 ] |
Symptom Severity | Original: Minor [ 14432 ] | New: Severity 3 - Minor [ 15832 ] |
Fix Version/s | New: 4.0.0 [ 81612 ] |
Status | Original: In Progress [ 3 ] | New: Awaiting Release [ 11372 ] |
Support reference count | Original: 3 | New: 4 |
UIS | New: 1 |
I found the issue in JSD codebase. Using sources decompiled by Intellij IDEA, but it gives you the idea.
Let's say there are 70 requests for the user, and I'm running a query with start=50. That means there should be 20 requests on the page. Now, see comments in code below.
ServiceDeskCustomerRequestServiceImpl:
PagedResponseImpl:
One way to fix this to replace the call in getCustomerRequests: