Request/Response model
Overview
Use this request to add call events to an Extension.
If successful, the Service returns the Id of the newly created PhoneCallEvent, which is later used to query the status of the phone call event.
The request is made by an App that is registered to a User account.
To create a PhoneCallEvent, issue a HTTP POST request:
HTTP-Method = "POST" URI-Fragment = "/uapi/extensions/" User-Id "/" Extension-Number "/phoneCallEvents/" Query-Parameters = null Request-Payload = PhoneCallEvent Return-Object = PhoneCallEvent
POST /uapi/extensions/@me/0003*210/phoneCallEvents HTTP/1.1 HOST uapi.voipnow.com Content Type: application/json Authorization: Bearer token { "type": "0", "method": "0", "note": "My phone call event is awesome", "url": "http://myevent.com/SaveMyPhoneCallDetails", "status": "1" }
Request
This section describes how to format the request to the service.
URI fragment
The following parameters must be sent in the URI fragment.
Name | Type | Required | Description |
---|---|---|---|
userId | Yes | Id of the User which owns the Extension for which the event is added. | |
extension | UAPI-Extension-Number | Yes | The number of the Extension for which the event is added. Allowed Extension types: Phone Terminal , Queue , Conference , and IVR .Cannot be set to @self. |
Response
Success
If successful, the request returns the Id of the newly created PhoneCallEvent and the following HTTP statuses:
HTTP Code | Description |
---|---|
200 | The Id of the newly created PhoneCallEvent. |
204 | There is no Id to be returned. |
Failure
When it fails, the request returns the following error codes:
HTTP Code | Code | Description |
---|---|---|
400 | pcet_type_invalid | Value supplied in type parameter is missing or invalid. The parameter must be set to one of the following value: 0 for DialIn, 1 for DialOut and 2 for Hangup. |
400 | pce_method_invalid | Value supplied in method parameter is missing or invalid. The parameter must be set to one of the following value: 0 for GET or 1 for POST. |
400 | pce_note_invalid | Value supplied in note parameter is missing or invalid. It must be string and 1024 characters long. |
400 | pce_url_invalid | Value supplied in request URL parameter is missing or invalid. It must be a valid HTTP URL. |
400 | pce_status_invalid | Value supplied in status parameter is missing or invalid. The parameter must be set to one of the following value: 0 for enabled or 1 for disabled. |
400 | extension_invalid | Value supplied in the URI-Fragment as extension is invalid. The parameter must reference the number of an existing extension or cannot be set to @self. |
400 | pce_access_denied | You are not allowed to manage the phone call events. |
Examples
Below you can find an example that will help you understand the request and the response.
This example creates a phone call event for the Extension 0003*210. The event is executed when a call is received and it makes a HTTP request to the script
http://myevent.com/SaveMyPhoneCallDetails
using the POST method.
The request is made by an App on behalf of a User.
POST /uapi/extensions/@me/0003*210/phoneCallEvents HTTP/1.1 HOST uapi.voipnow.com Content Type: application/json Authorization: Bearer token { "type": "0", "method": "0", "note": "My phone call event is awesome", "url": "http://myevent.com/SaveMyPhoneCallDetails", "status": "1" }
Assuming that the request has been successful, the Service sends the following answer:
HTTP/1.1 201 Created ... { "type": "0", "id":"NqeyDRqo4FtabmFj8gNWq3hsiGNYyq", "method":"0", "note":"My phone call event is awesome", "url":"http://myevent.com/SaveMyPhoneCallDetails", "status":"1", "modified":"2012-07-10T18:16:12+03:00", "links": {"self":"https://x.x.x.x/uapi/extensions/@me/0003*210/phoneCallEvents/MyPhoneCallEvent"} }
Except where otherwise noted, content in this space is licensed under a Creative Commons Attribution 4.0 International.