ActiveCampaign Forum

Alternative to XMLHttpRequest in Java Script Code Snippet


#1

We are attempting to build an API plugin from Google Data Studio to Active Campaign to create dynamic dashboards for our clients. Your Developer page provides some Code Snippets however I am having difficulties integrating these to the Google Script, as XMLHttpRequest is not supported over Google Scripts. Do you know of an alternative?

Also how can I integrate:
curl -H “Api-Token: YOUR_TOKEN” https://account.api-us1.com/api/3/

in Java Script.


#2

Thanks for reaching out. While we cannot assist with the actual coding of the connection here are a few things that should help.

One thing we see is that you are using an endpoint that should be the account URL: https://account.api-us1.com/api/3/. It should be able to be added here: http://screen.ac/6736e11f0ae5.

There are free resources out there that should help transform that to JS, such as: https://stackoverflow.com/questions/49117235/how-can-i-send-a-curl-request-from-javascript

Also this token is your KEY: http://screen.ac/2e2f7d273ba5

If you require further assistance you can work with our certified consultant who can be found here: https://www.activecampaign.com/consultants/