[COMMAND]

Fetching a List of Phone Numbers

The provisioning_request_list command can be used to fetch a list of phone numbers, which may optionally be filtered and sorted by specific criteria. The data returned by this command is structured as a JSON array.

The table parameter can be used to request other types of data, either as well as or instead of phone numbers.

Parameters

table

required
string

To fetch only phone numbers, set this to "caco_numbers".

To fetch data from more than one table, set this to a comma-separated list containing the name of each table needed.

only_active

optional
Boolean

If set to 1 (True), only active phone numbers will be returned. This is the default value.

If set to 0 (False), all phone numbers will be returned, including retired ones.

order_by

optional
number

Determines how the list should be sorted. Can be one of the following:

  • 0 (default): Ascending alphanumeric order, followed by the sequence field, followed by the id field.

  • 1: The id field. This will normally – but not always – reflect when the phone numbers were created.

  • 2: The sequence field.

  • 3: The date of creation.

request_id

optional
string

If specified, this value will be returned as part of the response event. It can be used to help a calling application associate a request with its response.

external_id_type

optional
string

Each entry in the list may have been assigned an external_id, letting third parties identify it using their own methods. In this case, the entry will also have an external_id_type corresponding to that third party.

To view the external_id values in the list for a particular third party, specify their external_id_type here. Any phone numbers with no external_id for that third party will return an empty string for that value instead.

Example Request

Copy
{"command":{"command_type":"provisioning_request_list", "table":"caco_numbers", "order_by":2, "request_id":"aq_20", "external_id_type":"GeneriTec"}}

Responses

On Success:

A successful request will trigger a provisioning_list event, containing details of the request and an array of phone numbers matching the request.

On Failure:

A failed request will cause a provisioning_error event, containing an error code as well as a description of what went wrong.