Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Azure DevOps API Calls - Handling Continuation Token

mtwilliamson
7 - Meteor

I'm using the Alteryx Download Tool to make API calls to Azure DevOps, but I'm not sure how to get the remaining records when I get a

x-ms-continuationtoken passed back in the DownloadHeaders field.  I've read up on using an Iterative Macro to put the

x-ms-continuationtoken value back into the URL and call Azure DevOps to retrieve the remain records.  This process would need to loop thru until it no longer finds a x-ms-continuationtoken in the DownloadHeaders field.

 

[Example URL]:

 

https://xxxx.xxx.azure.com/xxx/_apis/graph/users?&continuationToken={continuationToken}&api-version=...

 

[Logic]:

 

The logic is pretty straight forward:

 

1) After initial API call, check Download tool DownloadHeaders field for x-ms-continuationtoken

2) Loop process:

 

    If x-ms-continuationtoken found

       load x-ms-continuation value into url &continuationToken={continuationToken}&

       call api (using url with continuationToken)

       append returned results to previous records

    Else

       stop processing (no addition api call needed to retrieve additional records)

 

I've searched the forums and seen examples that might work but I don't have any experience using Iterative Macro.  Any help would be appreciated.  

 

Thank you.

1 REPLY 1
Luke_C
17 - Castor

I think you can achieve this by:

  • Pass the initial API call into the macro as an input
  • Retrieve the results
  • Have a filter tool to check for the continuation token (this stops the iterations if there is no token)
  • If true, then use one macro output to output those initial results
  • Then, use a formula to update the token in the API call and loop that back through as another macro output. A few notes here:
    • This output tool needs to be the exact same schema as the input 
    • In the 'interface designer' settings of the macro, define the iteration input (your API call) and the Iteration output (the updated API call to loop)
    • In the workflow configuration screen, you will need to define that it is an iterative macro

 

Labels