Introduction to Using Postman - Part 2

February 10, 2022

There are a variety of tools available which allow you to leverage APIs to manage the Workspace ONE stack. Postman is a popular choice due to its availability and ease of getting started. In a previous blog Introduction to using Postman - Part 1, we covered the fundamentals of how to set up your Postman environment for success, as well as review some basic Postman functionality. But what if you want to script API calls in a particular language? Or how about if you want to use Postman for more advanced integrations, such as working with automations in Workspace ONE Intelligence?

This blog has you covered. After reading this, you will be able to easily take API calls that you have generated in Postman and convert them into a programming language of your choice.

For those of you who want to be able to add additional actions into Workspace ONE Intelligence that can be used as part of a workflow, this guide will help get you up and running in no time while avoiding some common pitfalls for this popular integration.

Use cases - Create Code

Postman offers a robust set of features within its product. One option is the ability to share or export API codes you have created in a variety of programming languages.

Overview

The process for sharing or exporting API codes is straightforward.

  1. First, create the API call(s) that you want to export/share.
    Example: We will use a simple GET API call to return a set of users from a particular organization group in Workspace ONE UEM (Unified Endpoint Management).

A screenshot of a computer</p>
<p>Description automatically generated

We have successfully made the API call and it returns the requested information to the Body. Postman allows you to then take this API call and convert it into various programming languages which can be shared with others. This is useful if you are used to scripting in a particular language and you want to make API calls in a language that you are comfortable with.

  1. To select a programming language, select the </> icon highlighted in the screenshot above. You should see a drop-down menu of various programming languages.

A screenshot of a computer</p>
<p>Description automatically generated with medium confidence

There are a variety of languages to select. As an example, we will convert this GET request into PowerShell.

Text</p>
<p>Description automatically generated

You can select the above icon to copy the code snippet and then easily run the code. As you can see, the code runs successfully without any modification.

Text</p>
<p>Description automatically generated

Use cases – Workspace ONE Intelligence Custom Connector

Another use case that Postman supports is the ability to create and export collections which can be used to create custom connector(s) in Workspace ONE Intelligence.

Overview

We will walk through the steps on how to leverage Postman to create a custom connector, as well as why you may want to use a custom connector to make outbound API calls to a third-party system.

Workspace ONE Intelligence allows you to aggregate data from a variety of sources, which can be used to gain a better understanding of your environment. You can also create dashboards and reports, allowing real-time reporting on key performance indicators. For more information on Workspace ONE Intelligence, see the VMware Workspace ONE Intelligence Products guide, which provides a high-level overview of the product and its functionality.

Workspace ONE Intelligence supports the ability to create custom connectors which allow you to make outbound API calls to enterprise systems or third-party applications. Postman is used during this process; let’s walk through how to enable this workflow.

Prerequisites

  1. Create a collection in Postman.
  2. The service or third-party application that you want to make the outbound API call to must support REST APIs and Content-Type JSON.
  3. The Intelligence Service must be able to connect to the API endpoint that you are trying to reach.
  4. You must have authentication details for the service you are integrating with. The supported authentication methods will vary, depending on the service. Some examples are:
    1. Basic - username, password
    2. OAuth2 -  ClientID, ClientSecret, OAuth2 Token URL, Grant Type (client credentials or password)

Walkthrough

Here are the high-level steps required:

  1. Create a collection with the request(s) you want to enable as part of an automation, and export the collection:
    1. Make sure when you create the collection, you run the collection at least one time and save the response as an example. This is required for the collection to successfully upload into Workspace ONE Intelligence (Open API Protocol requires this step).
    2. A run-through can be found on Tech Zone: https://techzone.vmware.com/blog/using-custom-connectors-intelligence-automations.
    3. Documentation can be found here: https://docs.vmware.com/en/VMware-Workspace-ONE/services/intelligence-documentation/GUID-27_intel_custom_connectors.html.             

Example:

A screenshot of a computer</p>
<p>Description automatically generated with medium confidence

In the above example, we have created a collection which includes a single delete user API call for Workspace ONE UEM. You can create a collection with a single API call, or you can create multiple API calls which can be used as part of your collection.

  1. Make the API call and click Save.

Make sure you have filled in all the required components for the API call(s). You must have valid authorization and header values.

  1. Header Values - Content-Type, Accept, aw-tenant-code (if you are using basic authorization)

We also have :id as a path variable in this example. This allows you to use id as a variable when running a test after uploading the Postman Collection into Workspace ONE Intelligence.

Without this specified, id will not be available to use when testing the API call from the Intelligence console. Depending on what API call(s) you are making you may want to specify different path variables.

A screenshot of a computer</p>
<p>Description automatically generated with medium confidence

After getting all the required components, run the call and click the save button to save the API call as an example.

Warning: Make sure not to skip this step.

After you have saved the API call as an example, you will have something like the below screenshot:

A screenshot of a computer</p>
<p>Description automatically generated with medium confidence

DeleteTestUsers shows that we have saved the example successfully. Now you are ready to export the collection and upload it into Workspace ONE Intelligence.

A screenshot of a computer</p>
<p>Description automatically generated with medium confidence

Right-click the Collection > Export. This will export the collection in JSON format. Select the recommended v2.1 version and save the JSON file.

Graphical user interface, application, Teams</p>
<p>Description automatically generated

  1. Add the Custom Connector in Workspace ONE Intelligence and import the collection.

Now that we have our JSON file, we are ready to upload the file into Workspace ONE Intelligence. Log into Workspace ONE UEM at the top-level Organization Group in your environment, and select Workspace ONE Intelligence. Once completed, you will be authenticated into your Workspace ONE Intelligence environment.

Graphical user interface, application, Teams</p>
<p>Description automatically generated

Select the Integrations > Workflow Connectors > View > Add Custom Connector.

Graphical user interface, application</p>
<p>Description automatically generated

Graphical user interface, application</p>
<p>Description automatically generated

Graphical user interface, application</p>
<p>Description automatically generated

  • Fill in a name for the Custom Connector .
  • Add the base URL for the third-party system or application.
  • Select the Auth Type (Basic, OAuth2, No Authentication).
  • Add the username and password required to authenticate to the API endpoint if using basic authentication, or the appropriate OAuth2 details if using OAuth2 to authenticate.

Graphical user interface, application</p>
<p>Description automatically generated

Here is an example using OAuth2 to authenticate to Workspace ONE UEM.

Next, select the Import Actions button to import your exported JSON from Postman. This enables the action(s) you have configured via API.

If the JSON is imported successfully, you will see the imported action(s) available in the console. Next, perform a test to make sure that the API calls are working.

Graphical user interface, application</p>
<p>Description automatically generated

Graphical user interface, text, application, email</p>
<p>Description automatically generated

Select Test to run the API call. This is where the path variables specified in the API call come in handy. Enter the userID to test the Delete User API call.

Graphical user interface, application</p>
<p>Description automatically generated

Then select Test.

Graphical user interface, text, application</p>
<p>Description automatically generated

We can see the API call was successful. The last step is to create an automation(s) using this Custom Connector.

  1. Configure Automations workflow in Workspace ONE Intelligence and select the imported actions from the collection that you uploaded from Postman.

Graphical user interface, text, application, email</p>
<p>Description automatically generated

Select the Automations tab.

Note: In a production environment, you will not have the “trial” after the Automations tab if you have the required licensing for Workspace ONE Intelligence.

A picture containing graphical user interface</p>
<p>Description automatically generated

Select Add > Custom Workflow and select the Category for the Automation you would like to create, such as Workspace ONE UEM, and the appropriate sub-category for the automation. This will vary depending on the category selected.

Graphical user interface, text, application</p>
<p>Description automatically generated

Graphical user interface, table</p>
<p>Description automatically generated

Under the Actions section of the workflow, you should now see the Custom Connector that you just created.

Graphical user interface, text, application, email</p>
<p>Description automatically generated

Select the Custom Connector (in the example above, this is Ty Custom Connector) and you should see the action(s) that were imported from your collection created in Postman. These actions can now be used/triggered as part of a workflow.

And that’s it! You now should know how to quickly create REST API calls in Postman and convert those API calls into other scripting languages. We also worked through a common use case for Postman and Workspace ONE Intelligence which is creating a Custom Connector allowing you to make outbound API calls as part of a workflow to other third-party systems.

Resources

Interested in learning more? Check out these great resources!

Conclusion

If you found this resource useful, be sure to subscribe to the Digital Workspace Tech Zone Blog RSS and follow us on Twitter @EUCTechZone to stay updated on the latest EUC content! 

Agenda

Make sure to check out the other blog posts in our 28-day series:

 

Associated Content

From the action bar MORE button.

Filter Tags

Horizon Workspace ONE Horizon Workspace ONE Access Workspace ONE Intelligence Workspace ONE UEM Blog Technical Overview Intermediate Optimize