Data Studio v2.0 - Rest API - trigger workflows

Hi

For the script where is states:

>Powershell {path}\apertureExecuteWorkflowv2.ps1 -environment {environment} -phasesWorkflows @({workflows phase 1}), …, @({workflows phase n}) -token {API Token}

Should it be written like the following as an example:

Powershell C:\ApertureDataStudio\Data\apertureExecuteWorkflowv2.ps1 -environment default -phasesWorkflows @('wf1'), @('wf2'), @('wf3a','wf3b') -token {token}

So if you have wf1 then wf2 and then wf3a & wf3b - will this load wf1 and then wf2 or do these all run parallel?

Token - do l need to add the token number in {token}?

Also at beginning of the script it asks for usename and password - or are we passing this in the token?

I am assuming to that it executes the workflows under the same account that generated the token. Is this correct?

Could you please advise 

I'm struggling to get this working at moment, just want to make sure l have completed the script correctly. If possible could you send a script populated aand highlight what l need to update in the example script.

This would be a great starting point for me to work it out

thanks

Carolyn

Answers

  • Ivan NgIvan Ng Administrator

    Hi Carolyn,

    Apologies for the late reply. Please see my replies below.


    Do you mean that you want to replace the example in the script with Powershell C:\ApertureDataStudio\Data\apertureExecuteWorkflowv2.ps1 -environment default -phasesWorkflows @('wf1'), @('wf2'), @('wf3a','wf3b') -token {token} ? If yes, then you don't need to.

    There is actually no need to modify the content in the script. The example is the actual command to trigger the execution of the script with the parameters that you define. The parameters that you can define are as follows:

    -environment {environment}

    For the default environment, the external label is default (unless you've changed it). Hence you enter it as:

    -environment default

    -phasesWorkflows

    This is where you define the execution sequence of your workflows. The @ is the triggering point. So in the example:

    -phasesWorkflows @('wf1'), @('wf2'), @('wf3a','wf3b')

    in this configuration, wf1 will be executed first. wf2 will executed once wf1 has completed. Once wf2 is done, wf3a and wf3b will be executed simultaneously. So make the necessary changes here for the sequence of execution of your workflows.

    -token

    -This where you need to input your API key that was generated (note: its a really long one). So for example if your API Key is 1234567890asdfghjklzxcvbnmqwertyturie, then enter it as shown below:

    -token 1234567890asdfghjklzxcvbnmqwertyturie

    So a complete command would look something like this

    Powershell C:\ApertureDataStudio\Data\apertureExecuteWorkflowv2.ps1 -environment default -phasesWorkflows @('wf1'), @('wf2'), @('wf3a','wf3b') -token 1234567890asdfghjklzxcvbnmqwertyturie

    NOTE: again the token shown here is just an example, you will need to copy and paste your actual API key.

    Are you referring to the portion at the top of the script (highlighted in yellow below)?


    If so, you can ignore this. The top portion is actually comments. The sample script was modified from version 1 which uses username and password authentication.


    To execute the script with your input parameters you need do the following

    1) Ensure that the external labels have been entered for your workflows and environment.

    2) Unzip the file and copy the script to a folder.

    2) Open up the Command Prompt

    3) Change directory to the folder where the script is located.

    4) Enter the command to execute the script.


    I'm going to take you though an example. In my example below my script is located in C:\ExecuteWorkflows. The environment that I'm using is default. I've also created external labels of wf1, wf2 and wf3 for 3 workflows.

    Go to Command Prompt and change directory to the folder where your script located

    Then enter the command. In my example I'm executing wf1 first. Followed by wf2 once wf1 is done. Lastly wf3 will be triggered after wf2 has completed.

    So my command would be

    Powershell C:\ExecuteWorkflows\apertureExecuteWorkflowv2.ps1 -environment default -phasesWorkflows @('wf1'), @('wf2'), @('wf3') -token 1234567890asdfghjklzxcvbnmqwertyturie

    Again, the token shown here is only an example, please ensure that the actual API key is entered.

    Enter to execute the command. If you've done this correctly, you'll receive confirmation of your workflows being executed successfully.


    Do have a try. Let me know if you have further questions. Happy to assist. Thanks.


    Best Regards,

    Ivan Ng

  • Clinton JonesClinton Jones Experian Elite

    @Ivan Ng if I already have a schedule defined in Data Studio v2 is there a way to programatically execute that schedule like executing a workflow ?

Sign In or Register to comment.