Each of these examples shows the HTTP request and the response from the Call Setup API in each of the scenarios.
Example 1: Successful Call Using Basic Parameters
To setup a call between the user reachable on 12026345789 and the endpoint identified by the call template with the ID of 367901, issue the following request:
HTTP Request | POST api.atgsvcs.com/call/2.0/367901/12026345789 |
---|---|
Request Body | Empty |
The response received should be:
Response Status | 200 OK |
---|---|
Response Content Type | application/json |
Response Body | { “sessionId”:”1TfU02Xfme2GMuzfUh0rkdgvz4” } |
Example 2: Invalid request path
A request to a version of the Call Setup API that does not exist would fail. For example:
HTTP Request | POST api.atgsvcs.com/call/2.0/367901/12026345789 |
---|---|
Request Body | Empty |
The response received should be:
Response Status | 404 Not Found |
Example 3: Use of a Method other than POST
If you use PUT on the standard interface to try and start a call, the request will fail. For example:
HTTP Request | PUT api.atgsvcs.com/call/2.0/367901/12026345789 |
---|---|
Request Body | Empty |
The response received should be:
Response Status | 405 Method Not Allowed |
Example 4: Invalid contact ID
If the request passes a contact ID value that is either invalid or for which a call template does not exist, the request will fail. For example, assuming there is no call template with an ID of ABC123:
HTTP Request | POST api.atgsvcs.com/call/2.0/ABC123/12026345789 |
---|---|
Request Body | Empty |
The response received should be:
Response Status | 404 Not Found |
Example 5: Invalid visitor telephone number
If an invalid phone number is passed, then the request will fail. For example:
HTTP Request | POST api.atgsvcs.com/call/2.0/367901/1202 |
---|---|
Request Body | Empty |
The response received should be:
Response Status | 404 Bad Request |
Example 6: Pre-call authorization checks failed
If the pre‐call authorization checks failed, for example because the visitor number was blacklisted, then the start call request will fail. For example, if number 12056545689 was blacklisted, then the following request:
HTTP Request | POST api.atgsvcs.com/call/2.0/367901/12056545689 |
---|---|
Request Body | Empty |
would return the following response:
Response Status | 403 Forbidden |
Example 7: Additional parameters
Consider a call with a number of additional parameters set, including two optional data fields with labels of CustRef and CartTotal. The Start Call request could look like this:
HTTP Request | POST api.atgsvcs.com/call/2.0/367901/12026345789 |
---|---|
Request Content Type | application/json |
Request Body | { “delay”:”60”, “userExtension”:”,123”, “visitorContext”: { “CustRef”:”ARC1235987”, “CartTotal”:”55.60” } } |
The response received should be:
Response Status | 200 OK |
---|---|
Response Content Type | application/json |
Response Body | { “sessionId”:”1TfU02Xfme2GMuzfUh0rkdgvz4” } |
Example 8: Scheduling a call for a later date
Consider a request to schedule a call to be started at a later date (e.g. 12.30pm Eastern Time on Monday 25th July 2016) where the agent leg is to be dialled first. The minimum information to be sent in the HTTP request to the API should be as follows:
HTTP Request | POST api.atgsvcs.com/call/2.0/367901/12026345789 |
---|---|
Request Content Type | application/json |
Request Body | { “callAgentFirst”:”true”, “when”:”Mon, 25 July 2016 12:30 -0400” } |
The response received should be:
Response Status | 200 OK |
---|---|
Response Content Type | application/json |
Response Body | { “sessionId”:”1TfU02Xfme2GMuzfUh0rkdgvz4” } |
If the date specified is in the past, the response received should be:
Response Status | 400 Bad Request |
---|---|
Response Content Type | text/plain |
Response Body | Start time is in the past: Mon, 27 July 2015 12:30 -0400 |