#
Cycle time averages
This is an aggregate average of cycle times, which gives you insight into the overall trend of your project.
You will have to query and get an id for a project to get average cycle times.
Given an id for a project, you can query average cycle times like so:
curl -H "X-API-Key: <your token goes here>" \
https://api.accidentalquality.com/api/avg_cycle_times/<project_id>
fetch('https://api.accidentalquality.com/api/avg_cycle_times/<project_id>', {
method: "GET",
headers: {"Content-type": "application/json;charset=UTF-8", "X-API-Key": "<your-token-goes-here>"}
})
.then(response => response.json())
.then(json => console.log(json))
.catch(err => console.log(err));
The data returned is in json format and structured as follows:
- unit (string) - Unit of the data displayed in the data array
- data (array)
- x string - Date for the datapoint in format yyyy-mm-dd
- y float - Value for the cycle time for the datapoint in seconds
Example:
{
"unit":"Date/seconds",
"data": [
{
"x": "1990-01-01",
"y": 123.0
},
{
"x": "1990-01-01",
"y": 321.0
},
...
]
}
Note that the structure of data is identical to repair time averages and failure time averages, and very similar to cycle times, repair times and failure times.
This should allow reuse of code between the API endpoints (be aware of the difference between float and integers!) 😉