API Resource: /queues

Want to get straight to work? Jump to available methods: POST /queues | GET /queues | DELETE /queues | GET /queues/UUID | PUT /queues/UUID | DELETE /queues/UUID


Queues allow you to route incoming calls to a defined group of phone numbers. When a queue is configured on your phone number, Phone.com will route incoming calls to members of the queue, in order, from the first to last member.

If a queue member is already on another call, our service rings the next phone number in the queue. While your callers are waiting to be connected, you can choose to play Hold Music.

Diagram showing how queues work

What Can I Do with Queues?

Queues are perfect for customer support and sales departments, help desks and reservation systems, and so much more. You can set up separate queues to handle calls for different phone numbers, departments and times of the day.

The ability to manage queues using the Phone.com API’s /queues service enables you to add new queues on the fly, add and remove queue members programmatically, and change your announcement and hold music as needed.

Imagine that your company has hired a new sales representative, and part of your orientation process includes adding the new employee’s information to your internal staff-management system. As soon as the new employee’s phone account is set up, your system could trigger an API request to add their phone number to the Sales Department queue.

Queues Settings in the Telephony Toolkit

In many cases, you can use the Queues settings in the Telephony Toolkit to configure the call queues you need. Simply log into your Phone.com API Developer account, and click Configure and Add a Queue.

Before setting up a queue, you will need to upload a pre-recorded greeting (click Configure and Add a Greeting). During setup, you will also select music to play while callers are on hold.

Important: You can also configure the maximum hold time for a queue, along with an action to take when the maximum hold time is exceeded. It is possible to direct the call to an application, but it is important to note that this will be an new instance of the call.

For more information, see About Menus, Queues and Routes and Using Telephony Toolkit Settings to Set Up Greetings, Menus, Routes and Queues.

Working with the /queues API Resource

In other cases, you may need to create queues more dynamically. Using the /queues API service, you can give your end users the ability to update their Phone.com queues on the fly. You can also allow them to add or delete queues as needed.

This topic outlines the methods available for /queues, and shows you how to build effective requests for this service. Your app can create a queue using a POST to /queues. After that, you can update, list or delete queues using the PUT, GET and DELETE methods respectively.

Note: The maximum size for media files or JSON objects included with a POST or PUT request to the Phone.com API is 20 MB.

POST /queues

Use POST to create a new queue.

Example

POST https://v1.api.phone.com/queues

Authentication

This method requires authentication.

Request Body Fields and Example

Field Type Values Description
name String Letters, numbers, spaces, dash, underscore. Up to 60 char. in length. Name for the queue. This is a friendly name that you can use to identify the queue.
announcement String UUID resource_id of a valid recording object. UUID must be a valid resource_id of an existing object.
hold_music String UUID resource_id of a valid recording object.
caller_id String calling_number, called_number Configures which number is displayed as the caller ID.
max_hold_time Integer 1, 2, 3, 4, 5, 10, 15, 20, 30, 45, 60 Configures the maximum time a call can be on hold.
maxhold_forward_selector String application, voicemail Configures the action taken when the max hold time is exceeded.
extension String UUID resource_id of a valid extension object. Dependent on voicemail value for maxhold_forward_selector.
application String UUID resource_id of a valid application object. Dependent on application value for maxhold_forward_selector
ring_time Integer 5, 10, 15, 20, 25, 30 Number of seconds that an extension in the queue will ring before the caller is transferred to the next queue member.
queue_member Array   An array of queue members
Visual spacer number Integer or E.164 format   Extension or phone number of a queue member
Visual spacer priority Integer   Order of priority for queue members
Visual spacer type String Either extension or phone_number Type of number

Request Body Format Example


 {
    "name": "queue1",
    "caller_id": "calling_number",
    "max_hold_time": 5,
    "maxhold_forward_selector": "voicemail",
    "extension": "e04c9e4a-762e-11e2-8054-aefb1020f2dc",
    "ring_time": "15",
    "queue_members": [
      {
         "number": "+15555551234",
         "priority": 1,
         "type": "phone_number"
      },
      {
         "number": "+15555552345",
         "priority": 2,
         "type": "phone_number"
      }
    ]
 }

 

Success Response

HTTP Code: 200 OK


{
    "response": {
        "data": {
            "resource_id": "06283513-14f5-11e3-a398-91e4dd3a21e9"
        }
    }
}

Error Response

  • HTTP Code: 404 Not Found (Dependent resource not found)
  • HTTP Code: 409 Conflict (Name in Use)
  • HTTP Code: 500 Internal Server Error

For HTTP Code 409

{
    "response": {
        "error": {
            "code": 30005,
            "detail": [
                "the name: test1, is in use in another queue."
            ],
            "info": "Invalid request. The resource is in use.",
            "url": "https://docs.phone.com/refguides/errorref/serviceerrors.html#error-code-30005"
        }
    }
}

Sample POST /queues Request (PHP)


 <?php
 $url = "https://v1.api.phone.com/queues";

 $post_body = <<<QUEUEDATA
 {
    "name": "test1",
    "caller_id": "calling_number",
    "max_hold_time": 5,
    "maxhold_forward_selector": "voicemail",
    "extension": "e04c9e4a-762e-11e2-8054-aefb1020f2dc",
    "ring_time": "15",
    "queue_members": [
      {
         "number": "+15555551234",
         "priority": 1,
         "type": "phone_number"
      },
      {
         "number": "501",
         "priority": 2,
         "type": "extension"
      }
    ]
 }
 QUEUEDATA;

 $ch = curl_init();
 curl_setopt($ch, CURLOPT_URL, $url);
 // authentication
 curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
 curl_setopt($ch, CURLOPT_USERPWD, "username:password");
 curl_setopt($ch, CURLOPT_POST, 1);
 curl_setopt($ch, CURLOPT_POSTFIELDS, $post_body);
 curl_setopt($ch, CURLOPT_HEADER, true);
 curl_setopt($ch, CURLOPT_HTTPHEADER,
       array('Content-Type:application/json',
              'Content-Length: ' . strlen($post_body))
       );
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

 $result = curl_exec($ch);

 $info = curl_getinfo($ch);
 curl_close($ch);

 if($info['http_code'] == 200) {
         echo $result;
 } else {
         $error = array('http_code' => $info['http_code'], 'response' => $result);
         echo json_encode($error);
 }
 ?>

 

Back to Methods Available for /queues.


GET /queues

Use GET /queues to retrieve a list of existing queues belonging to you. Note that, by default, you can retrieve a maximum of 20 queue objects per request. You can increase the number of returned objects to a maximum of up to 50 by setting the limit parameter, and you can set offset to page through all available objects.

Example

GET https://v1.api.phone.com/queues

Authentication

This method requires authentication.

Parameters

Success Response

HTTP Code: 200 OK

Response Body Fields and Example

Parameter Type Description
resource_id String Resource ID of the object
name String Name for the queue. This is a friendly name that you can use to identify the queue.
announcement String resource_id of a valid recording object
hold_music String resource_id of a valid recording object
caller_id String Sets which number is displayed as the caller id
max_hold_time Integer Sets the maximum time a call can be on hold
maxhold_forward_selector String Sets the action taken when the max hold time is exceeded
extension String resource_id of a valid extension object. Dependent on voicemail value for maxhold_forward_selector.
application String resource_id of a valid application object. Dependent on application value for maxhold_forward_selector.
ring_time Integer Number of seconds each queue member’s phone will ring before moving on to the next member
queue_member Array Array of queue members
Visual spacer number Integer or E.164 format Extension or phone number of a queue member
Visual spacer resource_id String Resource ID of the object
Visual spacer type String Type of number. Either extension or phone_number.

Response Body Format Example


{
    "response": {
        "data": [
            {
                "resource_id": "80417048-ac3b-11e2-8b76-eea2f9d0a5a3",
                "caller_id": "calling_number",
                "extension": {
                    "resource_id": "e04c999b-762e-11e2-8054-f253c53750bd",
                    "url": "https://v1.api/phone.com/extensions/e04c999b-762e-11e2-8054-f253c53750bd"
                },
                "hold_music": {
                    "resource_id": "5aa18a74-c3c8-11e2-8404-525400838e08",
                    "url": "https://v1.api/phone.com/media/5aa18a74-c3c8-11e2-8404-525400838e08"
                },
                "max_hold_time": "10",
                "maxhold_forward_selector": "voicemail",
                "name": "testname",
                "queue_members": [
                    {
                        "resource_id": "8042be75-ac3b-11e2-8b76-a08be8ae663f",
                        "number": "+15555551234",
                        "type": "phone_number"
                    },
                    {
                        "resource_id": "80450974-ac3b-11e2-8b76-fed4cb91ef07",
                        "number": "+15555552345",
                        "type": "phone_number"
                    }
                ],
                "ring_time": "30",
            },
            {
                "resource_id": "9dec433d-ad28-11e2-9230-a8600e644970",
                "caller_id": "calling_number",
                "extension": {
                    "resource_id": "e04c999b-762e-11e2-8054-f253c53750bd",
                    "url": "https://v1.api/phone.com/extensions/e04c999b-762e-11e2-8054-f253c53750bd"
                },
                "hold_music": {
                    "resource_id": "5aa18a74-c3c8-11e2-8404-525400838e08",
                    "url": "https://v1.api/phone.com/media/5aa18a74-c3c8-11e2-8404-525400838e08"
                },
                "max_hold_time": "5",
                "maxhold_forward_selector": "voicemail",
                "name": "testname",
                "queue_members": [
                    {
                        "resource_id": "1854fb01-ad29-11e2-8cbe-de2173a12e7b",
                        "number": "501",
                        "type": "extension"
                    },
                    {
                        "resource_id": "185799d4-ad29-11e2-8cbe-fb50a08a34f6",
                        "number": "502",
                        "type": "extension"
                    }
                ],
                "ring_time": "15",
            },
            {
                "resource_id": "8fa4e3f7-c49d-11e2-bf27-f569981dd476",
                "announcement": {
                    "resource_id": "794cf7d6-c495-11e2-8305-dbc57352a33a",
                    "url": "https://v1.api/phone.com/media/794cf7d6-c495-11e2-8305-dbc57352a33a"
                },
                "caller_id": "calling_number",
                "extension": {
                    "resource_id": "e04c999b-762e-11e2-8054-f253c53750bd",
                    "url": "https://v1.api/phone.com/extensions/e04c999b-762e-11e2-8054-f253c53750bd"
                },
                "hold_music": {
                    "resource_id": "5aa18a74-c3c8-11e2-8404-525400838e08",
                    "url": "https://v1.api/phone.com/media/5aa18a74-c3c8-11e2-8404-525400838e08"
                },
                "max_hold_time": "5",
                "maxhold_forward_selector": "voicemail",
                "name": "testname",
                "queue_members": [
                    {
                        "resource_id": "8fa771c1-c49d-11e2-bf27-b9600c0ec1ae",
                        "number": "+15555551234",
                        "type": "phone_number"
                    },
                    {
                        "resource_id": "8faec146-c49d-11e2-bf27-c2aea618d48f",
                        "number": "+15555552345",
                        "type": "phone_number"
                    }
                ],
                "ring_time": "15",
            },
            {
                "resource_id": "c35996e7-c49e-11e2-8501-b6386e8d4089",
                "announcement": {
                    "resource_id": "794cf7d6-c495-11e2-8305-dbc57352a33a",
                    "url": "https://v1.api/phone.com/media/794cf7d6-c495-11e2-8305-dbc57352a33a"
                },
                "caller_id": "calling_number",
                "extension": {
                    "resource_id": "e04c999b-762e-11e2-8054-f253c53750bd",
                    "url": "https://v1.api/phone.com/extensions/e04c999b-762e-11e2-8054-f253c53750bd"
                },
                "hold_music": {
                    "resource_id": "5aa18a74-c3c8-11e2-8404-525400838e08",
                    "url": "https://v1.api/phone.com/media/5aa18a74-c3c8-11e2-8404-525400838e08"
                },
                "max_hold_time": "5",
                "maxhold_forward_selector": "voicemail",
                "name": "testname",
                "queue_members": [
                    {
                        "resource_id": "c35ad8f9-c49e-11e2-8501-90a24d7cb068",
                        "number": "501",
                        "type": "extension"
                    },
                    {
                        "resource_id": "c35cd5ae-c49e-11e2-8501-a67ac8135269",
                        "number": "502",
                        "type": "extension"
                    }
                ],
                "ring_time": "15",
            },
            {
                "resource_id": "b9a7e4bf-ce37-11e2-940d-9c3cc88591eb",
                "caller_id": "calling_number",
                "extension": {
                    "resource_id": "e04c999b-762e-11e2-8054-f253c53750bd",
                    "url": "https://v1.api/phone.com/extensions/e04c999b-762e-11e2-8054-f253c53750bd"
                },
                "max_hold_time": "5",
                "maxhold_forward_selector": "voicemail",
                "name": "testname",
                "queue_members": [
                    {
                        "resource_id": "b9a92091-ce37-11e2-940d-f0c35ea7c65f",
                        "number": "+15555551234",
                        "type": "phone_number"
                    },
                    {
                        "resource_id": "b9ab33e6-ce37-11e2-940d-e743bbf9b2b3",
                        "number": "+15555552345",
                        "type": "phone_number"
                    }
                ],
                "ring_time": "15",
            }
        ],
        "links": [
            {
                "next": "https://v1.api/phone.com/queues?limit=5&offset=5&order_by=name&sort=desc"
            }
        ]
    }
}

Error Response

  • HTTP Code: 404 Not Found (Dependent resource not found)

Sample GET /queues Request (PHP)


<?php
$url = "https://v1.api.phone.com/queues/?limit=5&offset=0";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
// authentication
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "username:password");

curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$result = curl_exec($ch);

$info = curl_getinfo($ch);
curl_close($ch);

if($info['http_code'] == 200) {
  echo $result;
} else {
  $error = array('http_code' => $info['http_code'], 'response' => $result);
  echo json_encode($error);
}
?>

Back to Methods Available for /queues.


DELETE /queues

Use DELETE /queues to remove all queues that belong to you. Note, you are required to supply the delete_all argument to prevent you from deleting all of your queues by accident.

Example

DELETE https://v1.api.phone.com/queues?delete_all=1

Authentication

This method requires authentication.

Parameters

Parameter Type Values Description
delete_all Boolean 0, 1 Set to 1 to complete the operation

Success Response

HTTP Code: 200 OK


{
    "response": {
        "data": "1"
    }
}

Error Response

  • HTTP Code: 400 Invalid Request
  • HTTP Code: 404 Not Found (Dependent resource not found)
  • HTTP Code: 409 Conflict (Name in Use)

For HTTP Code 409

{
    "response": {
        "error": {
            "code": 30007,
            "info": "You cannot delete all without the delete_all argument.",
            "url": "https://docs.phone.com/refguides/errorref/serviceerrors.html#error-code-30007"
        }
    }
}

Sample DELETE /queues Request (PHP)


<?php
$url = "https://v1.api.phone.com/queues?delete_all=1";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
// authentication
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "username:password");

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$result = curl_exec($ch);

$info = curl_getinfo($ch);
curl_close($ch);

if($info['http_code'] == 200) {
        echo $result;
} else {
        $error = array('http_code' => $info['http_code'], 'response' => $result);
        echo json_encode($error);
}
?>

Back to Methods Available for /queues.


GET /queues/UUID

Use GET /queues/UUID to retrieve a single queue object.

Example

GET https://v1.api.phone.com/queues/UUID

Authentication

This method requires authentication.

Success Response

HTTP Code: 200 OK

Response Body Fields and Example

Parameter Type Description
resource_id String The resource id of the object.
name String Name for the queue. This is a friendly name that you can use to identify the queue.
announcement String resource_id of a valid recording object
hold_music String resource_id of a valid recording object
caller_id String Sets which number is displayed as the caller id
max_hold_time Integer Sets the maximum time a call can be on hold
maxhold_forward_selector String Sets the action taken when the max hold time is exceeded
extension String resource_id of a valid extension object. Dependent on voicemail value for maxhold_forward_selector.
application String resource_id of a valid application object. Dependent on application value for maxhold_forward_selector.
ring_time Integer Number of seconds each queue member’s phone will ring before moving on to the next member
queue_member Array Array of queue members
Visual spacer number Integer or E.164 format Extension or phone number of a queue member
Visual spacer resource_id String Resource ID of the object
Visual spacer type String Type of number. Either extension or phone_number.

Response Body Format Example


{
    "response": {
        "data": {
            "resource_id": "956c2e2b-fe18-11e2-aa7d-b174bae84aee",
            "announcement": {
                "resource_id": "a902b64b-f62d-11e2-9ea9-8b8fc793f30c",
                "url": "https://v1.api.phone.com/media/a902b64b-f62d-11e2-9ea9-8b8fc793f30c"
            },
            "caller_id": "calling_number",
            "hold_music": {
                "resource_id": "5aa18a74-c3c8-11e2-8404-525400838e08",
                "url": "https://v1.api.phone.com/media/5aa18a74-c3c8-11e2-8404-525400838e08"
            },
            "max_hold_time": "5",
            "maxhold_forward_selector": "voicemail",
            "name": "queue_52001d5d",
            "queue_members": [
                {
                    "resource_id": "81ea4f8e-0120-11e3-8af3-997008c02658",
                    "number": "+15555551234",
                    "type": "phone_number"
                },
                {
                    "resource_id": "81ebc238-0120-11e3-8af3-d0cfcb64b745",
                    "number": "+15555552345",
                    "type": "phone_number"
                }
            ],
            "ring_time": "15",
        }
    }
}

Error Response

  • HTTP Code: 404 Not Found (Dependent resource not found)

Sample GET /queues/UUID Request (PHP)


<?php
$url = "https://v1.api.phone.com/queues/e1186304-a5ec-11e2-8507-e90d08636c59";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
// authentication
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "username:password");

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$result = curl_exec($ch);

$info = curl_getinfo($ch);
curl_close($ch);

if($info['http_code'] == 200) {
   echo $result;
} else {
   $error = array('http_code' => $info['http_code'], 'response' => $result);
   echo json_encode($error);
}
?>

Back to Methods Available for /queues.


PUT /queues/UUID

Use PUT /queues/UUID to update a specific queue object with new data.

Note that a PUT is not a PATCH. You need to send the complete object in the HTTP request body in order to update it. Also, you can change the name of a queue using PUT to /queues, but you cannot change the name to a name used by another queue.

Example

PUT https://v1.api.phone.com/queues/UUID

Authentication

This method requires authentication.

Request Body Fields and Example

Field Type Values Description
name String Letters, numbers, spaces, dash, underscore. Up to 60 char. in length. Name for the queue. This is a friendly name that you can use to identify the queue.
announcement String UUID resource_id of a valid recording object. UUID must be a valid resource_id of an existing object.
hold_music String UUID resource_id of a valid recording object.
caller_id String calling_number, called_number Configures which number is displayed as the caller ID.
max_hold_time Integer 1, 2, 3, 4, 5, 10, 15, 20, 30, 45, 60 Configures the maximum time a call can be on hold.
maxhold_forward_selector String application, voicemail Configures the action taken when the max hold time is exceeded.
extension String UUID resource_id of a valid extension object. Dependent on voicemail value for maxhold_forward_selector.
application String UUID resource_id of a valid application object. Dependent on application value for maxhold_forward_selector
ring_time Integer 5, 10, 15, 20, 25, 30  
queue_member Array   An array of queue members
Visual spacer number Integer or E.164 format   Phone number or extension of a queue member
Visual spacer priority Integer   Order of priority for queue members.
Visual spacer type String Either extension or phone_number. Type of number.

Request Body Format Example


{
   "name": "test2",
   "announcement": "de816950-6105-11e2-bcfd-0800200c9a66",
   "hold_music": "de0ec353-7b92-11e2-b211-525400abd8d8",
   "caller_id": "calling_number",
   "max_hold_time": 5,
   "maxhold_forward_selector": "voicemail",
   "extension": "e04c9e4a-762e-11e2-8054-aefb1020f2dc",
   "ring_time": "15",
   "queue_members": [
      {
         "number": "+15555551234",
         "priority": 1,
         "type": "phone_number"
      },
      {
         "number": "+15555552345",
         "priority": 2,
         "type": "phone_number"
      }
  ]
}

Success Response

HTTP Code: 200 OK


{
    "response": {
        "data": {
            "resource_id": "956c2e2b-fe18-11e2-aa7d-b174bae84aee"
        }
    }
}

Error Response

  • HTTP Code: 404 Not Found (Dependent resource not found)
  • HTTP Code: 409 Conflict (Name in Use)
  • HTTP Code: 500 Internal Server Error

For HTTP Code 404

{
    "response": {
        "error": {
            "code": 30000,
            "info": "The system could not locate the resource you requested.",
            "url": "https://docs.phone.com/refguides/errorref/serviceerrors.html#error-code-30000"
        }
    }
}

Sample PUT /queues Request (PHP)


<?php
$url = "https://v1.api.phone.com/v2/queues/c21a7a5c-ac39-11e2-8b76-a02ad1a2253c";

$put_body = <<<QUEUEDATA
{
   "name": "test10",
   "announcement": "de816950-6105-11e2-bcfd-0800200c9a66",
   "hold_music": "de0ec353-7b92-11e2-b211-525400abd8d8",
   "caller_id": "calling_number",
   "max_hold_time": 10,
   "maxhold_forward_selector": "voicemail",
   "extension": "e04c9e4a-762e-11e2-8054-aefb1020f2dc",
   "ring_time": "30",
   "queue_members": [
      {
         "number": "+15555551234",
         "priority": 1,
         "type": "phone_number"
      },
      {
         "number": "501",
         "priority": 2,
         "type": "extension"
      }
   ]
}
QUEUEDATA;

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
// authentication
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "username:password");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, $put_body);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER,
       array('Content-Type:application/json',
           'Content-Length: ' . strlen($put_body))
       );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$result = curl_exec($ch);

$info = curl_getinfo($ch);
curl_close($ch);

if($info['http_code'] == 200 || $info['http_code'] == 201) {
        echo $result;
} else {
        $error = array('http_code' => $info['http_code'], 'response' => $result);
        echo json_encode($error);
}
?>

Back to Methods Available for /queues.


DELETE /queues/UUID

Use DELETE /queues/UUID to delete a specific queue object.

Example

DELETE https://v1.api.phone.com/queues/UUID

Authentication

This method requires authentication.

Success Response

HTTP Code: 200 OK


{
    "response": {
        "data": "1"
    }
}

Error Response

  • HTTP Code: 400 Invalid Request
  • HTTP Code: 404 Not Found (Dependent resource not found)
  • HTTP Code: 409 Conflict (Name in Use)

For HTTP Code 409

{
    "response": {
        "error": {
            "code": 30005,
            "detail": [
                "resource: c6779c2a-a6be-11e2-9080-faca55660bed, is in use and cannot be deleted."
            ],
            "info": "Invalid request. The resource is in use.",
            "url": "https://docs.phone.com/refguides/errorref/serviceerrors.html#error-code-30005"
        }
    }
}

Sample DELETE /queues/UUID Request (PHP)

Note that a queue currently in use in a call handling rule cannot be deleted until that reference is removed.


<?php
$url = "https://v1.api.phone.com/queues/80417048-ac3b-11e2-8b76-eea2f9d0a5a3";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
// authentication
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "username:password");

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$result = curl_exec($ch);

$info = curl_getinfo($ch);
curl_close($ch);

if($info['http_code'] == 200) {
   echo $result;
} else {
   $error = array('http_code' => $info['http_code'], 'response' => $result);
   echo json_encode($error);
}
?>

Back to Methods Available for /queues.


Learn More: