Using this request, an App can send a fax. If successful, the Service returns the Id of the newly created Fax resource.
The request is made by an App that is registered to a User account.
To send a fax in a desired context, issue a HTTP POST request:
HTTP-Method = "POST"
URI-Fragment
= "/uapi/faxes/" User-Id "/" Extension-Number Query-Parameters
= null Request-Payload = Fax
Return-Object = Fax
POST /uapi/faxes/@me/0003*210 HTTP/1.1
HOST voip.mcvip.co.il/uapi/ Authorization: token Content-Length:469 Content-Type: multipart/form-data; boundary=————325343636 ————325343636——– Content-Disposition:form-data; name="files"; filename="/path/to/file/fax.txt" Content-Type;application/octet-stream This is my fax ————325343636 Content-Disposition:form-data; name="request"; { "recipients":["7778888"] } ————325343636
This section describes how to format the request to the service.
userId | User-Id | Yes | Id of the User on behalf of whom the Fax is sent. It can take one of the following values: @me – refers to the authenticated User . @viewer – also refers to the authenticated User. @owner – refers to the User that owns the Extension used to make the phone call. User-Id – refers to the unique identifier of the User Default: @me |
extension | UAPI-Extension-Number | Yes | Number of the Extension sending the Fax. Cannot be set to @self. |
If successful, the request returns the Id of the newly created Fax resource and the following HTTP statuses:
200 | The fax is sent. |
204 | There are no faxes to be sent. |
When it fails, the request returns the following error codes:
400 | fx_recipients_invalid | Value supplied in the Recipients parameter is missing or invalid. Any phone number, including extension numbers can be a recipient. There can't be more recipients than the maximum number set up in the system. |
400 | fx_file_invalid | One of the files that must be sent as fax are invalid. Allowed file types are: jpg, tif, pdf and txt. |
400 | fx_max_files_reached | Failed to send the fax because the number of files that can be sent was exceeded. |
400 | internal_server_error | Failed to send the fax due to an internal error. |
If any 4xx or 5xx status codes is returned, the body contains the error response. When the request is successful and 200 OK is returned, the body contains a JSON representation.
Below you can find an example that will help you understand the request and the response.
This example sends a fax from Extension 0003*210 to 7778888. This fax does not need any other approval.
The request is transmitted as a multi-part message where the content of the fax is sent in the part names files. The part named request contains the resource properties and in this case identifies the recipients.
POST /uapi/faxes/ @me / 0003 * 210 HTTP/ 1.1 HOST uapi.voipnow.com Authorization: Bearer token Content-Length: 469 Content-Type: multipart/form-data; boundary=------------ 325343636 ------------ 325343636 -------- Content-Disposition:form-data; name= "files" ; filename= "/path/to/file/fax.txt" Content-Type;application/octet-stream This is my fax ------------ 325343636 Content-Disposition:form-data; name= "request" ; { "recipients" :[ "7778888" ] } ------------ 325343636 |
Assuming the request has been successful, the Service returns the following answer:
HTTP/ 1.1 200 OK ... { "id" : "1" , "uid" : "5d8e2193e92f2d5e31cff1017724cfe9" } |