API - Calls data records
The REST API enables Packnet customers to create custom interfaces for required operations.
The Calls endpoint of the API provides calls data record & call recording information.
API Base URL: https://api.mymetis.co.uk/v1/
Authentication Method: Bearer Token
To obtain a bearer token, please get in touch with the support team.
Call supported methods and endpoints
HTTP Method | Endpoint | Function |
GET | /calls | Output details of recent calls on the account. |
GET | /calls/{id} | Output details of a specific call on the account. |
POST | /calls/search | Search for calls with additional parameters |
Attributes
Name | Data Type | Description |
callref | integer | Unique call reference |
resellerref | integer | The unique reference number of the reseller this call is associated with |
channelref | integer | The unique reference number of the channel this call is associated with |
custref | integer | The unique reference number of the customer this call is associated with |
call_type | string | Type of the call, any of these: "inbound", "outbound", "on-net" |
call_from | string | The source number of the call |
call_to | string | The destination number of the call |
call_datetime | timestamp | The date and time of the call: "YYYY-MM-DD HH:MM:SS" |
duration | integer | The length of the call in seconds |
answered | string | Indicates if the call was answered or not: "y" = yes "n" = no |
context | string | Call context |
extension | string | The extension associated with the call |
answered_by | string | Where the call was answered. This can be a number or an extension. |
callrecord_id | integer | Unique id of the calls recording file. If NULL, the call has not been recorded. |
HTTP Method: GET
Endpoint: https://api.mymetis.co.uk/v1/calls
Request
All responses from the API will return data in JSON format.
Using the following cURL command, the API will return a list of calls associated with your account.
curl -H "Authorization: Bearer {token}" https://api.mymetis.co.uk/v1/calls
Example Response
[
{
"callref": 123456,
"resellerref": 111,
"channelref": 999,
"custref": 4321,
"call_type": "outbound",
"call_from": "02001003000",
"call_to": "44123456789",
"call_datetime": "2016-01-01 01:00:54",
"duration": 0,
"answered": "y",
"context": "CallRecord",
"extension": "Forwarded Call",
"answered_by": null,
"callrecord_id": null
},
{
"callref": 1234567,
"resellerref": 1,
"channelref": 2,
"custref": 3,
"call_type": "inbound",
"call_from": "08111111111",
"call_to": "44024681357",
"call_datetime": "2016-01-01 01:00:47",
"duration": 8,
"answered": "y",
"context": null,
"extension": null,
"answered_by": "07979797979(F)",
"callrecord_id": null
}
]
Pagination
One thousand results will be returned per page within each request by default. To navigate pages, append the ?page parameter to the URL. Omitting the page parameter will always return the first page of records only. The number of records returned can also be customised by appending the ?per-page parameter using values between zero and one thousand (0-1000). For example, this cURL command will return the second page of customer records and limit the number of records returned to 100.
https://api.mymetis.co.uk/v1/calls?page=2&per-page=100
HTTP Method: GET
Endpoint: https://api.mymetis.co.uk/v1/calls/{id}
Request
All responses from the API will return data in JSON format.
Using the following cURL command, the API will return a list of calls associated with your account.
curl -H "Authorization: Bearer {token}" https://api.mymetis.co.uk/v1/calls/{id}
The id parameter corresponds to the call reference value (callref).
Example Response
{
"callref": 1234567,
"resellerref": 1,
"channelref": 2,
"custref": 3,
"call_type": "inbound",
"call_from": "08111111111",
"call_to": "44024681357",
"call_datetime": "2016-01-01 01:00:47",
"duration": 8,
"answered": "y",
"context": null,
"extension": null,
"answered_by": "07979797979(F)",
"callrecord_id": null
}
HTTP Method: POST
Request
All responses from the API will return data in JSON format.
Search for calls by providing one or more parameters of the call object.
Search Parameters
call_type, call_from, call_to, call_datetime, custref, channelref, resellerref, call_id, callrecording, answered_by, answered.
Search by Call Type
curl -X POST -H "Authorization: Bearer {token}" -H "Content-Type: application/json" -d '{"call_type":"inbound"}' https://api.mymetis.co.uk/v1/calls/search
Search by time range
When a search is executed with the 'call_datetime' parameter, a 'start' and an 'end' date must be provided within the 'call_datetime' parameter as follows:
curl -X POST -H "Authorization: Bearer {token}" -H "Content-Type: application/json" -d '{"call_datetime":{"start":"2021-08-21","end":"2021-08-24"}}' https://api.mymetis.co.uk/v1/calls/search
*If no time is specified, the start and end date passed in the request will be processed as '2021-08-21 00:00:00' and '2021-08-24 00:00:00'.
Search by call recording
Search for all calls that have been recorded.
curl -X POST -H "Authorization: Bearer {token}" -H "Content-Type: application/json" -d '{"callrecording":1}' https://api.mymetis.co.uk/v1/calls/search
To find calls with a call recording, pass the parameter: callrecording with a value of 1
To find calls without a call recording, pass the parameter: callrecording with a value of 0
Search with multiple parameters
curl -X POST -H "Authorization: Bearer {token}" -H "Content-Type: application/json" -d '{"call_type":"outbound", "custref":1, "answered":"y"}' https://api.mymetis.co.uk/v1/calls/search
Example Response
{
"callref": 1234567,
"resellerref": 1,
"channelref": 2,
"custref": 3,
"call_type": "inbound",
"call_from": "08111111111",
"call_to": "44024681357",
"call_datetime": "2016-01-01 01:00:47",
"duration": 8,
"answered": "y",
"context": null,
"extension": null,
"answered_by": "07979797979(F)",
"callrecord_id": null
}