Beej
Posts: 0
Joined: Tue Jul 01, 2014 1:56 am

Server Code external API

Hello,

Have a server code script that's working great, but when I try to use it to access a 3rd party API, I get a "502 Bad Gateway" error.

Not sure who's end the error is on.

Is what I'm attempting even possible? If so, what might be causing it?

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Server Code external API

Bi Beej,

Please specify: do you can access your 3rd party api via other tools?(like postman https://chrome.google.com/webstore/de...)

In general it seems to be problem with your 3rd party api server.

Also see about 502 error here
http://www.checkupdown.com/status/E50...

Regards.

Beej
Posts: 0
Joined: Tue Jul 01, 2014 1:56 am

Server Code external API

It's likely an issue with the 3rd party library (Evernote SDK). It probably doesn't send the ajax request properly.

Speaking of which, I have another one right now. The only way it works in Postman is to send it in raw JSON format. Is there any way to get this to work in Server Code? Cannot get any version of "XHR.send" to work.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Server Code external API

Hi Beej,

Please provide us settings for Postman, which is you use for correct response(use text and screen shots).

We will take a look and will try to provide a solution for you.

Regards.

Beej
Posts: 0
Joined: Tue Jul 01, 2014 1:56 am

Server Code external API

This is the only thing I've gotten to work so far (in Postman).

Image

Beej
Posts: 0
Joined: Tue Jul 01, 2014 1:56 am

Server Code external API

Actually, just got it to work by putting the JSON object in the body (thanks!):

prevar url = 'https://mydomain.auth0.com/oauth/token';
var postData = {
"parameters": {},
"headers": {
"Content-Type": "application/json"
},
"body": {
"client_id": "GU...Pa",
"client_secret": "Wr...JM",
"grant_type": "client_credentials"
}
};
XHRResponse = XHR.send('POST', url, postData);
/pre

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Server Code external API

Hello Beej,

Thank you for the update, glad it works!

Return to “Issues”