8

I tried doing the following:

request({
   url: 'https://vdms-dev.clientsolve.com/evoDMDev/api_event.php',
   headers: {
      'Authorization': 'Bearer 71D50F9987529'
   }
}, function(err, res) {
       console.log(res);
});

The log is showing undefined but when I try it on Postman it seems to be working fine.

Any help would be appreciated!

2

1 Answer 1

9

Since your are calling https host (https://evodms-dev.clientsolve.com/evoDMSDev/api/api_event_all.php), request client will throws an error while doing SSL handshake, thats why you got response as undefined. Inorder to check the exact error response log the error console.error("Error Response : ", err)

Checkout this working snippet with error handling.err

Note: Now you will get Invalid Bearer Token error, Enter valid Bearer token

const request = require('request');

request({
  url: 'https://evodms-dev.clientsolve.com/evoDMSDev/api/api_event_all.php',
  headers: {
     'Authorization': 'Bearer 71D50F9987529'
  },
  rejectUnauthorized: false
}, function(err, res) {
      if(err) {
        console.error(err);
      } else {
        console.log(res.body);
      }

});
Sign up to request clarification or add additional context in comments.

2 Comments

that only seems to get the request from the https url, How to get it to work on localhost:3000?
Use localhost:3000, In case of any issues kindly detail your issues.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.