HTTP Request to access the Microtronics REST API

Hello community

I followed the Topic Accessing Microtronics REST API with curl . I used GIT Bash to send the request and it worked perfectly. Now I tried to access the Microtronics REST API without cURL but using only the protocol https with Javascript.

When I make a request I only get the json with err: “E_UNAUTHORIZED” back.

I am using the URL:

How do I have to include my username and password in the URL?


Hello community

For the problem I found by myself a solution.


Hello Jakob,

in order to provide the authentication information it is necessary to set the following http header:

“Authorization”: "Basic " + base64_encode(username:password)

For using jquery ajax this could be done like:

  beforeSend: function (xhr) {   // add authorization header before sending the request
    xhr.setRequestHeader ("Authorization", "Basic " + base64_encode(username + ":" + password));

Using axios (a widespread library to access REST API’s):

axios.get(url, {}, {
  headers: { "Authorization":  "Basic " + base64_encode(username:password)  }
}).then(function(response) {
}).catch(function(error) {
  console.log('Error on Authentication');

Greetings, Manuel