Aggregate Statistics¶
Get aggregate statistics for the user account. The statistics can be aggregated for the requester’s account and/or its sub-accounts, grouped by week or month and filtered by a time range.
HTTP Method
- GET /api/job/aggregate_statistics¶
Query String Parameters — Required
Name |
Details |
|
---|---|---|
v |
Description |
The version of the API to use |
Allowed Values |
1 |
|
Example |
|
|
api_token |
Description |
The API token used for this session |
Allowed Values |
Hex String |
|
Example |
|
Query String Parameters for filtering — Optional
Name |
Details |
|
---|---|---|
account_id |
Description |
Username of a sub account for which to return statistics. When unset, the call will return statistics for the requester's account. When set to *, the call will return statistics for both requester's account and its sub-accounts. |
Allowed Values |
String |
|
Example |
|
|
metrics |
Description |
List of metrics for which to calculate statistics. When unspecified, will return data for all available metrics. Currently supported metrics: -`billable_minutes_total` -`billable_minutes_mechanical` -`billable_minutes_premium` -`billable_minutes_professional` -`billable_minutes_foreign_transcription` -`billable_minutes_translation` -`billable_minutes_english_transcription` |
Allowed Values |
JSON array of strings |
|
Example |
|
|
group_by |
Description |
Defines how to segment the calculations. When unspecified, will return a single segment over the given time range. |
Allowed Values |
[“week”, “month”] |
|
Example |
|
|
start_date |
Description |
Will calculate statistics for jobs returned after the given date. When unspecified, the date of the first returned job is used as the start date. |
Allowed Values |
Date in ISO format. |
|
Example |
|
|
end_date |
Description |
Will calculate statistics for jobs returned before the given date. When unspecified, the current time is used as the end date. |
Allowed Values |
Date in ISO format. |
|
Example |
|
Responses
HTTP Code |
Details |
|
---|---|---|
200 |
Description |
Success |
Contents |
JSON formatted statistics.
See below for details. |
|
400 |
Description |
An error occurred |
Contents |
Error description (see Error Format for details) |
Example Requests and Responses
GET /api/job/aggregate_statistics?v=1&api_token=7ca5dc5c7cce449fb0fff719307e8f5f HTTP/1.1
Host: api.cielo24.com
HTTP/1.1 200 OK
Content-Type: application/json
{
"data": [
/* When group_by is unspecified, data is aggregated into a single block */
{
"billable_minutes_total": 372,
/* Note: Total = Foreign + English + Translation */
"billable_minutes_foreign_transcription": 13,
"billable_minutes_english_transcription": 340,
"billable_minutes_translation": 19,
/* Note: Total = Professional + Premium + Mechanical */
"billable_minutes_professional": 323,
"billable_minutes_premium": 6
"billable_minutes_mechanical": 43,
"start_date": "2015-03-20T15:32:19.902607",
"end_date": "2015-10-30T12:28:23.894872",
}
],
"start_date": null,
"end_date": null
}
GET /api/job/aggregate_statistics?v=1&api_token=7ca5dc5c7cce449fb0fff719307e8f5f HTTP/1.1
&metrics=["billable_minutes_total","billable_minutes_professional","billable_minutes_english_transcription"]
&start_date=2015-03-26T11:36:09.237373&end_date=2015-05-01T11:35:46.993607&group_by=week
Host: api.cielo24.com
HTTP/1.1 200 OK
Content-Type: application/json
{
"data": [
{
"billable_minutes_professional": 4,
"billable_minutes_total": 4,
"billable_minutes_english_transcription": 4,
"start_date": "2015-03-26T11:36:09.237373",
"end_date": "2015-03-28T23:59:59.999999"
},
{
"billable_minutes_professional": 10,
"billable_minutes_total": 14,
"billable_minutes_english_transcription": 14,
"start_date": "2015-03-29T00:00:00",
"end_date": "2015-04-04T23:59:59.999999"
},
{
"billable_minutes_professional": 15,
"billable_minutes_total": 25,
"billable_minutes_english_transcription": 17,
"start_date": "2015-04-05T00:00:00",
"end_date": "2015-04-11T23:59:59.999999"
},
{
"billable_minutes_professional": 17,
"billable_minutes_total": 18,
"billable_minutes_english_transcription": 15,
"start_date": "2015-04-12T00:00:00",
"end_date": "2015-04-18T23:59:59.999999"
},
{
"billable_minutes_professional": 10,
"billable_minutes_total": 10,
"billable_minutes_english_transcription": 10,
"start_date": "2015-04-19T00:00:00",
"end_date": "2015-04-25T23:59:59.999999"
},
{
"billable_minutes_professional": 38,
"billable_minutes_total": 38,
"billable_minutes_english_transcription": 38,
"start_date": "2015-04-26T00:00:00",
"end_date": "2015-05-01T11:35:46.993607"
}
],
"start_date": "2015-03-26T11:36:09.237373",
"end_date": "2015-05-01T11:35:46.993607"
}