While searching for how to get started with Postman I found a lot of articles but nothing simple and strict to the point. As such here goes my attempt, with screenshots, at showing how a simple test looks. I will show case two simple operations:

  • getting a Keystone Token from Openstack via V3 API
  • using that Token and making a request to Contrail Controller to list the configured Virtual Networks

What can Postman be used for

Well, API testing to put it plainly. Making GET/POST requests over a REST API and seeing the results. One can also chain multiple such calls inside a Collection and then click on a button to run all “tasks” that comprise it. As well variables can be defined. These can get store values from a request:

  • from the Response Body
  • from the Response Header

Example Usage

Create Collection

As previously said this is a list of “tasks” to be done (GET, POST requests for example)

Create an Environment

We will use this Environment with our Collection and inside of it we will define variables (in this case one variable where we will store the Auth Token return by the Openstack V3 API Call for “token issue”)

Create API Request for getting an Openstack Token

To give your own name to the “Request” you need to click on “Save”. By default it is “Unnamed”.

Request to OSP URL:

Header has to be:

Content-Type aplication/json

Body has to be:

{ “auth”: { “identity”: { “methods”: [“password”], “password”: { “user”: { “name”: “admin”, “domain”: { “id”: “default” }, “password”: “fVpuDrAGMpNyb98T8szJxu4B4” } } }, “scope”: { “project”: { “name”: “admin”, “domain”: { “id”: “default” } } } } }

Tests (this is where we allocate a value to the Environment variable previously defined).

This env var will get populated with the value returned by Openstack in the Header of the Reply.

In case we needed to get the value from the Body (as in the case with V2 Openstack API //var jsonData = JSON.parse(responseBody); //postman.setEnvironmentVariable(“token”, jsonData.token.project.id);

var tokenul = postman.getResponseHeader(“x-subject-token”) postman.setEnvironmentVariable(“tokenhdr”, tokenul);

Define Request to Contrail for listing Virtual Networks.

This request will include the X-Auth-Token header which we populate with the content of the variable “tokenhdr”. This variable was assigned a value by the previous request to Openstack V3 for issueing a token. That request got a reply from Openstack and the reply contained a Header with the Token value if auth was successful.

Extra: Finding out the Contrail API URL

On the Openstack Controller, look in the /etc/haproxy/haproxy.cfg file and search for these lines for:

  • Contrail Config
listen contrail_config
  bind transparent
  • Contrail Analytics
listen contrail_analytics_rest
  bind transparent