You can produce a count by comparing between branches, revisions or runs, as long as the ids you provide belong to the same project. It's not possible to compare objects of different types, such as a branch to a run.
| Type of comparison | Original set of issues | Minus this set of issues |
|---|---|---|
| branch | branch-id={branch_id_A} |
compare-branch-id={branch_id_B} |
| revision | revision-id={revision_id_A} |
compare-revision-id={revision_id_B} |
| run | run-id[]={run_id_A} |
compare-run-id[]={run_id_B} |
How to Make the Request
Request: Use run ids to learn how many issues were in run A and not in run B
curl -X GET https://subdomain.cop.blackduck.com/api/query/v1/roll-up-counts?project-id[]={project_id}&run-id[]={run_id_A}&compare-run-id[]={run_id_B}&page-limit=10
-H "accept: application/vnd.api+json"
-H 'Authorization: Bearer {JWT}'
This example will return a count of issues that appeared in the first run (run_id_A), but not in the second (run_id_B). (The result is equivalent to set A minus set B.)
You can reverse the order of the id values to reveal issues that are newly found instead of issues that were not found in the later run.
Compare Multiple Runs
You can provide more than one id for either half of the comparison or for both. When you provide multiple ids, their issues are combined into a single set. This approach is useful when you want to combine all the runs from a period of time, or combine runs that employed different tools.
Request: Compare a group of runs with another group of runs
curl -X GET https://subdomain.cop.blackduck.com/api/query/v1/roll-up-counts?project-id[]={project_id}&run-id[]={run_id_A}&run-id[]={run_id_B}&compare-run-id[]={run_id_Y}&compare-run-id[]={run_id_Z}&page-limit=10
-H "accept: application/vnd.api+json"
-H 'Authorization: Bearer {JWT}'
The request above would combine the two values for run-id into a set and the two values for compare-id into another set, resulting in (a, b) - (y, z).
You can also use multiple entries to compare branches and revisions.
Use the Values earlier and later
When comparing runs, you can use the values earlier and later in place of the compare-run-id value to compare with the run that happens immediately before or after the run indicated by id. The only parameter that can accept earlier or later as a value is compare-run-id.
Earlier will return the number of issues that appeared in the run indicated by id but not in the run immediately before it.
Later will return the number of issues found in the run indicated by id and not in the one after it.
later to indicate the most recent scan, be sure that results of the scan are ready. Request: Compare a run with a known id to whatever run came immediately before it
curl -X GET https://subdomain.cop.blackduck.com/api/query/v1/roll-up-counts?run-id[]=<run_id>&compare-run-id[]=earlier
-H "accept: application/vnd.api+json"
-H 'Authorization: Bearer {JWT}'