Task Object
The Task Object represents a single batch operation request.
Each task defines what operation will be executed (POST, GET, PATCH, or DELETE), which objects are affected, and how they should be updated.
Task execution and results are tracked through the task status attribute and operation counters (processed, success, failure, and total).
When a task reaches the completed status, whether executed directly or after being reviewed and approved, CarrierX sends a callback identified as batch_task_completed. This callback is configured by the partner by setting the callbacks attribute on the Partner object.
Task Object Attributes
These fields and values make up the JSON object that gets returned with successful requests.
| Attribute | Data Type | Description |
|---|---|---|
| data | array of objects | The payload containing data for bulk creation or modification. Must be empty for |
| date_created read only | string | The date and time when the batch task was created. |
| date_modified read only | string | The date and time when the batch task was modified. |
| entries | array | List of existing record identifiers to be modified or deleted. This is based on |
| failure read only | integer | Number of failed operations within the batch. |
| field | string | The field used to locate the existing entries during |
| method | string | The HTTP method applied to the batch request: |
| partner_sid read only | string | The secure ID of the partner associated with the batch task. |
| processed read only | integer | Number of operations already processed in the batch task. |
| review | boolean | Indicates whether this task requires manual reviewing before execution. |
| results_email | string | The email address that gets a summary when the task completes. The summary contains the task type, method, the |
| results_url read only | string | The public link to the CSV file with the task results. CarrierX sets this link when the task completes. Refer to Results File for details. |
| status | string | Current execution status of the batch task. Refer to the table below for a comprehensive list of statuses. |
| success read only | integer | Number of successfully executed operations. |
| task_sid read only | string | The task secure ID. |
| total read only | integer | Total number of operations queued in the batch. |
| type | string | The type of task: |
status
| Value | Description |
|---|---|
| approved | The task has been approved and will execute. |
| cancelled | The task has been cancelled and will not execute. |
| completed | The task is completed. |
| created | The batch of objects has been created. |
| pending_review | The task is pending review and has not been executed. |
| queued | The task is in queue. |
| running | The task is currently running. |
Object Task Types
The phonenumber, prefix, lrn_prefix, and file task types create, update, or delete objects of the matching type. The data field contains the fields of this object.
| Task Type | Object | Methods | field Values |
|---|---|---|---|
phonenumber | DID | POST, GET, PATCH, DELETE | phonenumber, phonenumber_sid, filter |
prefix | Prefix | POST, PATCH, DELETE | prefix, prefix_sid, filter |
lrn_prefix | LRN Prefix | POST, PATCH, DELETE | prefix, lrn_prefix_sid, filter |
file | File | PATCH, DELETE | file_sid, filter |
For filter, each entry is a result filter expression.
GET tasks export the selected DIDs to a CSV file. Refer to Create Task for details.
DID Settings Task Types
The sms_enablement, line_information, and emergency task types apply the same settings to many DIDs in one task. Each item of the task works like a single request for one DID, so the same validation rules apply.
| Task Type | Methods | Single DID Request |
|---|---|---|
sms_enablement | PATCH | Enable or Disable SMS/MMS Messaging for DID |
line_information | PATCH, DELETE | Update DID Line Information, Delete DID Line Information |
emergency | PATCH, DELETE | Update DID Emergency, Delete DID Emergency |
For sms_enablement tasks, use the PATCH method. The single DID request uses POST, but a batch task with the POST method creates new objects.
To select the DIDs, set field to phonenumber, phonenumber_sid, or filter, and put the matching values in entries. For filter, each entry is a result filter expression, for example, did_group_sid eq d9b2e4a5-9d6c-4c1a-8e2f-3f7b6a5c4d21. The task applies the same data object to every selected DID. For DELETE tasks, data must be empty.
The data object accepts only the following fields:
| Task Type | Allowed data Fields |
|---|---|
sms_enablement | enabled (required), type, campaign_sid, campaign_sub_id, p2p_nnid |
line_information | caller_name, class_of_service, enabled, extended_business_name, extended_first_name, extended_last_name, privacy, screening |
emergency | caller_name, enabled, locations |
Refer to the DID Messaging Enablement, DID Line Information, and DID Emergency objects for the descriptions of these fields.
These task types work as follows:
sms_enablementtasks do not use theforcequery argument of the single DID request. It is alwaysfalse. If a DID already has messaging enabled with different settings, the item for this DID fails.- An
emergencytask with thePATCHmethod and{"enabled": false}indataremoves the emergency information of the DIDs, the same as aDELETEtask. - If a selected DID cannot get the settings, only the item for this DID fails, and the task continues. For example, the item fails if the DID is not assigned to the partner. Such errors appear in the task error details.
- If a DID is changed after the review and before the task runs, the item for this DID fails with a version mismatch error.
- In the review items, the old value of each field is always
null. Thelocationsfield ofemergencytasks shows an empty new value.
Results File
When a task completes, CarrierX creates a CSV file with the task results and sets its link in the results_url attribute. The link does not need authentication. The file is kept for 7 days and then deleted automatically. Deleting the task does not delete the file.
The content of the file depends on the method of the task:
- For
GETtasks, the file contains the exported objects, one row for each object. The columns are the object fields, in the same order as in the object. Useinclude_fieldsorexclude_fieldsindatato select the columns. Refer to Create Task for details. If aGETtask finds no objects, no file is created, andresults_urlstaysnull. - For
POST,PATCH, andDELETEtasks, the file contains one row for each item of the task, with the following columns:
| Column | Description |
|---|---|
| comments | The error details for a failed item. |
| entry | For PATCH and DELETE tasks, the secure ID of the object. For POST tasks, the submitted data row. |
| status | The processing status of the item, for example, complete. |
Sample Task object
{
"data": {
"trunk_group_sid": "b30a3dbb-3708-41f0-a9ca-5cf365dcc4d4"
},
"date_created": "2024-10-30T20:47:32.517Z",
"date_modified": "2024-10-30T20:47:32.517Z",
"entries": [
"18053355112",
"18053355280"
],
"error_details": [],
"failure": null,
"field": "phonenumber",
"method": "PATCH",
"partner_sid": "923840ce-0b63-44a9-b4ce-09dc4181fb9d",
"processed": null,
"results_email": null,
"results_url": null,
"review": true,
"status": "created",
"success": null,
"task_sid": "2d9e546e-634b-4f6b-97ca-c2158163540c",
"total": null,
"type": "phonenumber"
}