ContactNow: Using Priority API Database.php Endpoint for Agent Queue Assignment
Objective
To use the API priority method to create, read and update agent queue assignment, from outside the standard ContactNow agent or admin interface.
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
- Queue Assignment
Procedure(s)
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 these records is:
https://api-106.dxi.eu/database.php?token=[Token]&method=priority&action=[Action]&format=[Format]&raw=1
The priority 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:
- Format: xml 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>
Assigning an agent to a Queue Using database.php Endpoint
This will create a new entry in the database for the agent queue assignment and return its success state and a unique key or any errors in the request. If the record already exists it will NOT add a new record and will return success true/1 and total = 0 in the response.
- HTTP Request: POST
- Method: priority
- Action: create
- Arguments: raw, format
- Payload: agentid (Required), qid (Required), level (Required)
POST API call with json:
database.php?token=[Token]&format=[Format]&method=priority&action=create&raw=1
json Pay Load:
[{"agentid":"1234","qid":"1234","level":"100"}]
The Response:
{"success":true,"account_id":"10278","total":1,"bad":0,"key":550423}
xml Pay Load:
<?xml version="1.0" encoding="utf-8" ?> <dxi> <priority> <agentid>1234</agentid> <qid>1234</qid> <level>100</level> </priority> </dxi>
The Response:
<result> <success>1</success> <account_id>10278</account_id> <total>1</total> <bad>0</bad> <key>550423</key>
Listing Agent Queue Priorities Using database.php Endpoint
Read the data/records of a dataset.
- HTTP Request: GET
- Method: priority
- Action: read
- Arguments: agent (optional: agent_id), qid (optional)
Example:
https://api-106.dxi.eu/database.php?token=[Token]&format=[Format]&method=priority&action=read
json Response:
{"success":true, "total":1, "list":[ {"agentid":"1234", "qid":"1007", "level":"0"} ]}
xml Response:
<result> <success>1</success> <total>2</total> <list> <priority> <agentid>1234</agentid> <qid>1007</qid> <level>0</level> </priority> <priority> <agentid>1234</agentid> <qid>1234</qid> <level>100</level> </priority> </list> </result>
Update Agent Queue Assignment Using database.php Endpoint
This will update an existing agent queue assignment and return its success state or any errors in the request.
- HTTP Request: POST
- Method: priority
- Action: update
- Arguments: raw, format
- Payload: agentid (Required), qid (Required), level (Required)
POST API call with json:
database.php?token=[Token]&format=[Format]&method=priority&action=update&raw=1
json Pay Load:
[{"agentid":"1234","qid":"1007","level":"100"}]
The Response:
{"success":true,"account_id":"10278","total":1,"bad":0,"key":0}
xml Pay Load:
<?xml version='1.0' encoding='utf-8' ?> <dxi> <agentid>1234</agentid> <qid>1007</qid> <level>100</level> </dxi>
The Response:
<result> <success>1</success> <account_id>10278</account_id> <total>1</total> <bad>0</bad> <key>0</key>
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.
The following 8x8 ContactNow API reference material is available to the public. Each link will open a new browser tab: