Page tree

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

This method allows uses to send faxes in particular contexts such as User, Organization or global.

Request/Response model

Overview

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:

Model
HTTP-Method       = "POST"

              URI-Fragment      = "/uapi/faxes/" User-Id "/" Extension-Number 

              Query-Parameters 
            = null
Request-Payload   = Fax

Return-Object     = Fax
Example
POST /uapi/faxes/@me/0003*210 HTTP/1.1
HOST uapi.voipnow.com
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  


Request

This section describes how to format the request to the service.

URI fragment

NameTypeRequiredDescription

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 YesNumber of the Extension sending the Fax.
Cannot be set to @self.

Response

Success

If successful, the request returns the Id of the newly created Fax resource and the following HTTP statuses:

HTTP CodeDescription
200The fax is sent.
204There are no faxes to be sent.

Failure

When it fails, the request returns the following error codes:

HTTP CodeCodeDescription
400fx_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.

400fx_file_invalidOne of the files that must be sent as fax are invalid. Allowed file types are: jpg, tif, pdf and txt.
400fx_max_files_reachedFailed to send the fax because the number of files that can be sent was exceeded.
400internal_server_errorFailed to send the fax due to an internal error.

Response body

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.

Example

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.

HTTP Request
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 Response
HTTP/1.1 200 OK
...
{
  "id":"1",
  "uid":"5d8e2193e92f2d5e31cff1017724cfe9"
}
#trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))
  • No labels

Except where otherwise noted, content in this space is licensed under a Creative Commons Attribution 4.0 International.