unable to call rest call from jquery ajax

2 posts / 0 new
Last post
#1 Mon, 14 Dec 2015 22:57
Anonymous (not verified)

unable to call rest call from jquery ajax

Hi
I am trying to send a fax from jquer ajax using the rest API

this is my code: (the fax number in the code is not the correct one that I am using in my call)

var fxCall = $.ajax({
url: 'https://username:password@rest.interfax.net/outbound/faxes?faxNumber=14032223333',
method: 'POST',
data: 'this is a test',
dataType: 'text'
});

I am getting this error:

failed to load https://rest.interfax.net/outbound/faxes?faxNumber=14032223333

resource: the server responded with a status of 401 (unauthorized)

and another error

XMLHttpRequest cannot load https://rest.interfax.net/outbound/faxes?faxNumber=14032223333. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. The response had HTTP status code 401.

Thu, 17 Dec 2015 09:26
Eyal N

Hi,
When submitting a fax to InterFAX through the REST API, you need to provide the Authorization header in the request.
You can see examples of how this is done at https://www.interfax.net/en/dev/rest/reference/2918

Log in or register to post comments

Contact us today

Talk to a member of our team about the benefits InterFAX can bring to your organization's communications processes.

Contact us today