You can test API methods on the interactive API browser page and without writing codeSome of the resources described on the page may not be available by default due to the type of application (see Creating and authorizing applications).
Example
In the internal number of the “fax" type, we will add the email addresses to which the fax messages received by this internal number will be sent:
…
…
…
System response:
{ "fax_mailto": "admin@host.com,user@host.com" }
Receiving fax messages
It is possible to receive and manage messages received by internal fax numbers.
Description of fields
Parameter | Type | Description |
---|---|---|
caller_id | string | The number of the sender of the message |
client_id | long | Client ID |
datetime | string | Date and time when the message was received |
destination | string | Number of the message recipient |
extension_group_id | long | ID of the internal numbers group. It can have the value 'null' if the internal number does not belong to any of the groups |
extension_id | long | Internal number ID |
file_size | long | Message file size |
uuid | string | Message ID |
Example
…
…
…
Sending fax messages
Content-Type when uploading files When uploading files via the POST method, set the Content-Type header to the multipart/form-data value with the boundary parameter, which contains a sequence of characters separating the parts of the request body. The parameters of the audio file and the file itself are passed as form fields. In all other methods, including updating information about the audio file, you should use the usual Content-Type: application/json and pass the information in JSON format. It is worth noting that in most cases, various libraries for working with web resources generate the request body and the Content-Type header with the boundary parameter automatically.
Description of the request fields
Parameter | Type | Mandatory | Default value | Description |
---|---|---|---|---|
dst_num | string | yes | The number to send the fax to | |
file | file | yes | A file in tiff or pdfformat . The maximum file size is 10 megabytes |
Example
Sending the faxtest.tif file to the number 1234567
…
…
…
System response:
{ datetime: "2016-04-07 20:08:54", dst_num: "1234567", id: 174, status: "ready_to_send" }
From the point of view of uploading files, sending a fax is the same as adding audio, so you can see examples of requests containing files on the "Audio Files" page.
Getting information about the sending status
To get information about the status of sending a fax message, you need to use the appropriate resource:
to get a list of all fax messages sent from an internal number: GET /extension/{extension_id}/fax/out/
to get information about a specific sent fax message: GET /extension/{extension_id}/fax/out/{message_id}
Example
Request information about a message with id 175 sent from an internal number with id 122:
…
…
…
System response:
{ "status": "sent", "dst_num": "1234567", "id": 175, "datetime": "2016-04-11 18:07:53" }
Description of fields
Parameter | Type | Description |
---|---|---|
datetime | string | Date and time when the fax message was sent |
dst_num | string | The number to which the fax message was sent |
id | long | Fax message ID |
status | string | The status of sending the fax message. See the description below |
Sending status
Status | Description |
---|---|
ready_to_send | The message is queued for sending. You can cancel sending a message with this status |
sending | Message in the process of sending |
failed | Failed to send the message. A message with this status can be sent again or canceled. |
canceled | Sending canceled |
error | A sending error occurred |
Repeat and cancel sending
A message that failed to be sent (the failed status) can be sent again or canceled. You can also cancel sending a message with the ready_to_send status.
To retry sending a message or cancel sending a message, you must make a PUT request to the resource /extension/{extension_id}/fax/out/{message_id}?action={action},where the URL parameter “action" can take the values retry and cancel to retry sending and cancel sending a message, respectively.
Example
We will repeat sending the message with id 175 from the internal number with id 122:
…
…
…
System response:
{ "status": "ready_to_send", "dst_num": "123", "id": 175, "datetime": "2016-04-11 18:07:53" }
Resources of the "Client" section