Getting the TOTAL of work items based on a query via the REST API
I know how to get work items from the API. For example:
https://SERVER:PORT/jazz/rpt/repository/workitem?fields=workitem/workItem[projectArea/name='ProjectName' and category/name='CategoryName']/(id|itemId|summary|target/name|category/name|type/name|owner/name)&size=500
Unfortunately, that does not return a TOTAL. You have to keep loading the "next" link until it returns no results - there is no way to know how far along you are in loading the query results. Is there a parameter I can pass that will show me the total # of work items I will get from the query above, for example?
https://SERVER:PORT/jazz/rpt/repository/workitem?fields=workitem/workItem[projectArea/name='ProjectName' and category/name='CategoryName']/(id|itemId|summary|target/name|category/name|type/name|owner/name)&size=500
Unfortunately, that does not return a TOTAL. You have to keep loading the "next" link until it returns no results - there is no way to know how far along you are in loading the query results. Is there a parameter I can pass that will show me the total # of work items I will get from the query above, for example?
One answer
From the URL it looks like you are using the Reportable REST API documented here:
https://jazz.net/wiki/bin/view/Main/ReportsRESTAPI
I don't see anything in there documenting that the total is included in the response representation. It doesn't mean it doesn't exist however. I've pointed this forum post to the appropriate team responsible for the AP. Perhaps they can clarify if what you are looking for exists or not.
There is also OSLC related workitems API. You can see in the pagination section related here that it's including the total count you are looking for in the example representation. Perhaps this is an alternative you could use instead.
https://jazz.net/wiki/bin/view/Main/WorkItemAPIsForOSLCCM20#Pagination
https://jazz.net/wiki/bin/view/Main/ReportsRESTAPI
I don't see anything in there documenting that the total is included in the response representation. It doesn't mean it doesn't exist however. I've pointed this forum post to the appropriate team responsible for the AP. Perhaps they can clarify if what you are looking for exists or not.
There is also OSLC related workitems API. You can see in the pagination section related here that it's including the total count you are looking for in the example representation. Perhaps this is an alternative you could use instead.
https://jazz.net/wiki/bin/view/Main/WorkItemAPIsForOSLCCM20#Pagination