Skip to main content
ContactNow: Using the numbers method API on Database.php endpoint to assign numbers to a queue as a DDI (DXI API customers only)
8x8 Support

ContactNow: Using the numbers method API on Database.php endpoint to assign numbers to a queue as a DDI (DXI API customers only)

Objective

API numbers method is used to read and update numbers and assign them to queues as DDI's, from outside the standard ContactNow agent or admin interface.  These are only available to DXI API Customers and will not work for ContactNow Customers.

To create access tokens for the ContactNow API, you will need to create a case with 8x8 Technical Support to obtain an API username and key. Once you have the username and key, you can use the instructions on the following link to create a token for using the API functionality.  ContactNow API Access.

Note: 8x8 does not provide programming support for the ContactNow API. However, further API reference material is linked in the Documentation section at the bottom of this article.

Applies To

DXI API, Number Queue Assignment 

Access the ContactNow API URL  

To access any ContactNow API interface, requests need to have an access token. The token will authorize requests for a particular account for a fixed period of time. By default, these requests are restricted to the internet address that requests the token.

The API url to manage agents is

https://api-103.dxi.eu/database.php?token=[Token]&method=numbers&action=[Action]&format=[Format]&raw=1

The Numbers API has a number of available functions. The request arguments should be passed as HTTP Post or Get variables. The payload / response from the API can be formatted in either json or xml format. The default is json but this can be modified by the format argument below:

  • Formatxml or json

The API will output a number of optional values depending on the request made.

  • Success: This shows whether the request succeeded. It will contain a true or false value for json or a 1 or 0  for xml.
  • Account ID: This shows the authenticated account that ran the API call.
  • Total: Number of records affected.
  • Bad: Number of records that failed.
  • Key: the unique ID that is returned when creating a new record.
  • Error: If the request failed, this field will contain a description of the fault.

Example of JSON Response:

{"success":true,"account_id":"10278","total":1,"bad":0,"key":0}

Example of XML Response:

<result>
    <success>1</success> 
    <account_id>1234</account_id> 
    <total>1</total>
    <bad>0</bad> 
    <key>0</key>
</result>

Reading Numbers using database.php endpoint  

Read the numbers of a re-seller.

  • HTTP Request: GET
  • Method: numbers
  • Action: read
  • Arguments: qid (optional - returns all numbers assigned to a single queue)

Example:

https://api-103.dxi.eu/database.php?token=[Token]&format=json&method=numbers&action=read&qid=12345

json Response:

{
  "success": true,
  "total": 4,
  "list": [
    {
      "ddi": "01010006923",
      "qid": "12345",
      "mode": "queue"
    },
    {
      "ddi": "01420253013",
      "qid": "12345",
      "mode": "queue"
    },
    {
      "ddi": "01753354203",
      "qid": "12345",
      "mode": "queue"
    },
    {
      "ddi": "03332120027",
      "qid": "12345",
      "mode": "queue"
    }
  ]
}

xml Response:

<?xml version="1.0" encoding="ISO-8859-1"?>
<result> 
    <success>1</success> 
    <total>4</total> 
    <list> 
        <number> 
            <ddi>01010006923</ddi> 
            <qid>12345</qid> 
            <mode>queue</mode> 
        </number> 
        <number> 
            <ddi>01420253013</ddi> 
            <qid>12345</qid> 
            <mode>queue</mode> 
        </number> 
        <number> 
            <ddi>01753354203</ddi> 
            <qid>12345</qid> 
            <mode>queue</mode> 
        </number> 
        <number> 
            <ddi>03332120027</ddi>
            <qid>12345</qid> 
            <mode>queue</mode> 
        </number> 
    </list> 
</result>

To update a number using database.php endpoint (Assigning DDI to queues)  

This will update an existing agent and return its success state or any errors in the request. 

  • HTTP Request: POST
  • Method: numbers
  • Action: update
  • Arguments: raw, format
  • Payload: ddi (Required), qid

POST API call with json: 

database.php?token=[Token]&format=json&method=numbers&action=update&raw=1

json Pay Load:

[{"ddi": "01234567891","qid": "12345"}]

The Response:

{"success":true,"account_id":"10278","total":1,"bad":0,"key":0}

xml Pay Load:

<?xml version='1.0' encoding='utf-8' ?>
<dxi>
    <ddi>01234567891</ddi>
    <qid>12345</qid>
</dxi>

The Response:

<result>
    <success>1</success>
    <account_id>10278</account_id>
    <total>1</total>
    <bad>0</bad>
    <key>0</key>

Documentation  

The following 8x8 ContactNow API reference material is available to the public. Each link will open a new browser tab:

How can we help you?

X