Hi there, I am currently trying to get access to shotgrid via REST API on Google Apps Script.
I was able to get the access token with Password Credentials method. However, I wasn’t able to make requests with the access token on Google Apps Script. The thing is it worked on my local host Terminal.
The following is my request code on Google Apps Script.
var headers = {
‘method’:‘GET’,
‘Accept’:‘application/json’,
‘muteHttpExceptions’:true,
‘Authorization’:'Bearer ’ + access_token
};
var response = UrlFetchApp.fetch(URL + “https://my-site.shotgrid.com/api/v1/entity/tickets”, headers);
The response is 401, Unauthorized as details attached.
{“errors”:[{“id”:“0dd9194d18ffa1b110cb61b0f117f”,“status”:401,“code”:102,“title”:“Unauthorized”,“source”:null,“detail”:null,“meta”:null}]}
On my localhost Terminal it worked with this command.
curl -X GET https://my-site.shotgrid.com/api/v1/entity/tickets -H ‘Accept: application/json’ -H 'Authorization: Bearer [access_token]
Is there any reason for this authentication to fail on Google Apps Script? Or is there anything I missed in making the requests?
Thanks in advance.