Search code examples
versionone

How can I find defect cycle time using the VersionOne Core API?


I want to analyze the cycle time for defects. For each defect, across all iterations, I need to subtract the resolution date (the date the defect was closed) from the opening date (the date the defect was planned into an iteration). I am unable to find this among the available reports. How can I find defect cycle time using the VersionOne Core API?


Solution

  • There is not a predefined attribute for cycle time. Rather, the value must be calculated using the attribute definition syntax. We use the History attribute, filtered by the range of statuses that make up the cycle, and sum up the days.

    History[Status.Name='Future','In Progress','Done'].Days.@Sum
    

    You can use the query.v1 endpoint to POST the following query:

    from: Defect
    where:
      Scope.ParentMeAndUp.Name: The Desired Project
    select:
      - Name
      - Status
      - History[Status.Name='Future','In Progress','Done'].Days.@Sum
    

    Or, using the rest-1.v1/Data endpoint, you can GET the following query:

    <Server Base URI>/rest-1.v1/Data/Defect?where=Scope.ParentMeAndUp.Name='The%20Desired%20Project'&sel=Name,Status,History[Status.Name='Future','In%20Progress','Done'].Days.@Sum