Skip to main content
8x8 Support

ContactNow: Using Ajax.php API endpoint to return the state of all current outgoing calls

Objective

To use Ajex.php API Endpoint to read an Incoming call current Status on the dialer.

API Ajax Endpoint is used to read Incoming calls statuses from outside the standard ContactNow agent or admin interface.

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

Applies To

  • ContactNow
  • API
  • Ajax.php

Procedure

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 retrieve outgoing calls live status is:

https://api-106.dxi.eu/ajax.php?method=outgoing&token=[Token]&action=[Action]&qid=[queueid]&raw=1

The ajax 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}

Example of XML Response:

<?xml version="1.0" encoding="ISO-8859-1"?>
<result> 
    <success>1</success> 
</result>

Read an Outgoing Calls State Using the Ajax API Endpoint    

This will return all current live incoming calls in by queues and return its success state and/or errors any errors in the request. 

  • HTTP Request: POST/GET
  • Action: read
  • Arguments: qid(Optional, will be the queue ID, you can also provide a comma-separated list of all queues)

GET API call with json: 

ajax.php?token=[Token]&action=read&method=outgoing&format=[Format]&raw=1

The Json Response:

{success: true,
total: 1,
list: [{
        callid: "1226353",
        qid: "queue id",
        callerid: "callers CLI",
        agent: "name of the agent dealing with the call, unset if not answered",
        qtype: "the type of queue the call was received",
        dialed: "timestamp the call was dialed",
        answered: "timestamp the call was answered, 0 if not answered"
        }]
}

The XML Response:

<result>
    <success>1</success>
    <total>1</total>
    <list>
        <agent>
            <callid>1226353</callid>
            <qid>queueid</qid>
            <callerid>CLI</callerid>
            <agent>agentid</agent>
            <qtype>inbound</qtype>
            <dialed>1550245970</dialed>
            <answered>1550247699</answered>
            <call/>
        </agent>
   </list>
</result>

Additional Information

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.