3. Postman & RESTful API

Objective

Use Postman to do a simple task with the R81.20 Management API.

Instructions

Step

Instructions

1

On the Jump-Server , Open the Postman Portable Application (Look for the Orange RocketMan).

Note - When the application opens , Please click Dismiss in the update window:

2

Select the preconfigured API Lab - Mgmt environment to make API calls to the Management Server API :

3

Use the filter at the top of the Postman application and type login into the filter area of the Collection : Web API (version 1.9), ivory_main 22-11-2022, Alternately, open the first folder in the collection “01 Session Management”.

4

The selections should have changed to only items with login as part of their name.

5

Select login, a new tab is opened on the right for this function call. Click the Body

6

Change the credentials in the body to the following:

a. "user" : "api_user",

b. "password" : "vpn123",

c. "session-timeout" :3600

Make sure you keep the formatting JSON compliant.

7

Before we click Send,

review the {{server}} in the Post Path.

This matches our environment and is how Postman knows how to connect to the R81.10 management server at https://203.0.113.80/web_api

8

Now click the blue Send button.

9

At the bottom of the page, we have the results that were returned from the API server.

There are a number of items to look at:

  1. The session ID (sid)

  2. The status of the request (200)

10

Postman will automatically add the contents of the “sid” to the session environment variable we setup earlier.

Doing so allows us to run another command and reuse the same session.

11

Use the filter to find the add-host option in the Postman Collection (Web API (version 1.9), ivory_main 22-11-2022).

12

Review the body of the message that is in the collection.

Change the name and IP address to something different if you prefer :

13

Hit the blue Send button and review the status and output from the API server.

14

Use the filter to find the publish option and publish your changes:

15

Use the filter to find the logout function and logout your session.

16

Review the created host on SmartConsole :