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 clickUpload Files
, as illustrated below:
- Select the Import button, as illustrated below:
- This should result in an import complete window as shown below:
- Postman displays the collection as shown below:
- 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.
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, clickEdge Builder Controller API
and select theVariables
tab - Set the
CURRENT VALUE
field of thebaseUrl
row and clickSave
as illustrated below:
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:
- Copy the jwt token returned by the above API request
- Select
Collections
from the left side panel, clickEdge Builder Controller API
and select theAuthorization
tab and paste the JWT token in theValue
field for API Key, and pressSave
, as shown below.
- 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, selectnodes
and then selectList Nodes
- Deselect all the parameters as shown below:
- 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.