The POST v0/{accountKey}/calls/ endpoint allows you to request a call either on behalf of a specific agent or agent group. The endpoint supports a number of potential "from" and "to" selectors for future use.

Header parameters

This endpoint requires the following headers:

Authorization (required)

This header requires an OAuth bearer token. For information on the bearer token, see How to use your bearer access token.

Content-Type(required)

application/json Indicates that the media type sent by the client is JavaScript Object Notation (JSON).

Accept 

application/json;version=6 Indicates that the client will accept a JSON response and that version 6 of the API should be used.

Request examples

The following example provides all possible body parameters:

{
  "from": {
    "agentId": "5464",
    "groups": [
      "030"
    ],
    "presentedCLID": "01256636451"
  },
  "to": {
    "telephoneNumber": "07970303957",
    "agentId": "4567"
  },
  "regarding": {
    "reference": "http://Test.com"
  },
  "application": "TestApp"
}

where

Make call from agent 1234 to telephone number 02072068888

curl -X POST "https://***.newvoicemedia.com/v0/a1b2c3d4e5/calls/" 
-d '{ "from": { "agentId": "1234" }, "to": { "telephoneNumber": "02072068888" } }' 
-H "Authorization: Bearer <ACCESS_TOKEN>"-H "Content-Type: application/json; version=6"

Body

{
  "from": {
    "agentId": "1234"
  },
  "to": {
    "telephoneNumber": "02072068888"
  }
}

Make call from agent 1234 to agent 4567

curl -X POST "https://***.newvoicemedia.com/v0/a1b2c3d4e5/calls/" 
-d '{ "from": { "agentId": "1234" }, "to": { "agentId": "4567" } }' 
-H "Authorization: Bearer <ACCESS_TOKEN>" -H "Content-Type: application/json; version=6"

Body

{
  "from": {
    "agentId": "1234"
  },
  "to": {
    "agentId": "4567"
  }
}

Make call from an available agent within group 030 to telephone number 02072068888

curl -X POST "https://***.newvoicemedia.com/v0/a1b2c3d4e5/calls/" 
-d '{ "from": { "groups": ["030"] }, "to": { "telephoneNumber": "02072068888" } }' 
-H "Authorization: Bearer <ACCESS_TOKEN>"-H "Content-Type: application/json; version=6"

Body

{
  "from": {
    "groups": [
      "030"
    ]
  },
  "to": {
    "telephoneNumber": "02072068888"
  }
}

Make call from an available agent within group 030, 200 or 400 to telephone number 02072068888

curl -X POST "https://***.newvoicemedia.com/v0/a1b2c3d4e5/calls/" 
-d '{ "from": { "groups": ["030", "200", "400"] }, "to": { "telephoneNumber": "02072068888" } }' 
-H "Authorization: Bearer <ACCESS_TOKEN>" -H "Content-Type: application/json; version=6"

Body

{
  "from": {
    "groups": [
      "030",
      "200",
      "400"
    ]
  },
  "to": {
    "telephoneNumber": "02072068888"
  }
}

Make call from agent 1234 to telephone number 02072068888 with presented clid 08008888888

curl -X POST "https://***.newvoicemedia.com/v0/a1b2c3d4e5/calls/" 
-d '{ "from": { "agentId": "1234", "presentedCLID": "08008888888" }, "to": { "telephoneNumber": "02072068888" } }' 
-H "Authorization: Bearer <ACCESS_TOKEN>" 
-H "Content-Type: application/json; version=6"

Body

{
  "from": {
    "agentId": "1234",
    "presentedCLID": "08008888888"
  },
  "to": {
    "telephoneNumber": "02072068888"
  }
}

Specifying a call reference and application

curl -X POST "https://***.newvoicemedia.com/v0/a1b2c3d4e5/calls/" 
-d '{ "from": { "agentId": "1234", "presentedCLID": "08008888888" }, "to": { "telephoneNumber": "02072068888" }, "regarding": { "reference": "0012400000ATTUQ" }, "application": "appName" }' 
-H "Authorization: Bearer <ACCESS_TOKEN>" 
-H "Content-Type: application/json;version=6"

Body

{
  "from": {
    "agentId": "1234",
    "presentedCLID": "08008888888"
  },
  "to": {
    "telephoneNumber": "02072068888"
  },
  "regarding": {
    "reference": "0012400000ATTUQ"
  },
  "application": "appName"
}

Body

{
  "from": {
    "agentId": "1234"
  },
  "to": {
    "telephoneNumber": "02072068888"
  }
}

Response examples

Successful calls return HTTP status code of 201, containing the following message and headers.

Example: Successful response

Returns HTTP Status Code 201.

{
    "id": "017db4a2-44b5-672e-8b9f-1a805fed07ad",
    "links": [
        {
            "href": "https://emea.newvoicemedia.com/V0/lmccg0ujju4/Calls/017db4a2-44b5-672e-8b9f-1a805fed07ad",
            "rel": "_self"
        }
    ],
    "from": {
        "presentedClid": "123456789",
        "agentId": "1234"
    },
    "to": {
        "telephoneNumber": "02072068888"
    },
    "regarding": {
        "reference": "0012400000ATTUQ"
    },
    "status": "Active",
    "recordingStatus": "Stopped",
    "application": "ExampleAppName",
    "dispositionCode": null
}

Example: Invalid request, states and call exceptions

Returns HTTP Status Code 400.

{
 "message": "Ccxml must be enabled for this account"
}

Example: Invalid content types

Returns HTTP Status Code 415.

{
 "message": "The requested resource does not support content type 'multipart/form-data'."
}