I've been working on creating a script to extract specific information from an API response. Here's my current code:
var response = UrlFetchApp.fetch('https://[API_URL]', options);
Logger.log(response.getContentText());
var firstCall = response.getContentText();
var JsonObj = JSON.parse(firstCall);
Logger.log(firstCall['id']);
sheet.appendRow(['successfully connected to API.']);
sheet.appendRow([Logger.getLog()]);
Here is an example of the response I receive from the API:
[{"id":12345678901234567,"name":"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d1b4bcb0b8bd91b4bcb0b8bdffb2bebc">[email protected]</a> - someText"}]
After running the script, it logs the line mentioned above and 'undefined'. My objective is to extract only the ID from the string. Any assistance would be greatly appreciated. Thank you!