Alteryx Server Knowledge Base

Definitive answers from Server experts.

How To: Use Postman to interact with the Gallery API

SophiaF
Alteryx
Alteryx
Created

How-To

Use Postman to interact with the Gallery API. Postman is a useful tool for making and troubleshooting API requests. The following article walks you through how to set up and use Postman to access the various Gallery API endpoints.

Note: This article only applies to the Server Legacy OAuth 1.0 API, which is available up until Server 2021.4. To use Postman with the newer Server OAuth 2.0 API, see this Help page .


Environment


Attached is a Postman Collection, which is a group of API calls for all the Gallery endpoints. You will also install a Postman Environment. An environment is a set of key-value pairs. The key represents the name of the variable.

While working with APIs, you often need different setups for your local machine, the development server, or the production API. Postman let you customize requests using variables so you can easily switch between different setups without changing your requests.

 

Prerequisites

 

  • Alteryx Server
    • ​​​​​​​Up until Version 2021.4
  • Server Legacy OAuth 1.0 API
  • Postman

 

Procedure

 

Install the Postman Collection and Environment

 

1. Download the Postman_GalleryAPI.zip file or Postman_GalleryAPI_202X_X.zip attached and unzip.
2. Open Postman.
3. Go to File > Import and import both the Alteryx Gallery API.postman_collection.json and Alteryx Gallery API.postman_environment.json files (if you've previously imported this Environment file, you don't need to import again - you only need a new version if additional parameters are added).

SophiaF_0-1573732588828.png

 

In the Postman sidebar you should now see the following collection:

 

SophiaF_1-1573732660215.png

 

The Environment is now available in the top right:

 

SophiaF_2-1573732876638.png

 

 

Configure your Environment

 

You will need to update the Environment values with your credentials/values.

 

1. Click the cog icon next to the Environment drop-down in the top right:

 

postman_cog.png

 

2. Click on the name of the environment:

 

postman_environment.png

 

3. Edit the Current Values column with the information from your Gallery

 

VariableThis information can be found here
URLBase URL
TargetURL(Optional) - Base URL of the Gallery you are migrating workflows too (only for Migration endpoints)
User API KeyFrom Settings > Keys > Admin API > Key in Alteryx Gallery
User API SecretFrom Settings > Keys > Admin API > Secret in Alteryx Gallery
Subscription API KeyFrom Settings > Keys > Private Studio API > Key in Alteryx Gallery
Subscription API SecretFrom Settings > Keys > Private Studio API > Secret in Alteryx Gallery
appId

(Optional) - The ID of the app to execute. This is the string of characters starting with 5xx at the end of the URL for your app/workflow on the Gallery

http://localhost/gallery/#!app/Exchange-rates/5dcad435dd421443fcb98f4f
jobId(Optional) - This is retrieved using this endpoint from the Subscription API:
POST /v1/workflows/{appId}/jobs/
OutputId

(Optional) - This is retrieved using this endpoint from the Subscription API:

GET /v1/workflows/{appId}/jobs/

 

Moving forward, all these variables can be used when building any part of your Postman query. Variables show in orange:{{User API Key}}

 

postman_variable.png

 

Using Postman to call an endpoint

 

You should now be all set up to call any of the endpoints available in the Collection. To make a call:

 

1. In the sidebar, drop down into the Alteryx Gallery API collection and double-click one of the Requests. It will open in a new tab.

 

postman_request.png

 

2. Confirm that the Authorization sub-tab is set up correctly. Please see the "Edit the Authentication mechanism" section below for more details.

 

postman_auth_tab.png

 

3. Click the Send button to make your request. The response can be viewed at the bottom of the request tab:

 

postman_response.png

 

Edit the Authentication mechanism

 

By default, the Collection is already set up to authorize appropriately. However, if you make changes please reference this section. If you are creating a new request against the Gallery, in the Authorization tab on a Request you will need to set the Type to "OAuth 1.0" and then enter the appropriate Key and Secret for either the Admin or Subscription endpoints. See below for how to use the variables to do this, including a screenshot of the appropriate configuration.

 

 

Spoiler 
Correct Configuration:

postman_oauth.png

See it in action:
 

Alternatively, you can set the Authorization at the Folder level, and set the individual requests to the type 'Inherit auth from parent'. This is how the default setup is configured:

 

postman_folder.png

 

Common Issues

 

Spoiler 
I'm getting an error:
{     "data": null,     "exceptionName": "UnauthorizedException",     "innerExceptionMessage": "",     "message": "The provided signature(oauth_signature) is invalid." }

Confirm you have configured the Authorization tab correctly.


I'm getting an error:
{     "data": null,     "exceptionName": "BadRequestException",     "innerExceptionMessage": "",     "message": "Must specify subscription key (oauth_consumer_key parameter)." }

You are using the Admin Keys for a Subscription endpoint. Please use the Subscription keys.

I'm calling the Package endpoint to download a workflow, but it's returning just garbled text. How do I download the actual .yzxp?

On the top right side of the response, click Save Response > Save to a file

postman_package.png


Additional Resources

 
Attachments