Freshsales Logo freshsales

Can't make GET request

I'm trying to make a GET request to external API with Ajax, mentioned url in 'whitelisted-domains', but API is not getting data, i received Error 502 Bad Getaway, Error in establishing connection. It seems freshdesk environment blocks it somehow.

ADMIN

Hi Michael,


Can you share the code snippet we can suggest.


Thanks

Mahesh

Yea, of course


app.js app.js
1.49 KB
ADMIN

Hi Michael,


The URL is invalid, it throws 404 on my browser and using freshdesk proxy ($request.get) I get 502.  This is because we send 502 on error.


Check the URL u hit https://api.reps.ai/


image



Thanks

Mahesh

Hi Mahesh

thank you for your answer

As you can see in my code i am trying to access a different URL and not the one you mentioned.

The code is calling url: https://api.reps.ai/accounts/kasamba/tickets/analyze

You can validate this URL and it works just fine.

Can you help?


ADMIN

Hi Michael,


Internally the this.$request.get uses the node request, if u try doing a 'get' on the URL you get a error.



$ node

> let r = require('request');

undefined

> r.get('https://api.reps.ai/accounts/kasamba/tickets/analyze', function(err, resp, data){ console.log('error - ', err); console.log('resp - ', resp); console.log('data - ', data);})


> error - { Error: unable to verify the first certificate

    at Error (native)

    at TLSSocket.<anonymous> (_tls_wrap.js:1060:38)

    at emitNone (events.js:86:13)

    at TLSSocket.emit (events.js:185:7)

    at TLSSocket._finishInit (_tls_wrap.js:584:8)

    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:416:38) code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE' }

resp - undefined

data - undefined


Looks like there is some cert problem, Please check ur end.


Thanks

Mahesh



Login or Signup to post a comment