Fax
Fax API
Authorization
Use a fax token to authenticate with the fax API. See Authentication for more details.
Send a fax
You can send a PDF document (8x11 inches).
URL
https://internal.callerip.ca:8000/api/fax/send
Method
POST
Parameters
- token
- number (10 digits)
- file
- sendCover (choose 'N')
Result
The result is a JSON data structure with the fax uuid and the initial status:
{
uuid: '4f11W59b-bb64-40c7-b9c8-Xe2f948efR9b',
status: 'Loading'
}
Example
const axios = require('axios');
const fs = require('fs');
const FormData = require('form-data');
const form = new FormData();
form.append('token', '[INSERT YOUR FAX TOKEN HERE');
form.append('number', '6474959659');
form.append('file', fs.createReadStream('testfax.pdf'));
form.append('sendCover', 'N');
form.append('coverFrom', '');
form.append('coverTo', '');
form.append('coverSubject', '');
form.append('coverMessage', '');
axios.post(`https://internal.callerip.ca:8000/api/fax/send`,
form,
{ headers: form.getHeaders() },
)
.then((res) => {
console.log(res.data);
let uuid = res.data.uuid;
let status = res.data.status;
})
.catch((error) => {
console.error('error');
console.log(error);
})
Status of a fax
Get the status of a fax sent. A fax will progress through the following status changes:
Status | Description |
---|---|
Loading | Initial loading stage |
Converting | The server is turning the PDF into a sendable format. |
Pending | The document is ready to send, waiting on the server to send. |
Sending | The server is attempting to send the document. |
Success | The document was successfully sent. |
Failed | The document was failed to send. |
URL
https://internal.callerip.ca:8000/api/fax/status
Method
GET
Parameters
- token
- uuid
Result
The result is a JSON data structure with the fax uuid and the initial status:
{
status: 'Loading'
}
Example
const axios = require('axios');
const fs = require('fs');
axios.get(`https://internal.callerip.ca:8000/api/fax/status`, {
params: {
uuid: uuid,
}
})
.then((res) => {
console.log(res.data);
let status = data.status;
})
.catch((error) => {
console.error('error');
console.log(error);
})