Search code examples
xmlresthttpversionone

Count aggregate does not match data returned from Rest api


I did look at existing question Aggregation doesn't seem to match data in the VersionOne RESTful API

and I still have a issue.

rest-1.v1/Data/Epic/9549/SubsAndDown:Story[AssetState!='Dead'].@Count

- Above query returns 182 as # of stories in a given epic.

rest-1.v1/Data/Epic/9549/SubsAndDown:Story[AssetState!='Dead']

- However when I actually want to get all the story ids , I can only see 149 stories , I don't understand what happened to those missing 33 stories as I am using correct assestState.

One more example:

from: Epic
filter:
- Name=""{0}""
select:
- Name
- Scope.Name
- Status.Name
- SubsAndDown:Story[AssetState!='Dead'].@Count
- SubsAndDown:Story[AssetState!='Dead'&Estimate=''].@Count
- SubsAndDown:Story[AssetState!='Dead'&Estimate>='0'].@Count

Above query returns count as 182, 49, 133 respectively,

However when I actually counted the data returned [i.e. counting stories returned ] I got 149, 26, 123 respectively.

Does anyone have idea of whats happening here? Why doesn't count and data returned match?


Solution

  • I believe the discrepancy you are seeing is the result of member-based project access restrictions. The @Count summation is counting all stories that exist within that epic and state, but when you query for the list of individual stories, it is only listing the ones you have permission to see. An epic can contain stories that are themselves part of different projects. If you have access to some of those projects but not to others, you will see results along these lines.

    You could test this by limiting your count to stories belonging to a project to which you know you have access:

    rest-1.v1/Data/Epic/9549/SubsAndDown:Story[AssetState!='Dead';Scope='Scope:{some scope id}'].@Count