Excerpt |
---|
This page describes the resources that UnifiedAPI uses and the way to manipulate them. |
Request structure
The UnifiedAPI web service works by sending HTTPS REST requests. All requests use the standard HTTP headers, status codes, and a common structure.
For example, to fetch the list of phone calls for an extension you must make the request as shown below:
Code Block |
---|
|
GET /uapi/phoneCalls/userId/extensionNumber/
HOST <hostname>
Content-Type: application/json
Content-Length: xxx |
Base URL
All REST requests made to the UnifiedAPI Service contain the Base URL, which is:
Code Block |
---|
https://<hostname>/uapi/ |
Note |
---|
|
For security reasons, UnifiedAPI uses TLS for all its services. |
Data representation
Resources are represented using JSON data format. For example, the PhoneCall resource looks like:
Code Block |
---|
{
"id":"b817d2618fe6f1804333",
"extension":"0003*210",
"ownerId":"3",
"ownerName":"Default Organization",
"answered":"2012-06-27T16:08:55+03:00",
"published":"2012-06-27T16:08:50+02:00",
"phoneCallView":[
{
"id":"01",
"extension":"0003*210",
"answered":"2012-06-27T16:08:55+03:00",
"status":"5",
"callerId":"John Doe <3334444>",
"source":["0003*024"],
"destination":["0003*210"]
}
]
} |
Some requests might return a large collection of resources, such as the list of phone calls. By default, the number of items returned from a collection is limited to 20 entries.
To make it easier to fetch the next or previous 20 items, UnifiedAPI returns the URIs that you can use.
Name | Type | Description |
---|
next | String | Use this link to fetch the next chunk of 20 items. |
prev | String | Use this link to fetch the previous chunk of 20 items. |
This is what a collection of phone calls looks like:
Code Block |
---|
HTTP/1.1 200 OK
...
{"entry":
[{"id":"b817d2618fe6f1804db1",
"extension":"210",
"ownerId":"3",
"ownerName":"Default Organization",
"answered":"2012-06-27T16:08:55+03:00",
"published":"2012-06-27T16:08:50+02:00",
"phoneCallView":[
{
"id":"00",
"extension":"210",
"answered":"2012-06-27T16:08:55+03:00",
"status":"5",
"callerId":"John Doe <3333>",
"source":["210"],
"destination":["3334444"]
}]
},
{"id":"b817d2618fe6f1804333",
"extension":"210",
"ownerId":"3",
"ownerName":"Default Organization",
"answered":"2012-06-27T16:08:55+03:00",
"published":"2012-06-27T16:08:50+02:00",
"phoneCallView":[
{
"id":"00",
"extension":"210",
"answered":"2012-06-27T16:08:55+03:00",
"status":"5",
"callerId":"John Doe <3333>",
"source":["7778888"],
"destination":["210"]
}]
}
],
"startIndex":0,
"totalResults":2,
"itemsPerPage":20,
"filtered":false,
"sorted":false,
"paging" {
"next":"https://<hostname>/uapi/phoneCalls/@me/@self/?startIndex=20",
"prev":"https://<hostname>/uapi/phoneCalls/@me/@self/?startIndex=0"
}
} |
Linking
When creating a new resource, the system might return in the response useful links that let you access the resource information:
Name | Type | Description |
---|
self | String | This link identifies the resource and you can use it to delete, list or update the resource. |
For example, a phone call might return the following response:
Code Block |
---|
HTTP/1.1 200 OK
...
{"entry":
[{"id":"b817d2618fe6f1804db1",
"extension":"210",
"ownerId":"3",
"ownerName":"Default Organization",
"answered":"2012-06-27T16:08:55+03:00",
"published":"2012-06-27T16:08:50+02:00",
"phoneCallView":[
{
"id":"00",
"extension":"210",
"answered":"2012-06-27T16:08:55+03:00",
"status":"5",
"callerId":"John Doe <3333>",
"source":["210"],
"destination":["3334444"]
},
"links":{
"self":"https://<hostname>/uapi/phoneCalls/@me/210/b817d2618fe6f1804db1"
}
]
|