To connect you will need to have a MailJet account and your own API/Secret keys. In this example we will connect with the 'Contact List' aspect of the API. We need to create an encoded string which contains our API keys:
var encoding = Utilities.base64Encode(apiKey + ":" + secretKey);From here we can set the HTTP headers authentication as part of the request, to authorise our account details:
var options = {Then we can continue with the usual route of using the 'UrlFetchApp' to make the request and return our data.
'headers': {"Authorization": "Basic " + encoding},
};
Connect to MailJet API with Google Apps Script.gs
Could I be so bold to ask, how would you save this data in a Google Sheet?
ReplyDeleteTHANK YOU!!!!
Hi
Deletethat was my end goal and unfortunately it was not possible (at least at the time). I was in touch with MailJet support to fix a number of problems with their API but ultimately Apps Script is not 'supported' and so I couldn't get it to work .... sorry.
Kind regards
Phil
Thank you!!!
Delete