Hi,
I basically call an external API which has oAuth authorization.
I first made a call for the token. Got the json response back on my game.
There I parsed the json and sent back the access token string by another API call to playfab.
Is there some way to parse json on the server cloudscript itself?
Now its this URL I need to call,
Its repeatedly giving me bad request in response.
What can be possible reason?
Do I need to provide the uri in some other way than directly in url?
Do I need to give base url seperately?
Code:
handlers.mycallApiMethod= function (args, context){ try{ var authorization= "Bearer " + args.accessToken; var headers = { "Authorization": authorization }; var body = "all good"; var url = "https://v2.api.xapo.com/accounts/xxxxxxxx/transactions?to=xxxxxxxxxxxxxxxxxxx&amount=2¤cy=SAT¬es=test&type=pay"; var content = body; var httpMethod = "post"; var contentType = "application/json"; var logRequestAndResponse = true; // The pre-defined http object makes synchronous HTTP requests var response = http.request(url, httpMethod, content, contentType,headers, logRequestAndResponse); return response ; } catch (ex) { log.info("had exception "+ ex); return ex; }