Hello. My name is Isaac and I’m having an issue with some of the “GET” Freshdesk APIs.
Until this morning, I was working fine with “GET” API requests (for fetching tickets lists, customers lists, agents lists, and specific ticket data mainly).
This morning and with no change in my code itself, I started getting “403 Forbidden” errors on all my requests made in Google Apps Script, but not in Postman (weird). I will share now a code example, but I still continue to highlight that until yesterday, this code has been working perfectly for several months.
The issue is not on my account or the API Key itself, because (1) my account has not changed and still keeps Administrator privileges in our Freshdesk, and (2) the request itself continues to work fine in another system (Postman).
Google Apps Script code snippet (no longer works since today / some hours ago):
let ticket = 47;
let url = 'https://mysupportplatform.freshdesk.com/api/v2/tickets/' + ticket;
let headers = {
"contentType": "application/json",
"Authorization": "Basic " + Utilities.base64Encode('MyAPIKey:X'),
muteHttpExceptions: true
};
let options = {
'method': 'GET',
'headers': headers,
muteHttpExceptions: true
};
response = UrlFetchApp.fetch(url,options);
Logger.log(response);
Postman code snippet (still works):
curl --location --request GET 'https://mysupportplatform.freshdesk.com/api/v2/tickets/47' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic MyEncodedAPIKey' \
--header 'Cookie: _x_w=39_1'
The GAS code gets me this answer now:
<html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
</body>
</html>
Here, of course, I would expect a Json object with the data requested.
I wonder whether a settings changed in some of the APIs? Is anyone else who uses GAS to fetch Freshdesk data via API having a similar issue?
The other possibility is that a change has occured in Google Apps Script settings - but my first thought was Freshdesk itself, hence the question. If anyone else uses GAS, your info would be very appreciated too!
Thanks in advance and Best Regards!
Isaac