CDR Service
The CDR (Call-Detail Record) Service is used to return statistics about past phone calls.
This service is available to Apps registered to the following account types:
Administrator
Organization
User
Base URL
https://{domain}/uapiEndpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /cdr/{userId} | List CDR |
| GET | /cdr/stats/{userId} | CDR Stats |
List CDR
This method allows getting a list of calls from the call history of a system in particular contexts such as User, Organization or global (as Admin). Use this service to retrieve a list of phone calls that occurred in the system.
/cdr/{userId}Request
Path Parameters
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
userId | string | Yes | It can take one of the following values:
If missing, userId will be taken from the authorization token. | - |
Query Parameters
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
startIndex | startIndex | No | The start index of the collection. A list of phone calls from call history starting with startIndex-th call record. | - |
count | count | No | - | |
filterBy | string | No | Records can be filtered only by source, destination, published and answered. | published |
filterValue | filterValue | No | - | |
source | source | No | - | |
destination | destination | No | - | |
startDate | string | No | Date when the call was answered. If saveStartDate is also given in the request, it will be ignored and only startDate will be taken into consideration. If neither startDate or endDate are given in the request, the time interval will be set to the current month. | - |
endDate | string | No | Date when the call was answered. If saveEndDate is also given in the request, it will be ignored and only endDate will be taken into consideration. If neither startDate or endDate are given in the request, the time interval will be set to the current month. | - |
saveStartDate | string | No | Date when the call was saved to the database. If startDate is also given in the request, saveStartDate will be ignored. If neither saveStartDate or saveEndDate are given in the request, the time interval will be set to the current month. | - |
saveEndDate | string | No | Date when the call was saved to the database. If endDate is also given in the request, saveEndDate will be ignored. If neither saveStartDate or saveEndDate are given in the request, the time interval will be set to the current month. | - |
disposition | disposition | No | - | |
flow | flow | No | - | |
fields | array | No | An array of PhoneCall properties to be returned. | - |
sortOrder | sortOrder | No | The parameter can be set to one of the values: asc or desc (E.g. &asortOrder=desc). Records will be ordered by published. You are not allowed to set the field to sort by. | - |
Authentication
This endpoint requires authentication via cookie or header token.
Responses
200 OK
If successful, this method returns a 200 OK HTTP status code and a collection of PhoneCall resources.
Example Response
{
"entry": [
{
"id": "53bec7de3c242d5f87e5",
"ownerId": "33",
"phoneCallView": [
{
"source": "14141555",
"destination": "0003*002"
},
{
"source": "14141555",
"destination": "0003*006"
}
]
},
{
"id": "ad5a65672e3f783665c0",
"ownerId": "33",
"phoneCallView": [
{
"source": "14141555",
"destination": "0003*002"
}
]
}
],
"startIndex": 200,
"totalResults": 34922,
"itemsPerPage": 100,
"filtered": true,
"sorted": true,
"paging": {}
}204 No Content
If successful but there are no phone calls to be returned, this method returns 204 No Content HTTP status code. It does not return anything in the response body.
400 Bad Request
If an error occurred, this API can return the standard Errors Codes or one the following:
Error codes:
PhoneCallStatErrors
401 Unauthorized
If an error occurred while verifying if the user is allowed to perform the operation, this API can return the standard Errors Codes or one the following:
Error codes:
Code Examples
cURL
curl 'https://api.hubgets.com/uapi/cdr/33?startIndex=200&count=100&startDate=2018-02-01T00:00:00' \
-H 'x-xsrf-token: 44HzZ6YIHDN6mbRY' \
-H 'content-type: application/json' \
-H 'cookie: dev=ffffffffffffffff2kjZMApYaH; xsrf-token=44HzZ6YIHDN6mbRY; vn=XI%2Cm-tpsEWgqBMBCNVpeAnUEaeqCpG7f'CDR Stats
This method allows getting statistics from the call history of a system in particular contexts such as User, Organization or Admin. Statistics are about the total number of incoming/outgoing calls grouped by disposition (ANSWERED, NO ANSWER, FAILED, BUSY, NOT ALLOWED). Use this service method to retrieve statistics for call history that occurred in the system.
/cdr/stats/{userId}Request
Path Parameters
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
userId | string | Yes | It can take one of the following values:
If missing, userId will be taken from the authorization token. | - |
Query Parameters
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
startDate | string | No | Date when the call was answered. If saveStartDate is also given in the request, it will be ignored and only startDate will be taken into consideration. If neither startDate or endDate are given in the request, the time interval will be set to the current month. | - |
endDate | string | No | Date when the call was answered. If saveEndDate is also given in the request, it will be ignored and only endDate will be taken into consideration. If neither startDate or endDate are given in the request, the time interval will be set to the current month. | - |
saveStartDate | string | No | Date when the call was saved to the database. If startDate is also given in the request, saveStartDate will be ignored. If neither saveStartDate or saveEndDate are given in the request, the time interval will be set to the current month. | - |
saveEndDate | string | No | Date when the call was saved to the database. If endDate is also given in the request, saveEndDate will be ignored. If neither saveStartDate or saveEndDate are given in the request, the time interval will be set to the current month. | - |
Authentication
This endpoint requires authentication via cookie or header token.
Responses
200 OK
If successful, this method returns a 200 OK HTTP status code and a collection of PhoneCall resources and the PhoneCallStat associated.
Type: Array of object
Example Response
[
{
"type": 0,
"total": 70,
"answered": 16,
"unanswered": 18,
"busy": 15,
"failed": 21,
"unknown": 0,
"unallowed": 0
},
{
"type": 1,
"total": 91,
"answered": 14,
"unanswered": 57,
"busy": 12,
"failed": 8,
"unknown": 0,
"unallowed": 0
}
]400 Bad Request
Error codes:
Code Examples
cURL
curl 'https://api.hubgets.com/uapi/stats/761?startDate=2018-01-01T00:00:00&endDate=2018-03-01T00:00:00' \
-H 'x-xsrf-token: 44HzZ6YIHDN6mbRY' \
-H 'content-type: application/json' \
-H 'cookie: dev=ffffffffffffffff2kjZMApYaH; xsrf-token=44HzZ6YIHDN6mbRY; vn=XI%2Cm-tpsEWgqBMBCNVpeAnUEaeqCpG7f'