This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
The attached example shows how to use the Alteryx Private Gallery API Runner macro. If you have an alteryx private gallery setup, you can use your key and secret to hit the various api endpoints. See this post and this post which have details on how to obtain your key and secret as well as background on how the macro was built. After opening the yxzp in alteryx, to use the macro in your own workflows, you will need to either: 1) copy the macros (.yxmc) to your workflow directory, or 2) copy the macros (.yxmc) to your macro repository.
Key: Your private gallery alteryx API key obtained from your private gallery. There are separate user and admin keys if you have access to both.
Secret: Your private gallery alteryx API secret obtained from your private gallery. There are separate user and admin secrets if you have access to both.
URL: The complete API endpoint that you are sending data to. The example has a list of the various endpoints. You can also access the interactive demo from your keys page. Be sure to replace the various placeholders (Server.domain, Your_App_ID, Your_Job_ID, Your_Output_Id etc).
GETPOST: Toggle for type of request. Most of the endpoints are GET while there are a couple POST. As of 1/26/2023, PUT and DELETE were added as well.
Output String or Blob: You can determine the format that you want the response to be sent back in. String will normally work, but for the endpoints that download outputs or workflows, blob will allow you to then save the file. See the example 5.
Body checkbox (Optional): Allows you to send a body with your POST/PUT request, either from a field or just typing into a textbox. See example 3. Note that you will need to escape the \ and " character by using \\ and \" inside any strings. For example, to get the string like this through:
Additional Parameters checkbox (Optional): Allows you to send additional parameters with your request. They must be ordered alphabetically. The API macro already includes the various oauth parameters (when not using Oauth2). The format is ParameteName=ParameterValue. If you enter more than one, separate with an &. If the parameter name comes before oauth, use the Before box. includeMessages=FALSE is an example. If the parameter name comes after oauth, use the After box. search=Smart is an example. See example 1.
Authentication method: Before 21.4 and prior use Oauth1.0a. You have 4 options: R, Python, Alteryx and Alteryx Abacus. R requires the Alteryx Predictive Tools. Abacus requires Alteryx Abacus installation. 22.1+ must use Oauth2. Versions before 21.4 cannot use Oauth2. 21.4 can use either Oauth1.0a or Oauth2, you'll just need to ensure that the Authentication matches the URL you're using. Oauth2 gets the Authorization token and includes it with your call, so you don't have to hit the authorization token endpoint.
1 Get App Id - Hits the subscription endpoint which returns your workflows in your private gallery. It demonstrates the after optional parameter. This endpoint can be used to get the app id which will be used in later api endpoints.
2 Get App Questions - Hits the workflow endpoint with a GET request to return the list of interface tool names that you can then use in the Run Job example.
3 Run Job - Hits the workflow endpoint with a POST request to start a job. It returns the AppID which will be used in later examples. There are 2 examples that include a body, and 1 that does not include a body. The Body is optional, depending on whether your app has any interface tools. If you want to include a body, you can either specify which field contains the body, or you can type your body in manually.
4 Get Job status - Using the Job ID from Run Job example, you can check the status of your job as well as obtain the IDs for any outputs for a completed job. I've used the optional before parameter box to exclude messages from being returned.
5 Get Job output - Using the Job ID from the Run Job example and the Output ID from the Get Job Status example, you can retrieve the output file(s). Notice it's a 3 step process from beginning to end (1 Start job, 2 check status, 3 obtain file), where step 2 would have to be run over and over until the status is 'complete'. In this example the macro is configured to output as a blob, which is then saved to the workflow directory as a csv.
-False Errors about __URL___pctEnc were fixed.
-Body is now optional, and you can either feed in a field or type it in manually.
-Optional additional parameters are a new feature in this version of the macro.
-The ability to hash with python was added with this version. R requires the predictive tools, and appears to be more stable. Python may report false metadata issues.
-Fix 2 big issues with the Python hashing method. It's now just as stable as R.
-Added PUT and DELETE which are used for V3 endpoints.
-Added Authentication Options: Alteryx, Alteryx Abacus and Oauth2.0. See more info above. Abacus is lightning quick but requires separate installation. Oauth2.0 is needed for 22.1+ usage. Oauth2 gets the Authorization token and includes it with your call, so you don't have to hit the authorization token endpoint.