CDR Export Tasks
Schema
A CDR Export Task is a long running request to dump cdrs from a certain date into a file.
Type Object
| Name | Type | Description |
|---|---|---|
date |
String(format:date) | Desc. date |
error_code |
Enum(OK):String |
* OK - there was no error |
format |
Enum(CSV, MLJSON):String |
Desc. format |
id |
String(format:ulid) | Desc. id |
inserted_at |
String(format:date-time) | An ISO8601 formatted timestamp |
on_done_actions |
OnDoneActions | |
reference_id |
String(1..255) | Desc. reference_id |
status |
Enum:String | Desc. status |
type |
Enum(API, MMS, SMS, VOICE, BALANCE, MISC):String |
Desc. type |
updated_at |
String(format:date-time) | An ISO8601 formatted timestamp |
Desc. date
An ISO8601 formatted date. Determines which day's cdrs will be exported.
Note that if a current or future date is provided, the task will be deferred to the day AFTER the given date.
Desc. format
The intended exported format, CSV will export a CSV file as expected. MLJSON exports the cdrs as Multiline-JSON, that is each row in the file is a single CDR record encoded as JSON.
Desc. id
Another format for UUID, used primarily for tasks, requests and messages.
Desc. reference_id
A unique client provided id for the export task.
There is no particular format that is enforced, a general recommendation is to avoid spaces and non-ASCII characters for best experience.
Enum Values status
Allowed values
NEWSCHEDULEDPROCESSINGSTORINGDELIVERINGCOMPLETEDABORTEDERROR
Desc. status
Status gives a brief overview of the state of the task.
NEW- the export task was freshly created and has not begun processingSCHEDULED- the task has been scheduled to execute at a later time (see date field for more information)PROCESSING- the task has begun processingSTORING- the task is currently storing its results on internal storage for later accessDELIVERING- the task is now attempting to deliver the exported file to the given endpoints (or notifying)COMPLETED- the task is completed and it is safe to delete or retrieve the exported detailsABORTED- the task was aborted, execution was haltedERROR- the task experienced an error, error_code will have more details if any
Desc. type
The main type of CDR that should be exported
API- contain any LRN, LRNE, CNAM related callsMMS- contain the billed details for MMS recordsSMS- contain the billed details for SMS recordsVOICE- contain any voice related calls (TERMINATION, DID*)BALANCE- any balance related changes, including payments, adjustments etc...MISC- contains various registry related feees
Example
{
"date": "string",
"error_code": "OK",
"format": "CSV",
"id": "01EH2Y28M6KXG14QMPM3HSP1Y0",
"inserted_at": "2021-08-13T04:08:44.762841Z",
"on_done_actions": [
{
"archive_format": "TAR_GZ",
"auth_identity": "upload-user",
"auth_method": "BASIC",
"auth_secret": "supersecretsauce",
"data": "sftp://example.com:22/sub/path/to/store/exported_file/in",
"error_code": "OK",
"filename": "string",
"protocol": "SFTP",
"reference_id": "SFTP-export-action",
"status": "NEW",
"type": "SEND"
}
],
"reference_id": "cdr-export-API-2022-03-14",
"status": "NEW",
"type": "API",
"updated_at": "2021-08-13T04:08:44.762841Z"
}
API
Create CDR Export Task
POST /api/v1/cdr_export_tasks HTTP/1.1
Create a new CDR Export Task.
Note that export tasks can be created without setting any on_done_actions, however it may prove difficult to retrieve the exported file without assistance if done so.
Therefore it is recommended that an on_done_action is set with an appropriate endpoint to deliver the exported file to.
Request application/json
POST /api/v1/cdr_export_tasks HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 566
{
"data": {
"date": "string",
"format": "CSV",
"on_done_actions": [
{
"archive_format": "TAR_GZ",
"auth_identity": "upload-user",
"auth_method": "BASIC",
"auth_secret": "supersecretsauce",
"data": "sftp://example.com:22/sub/path/to/store/exported_file/in",
"filename": "string",
"protocol": "SFTP",
"reference_id": "SFTP-export-action",
"type": "SEND"
}
],
"reference_id": "cdr-export-API-2022-03-14",
"type": "API"
},
"type": "call_data_export_task"
}
Response 201
application/json
HTTP/1.1 201
Content-Type: application/json
Content-Length: 803
{
"data": {
"date": "string",
"error_code": "OK",
"format": "CSV",
"id": "01EH2Y28M6KXG14QMPM3HSP1Y0",
"inserted_at": "2021-08-13T04:08:44.762841Z",
"on_done_actions": [
{
"archive_format": "TAR_GZ",
"auth_identity": "upload-user",
"auth_method": "BASIC",
"auth_secret": "supersecretsauce",
"data": "sftp://example.com:22/sub/path/to/store/exported_file/in",
"error_code": "OK",
"filename": "string",
"protocol": "SFTP",
"reference_id": "SFTP-export-action",
"status": "NEW",
"type": "SEND"
}
],
"reference_id": "cdr-export-API-2022-03-14",
"status": "NEW",
"type": "API",
"updated_at": "2021-08-13T04:08:44.762841Z"
},
"type": "call_data_export_task"
}
Response 403
application/json
HTTP/1.1 403
Content-Type: application/json
Content-Length: 312
{
"errors": [
{
"code": "access_denied.no_scope",
"detail": "No scope available to user role",
"params": {
"action": "index",
"level": "guest",
"resource": "resource"
},
"sub_code": "none",
"title": "Access Denied, no scope available"
}
]
}
Response 422
application/json
HTTP/1.1 422
Content-Type: application/json
Content-Length: 241
{
"errors": [
{
"code": "invalid_parameter",
"detail": "The specified resource could not be found",
"source": {
"pointer": "/data/type"
},
"sub_code": "none",
"title": "Not Found"
}
]
}
Delete CDR Export Task
DELETE /api/v1/cdr_export_tasks/{id} HTTP/1.1
Delete an CDR Export Task.
Path Parameters
| Name | Type | Description |
|---|---|---|
| id | String(format:ulid)! | CDR Export Task ID |
Request
DELETE /api/v1/cdr_export_tasks/{id} HTTP/1.1
Accept: application/json
Response 200
application/json
HTTP/1.1 200
Content-Type: application/json
Content-Length: 803
{
"data": {
"date": "string",
"error_code": "OK",
"format": "CSV",
"id": "01EH2Y28M6KXG14QMPM3HSP1Y0",
"inserted_at": "2021-08-13T04:08:44.762841Z",
"on_done_actions": [
{
"archive_format": "TAR_GZ",
"auth_identity": "upload-user",
"auth_method": "BASIC",
"auth_secret": "supersecretsauce",
"data": "sftp://example.com:22/sub/path/to/store/exported_file/in",
"error_code": "OK",
"filename": "string",
"protocol": "SFTP",
"reference_id": "SFTP-export-action",
"status": "NEW",
"type": "SEND"
}
],
"reference_id": "cdr-export-API-2022-03-14",
"status": "NEW",
"type": "API",
"updated_at": "2021-08-13T04:08:44.762841Z"
},
"type": "call_data_export_task"
}
Response 403
application/json
HTTP/1.1 403
Content-Type: application/json
Content-Length: 312
{
"errors": [
{
"code": "access_denied.no_scope",
"detail": "No scope available to user role",
"params": {
"action": "index",
"level": "guest",
"resource": "resource"
},
"sub_code": "none",
"title": "Access Denied, no scope available"
}
]
}
Response 404
application/json
HTTP/1.1 404
Content-Type: application/json
Content-Length: 314
{
"errors": [
{
"code": "not_found",
"detail": "The specified resource could not be found",
"params": {
"resource": {
"id": "3fbb573a-6049-44a0-a12c-d3a1ffae0b69",
"type": "user"
}
},
"sub_code": "none",
"title": "Not Found"
}
]
}
List CDR Export Tasks
GET /api/v1/cdr_export_tasks HTTP/1.1
Retrieve CDR export tasks
Query Parameters
| Name | Type | Description |
|---|---|---|
| first | Integer | Query Desc. first |
| last | Integer | Query Desc. last |
| after | String | Query Desc. after |
| before | String | Query Desc. before |
Query Desc. first
The number of items to return starting from the 'after' cursor
Query Desc. last
The number of items to return behind the 'before' cursor
Query Desc. after
The cursor representing the starting point of a 'first' based paging
Query Desc. before
The cursor representing the starting point of a 'last' based paging
Request
GET /api/v1/cdr_export_tasks HTTP/1.1
Accept: application/json
Response 200
application/json
HTTP/1.1 200
Content-Type: application/json
Content-Length: 1130
{
"count": 1,
"page_info": {
"end_cursor": "YXJyYXljb25uZWN0aW9uOjQ=",
"has_next_page": true,
"has_previous_page": false,
"start_cursor": "YXJyYXljb25uZWN0aW9uOjA="
},
"results": [
{
"data": {
"date": "string",
"error_code": "OK",
"format": "CSV",
"id": "01EH2Y28M6KXG14QMPM3HSP1Y0",
"inserted_at": "2021-08-13T04:08:44.762841Z",
"on_done_actions": [
{
"archive_format": "TAR_GZ",
"auth_identity": "upload-user",
"auth_method": "BASIC",
"auth_secret": "supersecretsauce",
"data": "sftp://example.com:22/sub/path/to/store/exported_file/in",
"error_code": "OK",
"filename": "string",
"protocol": "SFTP",
"reference_id": "SFTP-export-action",
"status": "NEW",
"type": "SEND"
}
],
"reference_id": "cdr-export-API-2022-03-14",
"status": "NEW",
"type": "API",
"updated_at": "2021-08-13T04:08:44.762841Z"
},
"type": "call_data_export_task"
}
]
}
Response 403
application/json
HTTP/1.1 403
Content-Type: application/json
Content-Length: 312
{
"errors": [
{
"code": "access_denied.no_scope",
"detail": "No scope available to user role",
"params": {
"action": "index",
"level": "guest",
"resource": "resource"
},
"sub_code": "none",
"title": "Access Denied, no scope available"
}
]
}
Retrieve CDR Export Task by ID
GET /api/v1/cdr_export_tasks/{id} HTTP/1.1
Retrieve a CDR Export Task by ID
Path Parameters
| Name | Type | Description |
|---|---|---|
| id | String(format:ulid)! | CDR Export Task ID |
Request
GET /api/v1/cdr_export_tasks/{id} HTTP/1.1
Accept: application/json
Response 200
application/json
HTTP/1.1 200
Content-Type: application/json
Content-Length: 803
{
"data": {
"date": "string",
"error_code": "OK",
"format": "CSV",
"id": "01EH2Y28M6KXG14QMPM3HSP1Y0",
"inserted_at": "2021-08-13T04:08:44.762841Z",
"on_done_actions": [
{
"archive_format": "TAR_GZ",
"auth_identity": "upload-user",
"auth_method": "BASIC",
"auth_secret": "supersecretsauce",
"data": "sftp://example.com:22/sub/path/to/store/exported_file/in",
"error_code": "OK",
"filename": "string",
"protocol": "SFTP",
"reference_id": "SFTP-export-action",
"status": "NEW",
"type": "SEND"
}
],
"reference_id": "cdr-export-API-2022-03-14",
"status": "NEW",
"type": "API",
"updated_at": "2021-08-13T04:08:44.762841Z"
},
"type": "call_data_export_task"
}
Response 403
application/json
HTTP/1.1 403
Content-Type: application/json
Content-Length: 312
{
"errors": [
{
"code": "access_denied.no_scope",
"detail": "No scope available to user role",
"params": {
"action": "index",
"level": "guest",
"resource": "resource"
},
"sub_code": "none",
"title": "Access Denied, no scope available"
}
]
}
Response 404
application/json
HTTP/1.1 404
Content-Type: application/json
Content-Length: 314
{
"errors": [
{
"code": "not_found",
"detail": "The specified resource could not be found",
"params": {
"resource": {
"id": "3fbb573a-6049-44a0-a12c-d3a1ffae0b69",
"type": "user"
}
},
"sub_code": "none",
"title": "Not Found"
}
]
}