Last active
December 3, 2020 05:09
-
-
Save MamaiRachid/849935c6cec50d6a9aa9578404ecfa23 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script runat="server"> | |
| Platform.Load("Core","1.1.1"); | |
| /* The number of autoamtions we want to pull */ | |
| var automationsCount = 25; | |
| url = tenantURL + ".rest.marketingcloudapis.com/legacy/v1/beta/automations/automation/definition/?$top="+ automationsCount +"&$skip=0&$sort=lastRunTime%20desc"; | |
| var headerNames = ["Authorization"]; | |
| var headerValues = ["Bearer " + accessToken]; | |
| var automations, automationContent, automationDescription; | |
| try { | |
| automations = HTTP.Get(url, headerNames, headerValues); | |
| automationContent = Platform.Function.ParseJSON(Platform.Function.ParseJSON(Stringify(automations)).Content); | |
| // loop through all results | |
| if(automationContent.entry.length >= 1) { | |
| for (i = 0; i < automationContent.entry.length; i++) { | |
| automationDescription = automationContent.entry[i].description; | |
| Write(automationDescription + "</br>"); | |
| /* Do other stuff */ | |
| } | |
| } | |
| } catch (e) { | |
| e = Stringify(e).replace(/[\n\r]/g, '') | |
| Write(e); | |
| } | |
| </script> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment