Skip to content

Import the Edge Builder REST API to Postman

This tutorial guides you through importing the Edge Builder REST API specification provided as swagger.yaml file into a Postman collection. This can then be used to easily interact with Edge Builder API.

Convert the Swagger YAML to a Postman Collection

In this section of the tutorial, you convert the Edge Builder swagger.yaml file to a Postman collection.
The swagger.yaml file can be found on SwaggerHub

Note

The screenshots used in this tutorial were made using Postman version 8.5.1.

To convert the Swagger YAML file to a Postman collection, complete the following steps:

  • Open Postman
  • Select the File menu
  • Select Import..
  • Select the File tab and click Upload Files, as illustrated below:

Postman1

  • Select the Import button, as illustrated below:

Postman2

  • This should result in an import complete window as shown below:

Postman3

  • Postman displays the collection as shown below:

Postman4

  • Individual API requests in the collection will show substituted data in the params, usually in the form of <string> or <integer>, or randomised values of the correct type (lorem ipsum for string, random values for integers). These will also be shown in the url of the request.

Postman5

Info

These values should either be unselected or replaced with actual values (i.e. the name of a node to search)

Set collection variables

In this section of the tutorial, you set the collection variables that will be used for the API requests

To set the collection variables, complete the following steps:

  • Select Collections from the left side panel, click Edge Builder Controller API and select the Variables tab
  • Set the CURRENT VALUE field of the baseUrl row and click Save as illustrated below:

Postman6

Note

  • iotechsys.domain should be replaced with your the IP address of the machine running the server components
  • It is important to use the Edge Builder server port 8085

Get Authentication Token

In this section of the tutorial, you get the authentication token that will be used for the API requests

To set the collection variables, complete the following steps:

  • Run the Authenticate a user POST request from the Postman collection using the correct username and password in the body of the request, as illustrated below:

Postman7

  • Copy the jwt token returned by the above API request
  • Select Collections from the left side panel, click Edge Builder Controller API and select the Authorization tab and paste the JWT token in the Value field for API Key, and press Save, as shown below.

Postman8

  • After this, all other requests can use this auth token automatically

Example API Request

In this section of the tutorial, you can see an example of using the Postman collection, after you have followed the previous parts of this tutorial.

You can do the following in Postman:

  • From Edge Builder Controller API collection, select nodes and then select List Nodes
  • Deselect all the parameters as shown below:

Postman9

  • Click Send, Postman handles the substitution of the URL and authentication token.
  • The GET request returns a status 200 OK message, with a JSON payload returned showing us that the count of results returned is 0. This is because we haven't added any nodes to EdgeBuilder.

Postman9