Use this article to learn how to use Postman to test the Workflow REST API using an OAuth token.
The screenshots and instructions for third-party software are accurate at the time of publication. Third-party vendors may have changed or updated aspects of their systems (such as user interfaces, functionality, and security). As a result, this content may be outdated.
K2 Cloud uses Open ID Connect (OIDC) to authenticate and authorize users. If you were using OAuth in K2 Cloud, or need to use OAuth in a new application that uses the K2 APIs, you’ll need to configure Postman and/or your code to use new client IDs and redirect URIs/Auth URLs. See the article
How to retrieve client IDs and Redirect URIs for use in OAuth against K2 APIs for more detail.
Step 1: Add the K2 API Delegated Permission to your Azure AAD App
Follow the steps in Configure AAD and K2 Services for Inbound OAuth to add the K2 API permission to your Azure AD App. This is necessary for K2 to authorize the OAuth request from your AAD identity.
Step 2: Enable the Workflow REST API and get the Swagger link
In this step, you enable the Workflow REST API and get the URL to the Swagger (OpenAPI) file for the service.
- Open K2 Management.
- Navigate to Integration > APIs > Workflow REST. Note that you can also call the SmartObject OData API with an inbound OAuth token.
- Enable the Workflow API and click the open link of the Swagger URL.

- When the new browser window opens, copy the link at the top of the window.

Step 3: Import Swagger into Postman
In this step, you import the Swagger file into Postman.
- Open Postman.
- Click Import in the upper left.
- On the Import dialog, click Import From Link and paste in the Swagger file link as shown here:

-
Click Import.
-
Navigate to Workflows > Get Workflows.

Parameters are automatically added to the request. Keep in mind that not all parameters are required. For more information see the Swagger definition. For this Get Workflows method, use the value Startable for the type.
Step 4: Acquire an OAuth Token and Test the API
In this step, you configure Postman to retrieve an OAuth token to access the K2 Workflow REST API.
- Click Authorization and then Get New Access Token.

- On the Get New Access Token dialog, fill in the values for your environment:
In the
Auth URL field, it is necessary to add
?resource=https://api.k2.com/ to the end of the string in order for Azure to send K2 the correct token values. This value does not have to be
https://api.k2.com but it must match the audience value of the Bearer Token OAuth resource. You can see this in
K2 Management >
Authentication >
OAuth >
OAuth Resources.
An easy way to find the auth URLs and Tenant ID of your Azure tenant is to use the following OpenID URL, replacing
[Azure Tenant] with your full tenant name such as k2example.onmicrosoft.com:
https://login.microsoftonline.com/[Azure Tenant]/.well-known/openid-configuration
- Click Request Token and log in using your AAD identity.
- Scroll down to the bottom of the Manage Access Tokens dialog and click Use Token.

To see encoded information about your access token, go to
jwt.ms, paste your token value, and decode it.
- Click Send and note the JSON payload in the Body of the response.

See Also
Use these links for learning more about OAuth in the K2 platform and code for calling K2 services.