Customize the apis.yaml for PostMan
This document (000020929) is provided subject to the disclaimer at the end of this document.
Resolution
1. Download the apis.zip from our documentation and unzip it.
2. Open it into an editor and make the following updates.
- add default variable {{TOKEN}} to the X-Auth-Token header
Add a default value to X-Auth-Token header by inserting "default: "{{TOKEN}}" underneath all occurrences of:
name: X-Auth-Token
required: true
type: string
Updated occurrences should look like below.
name: X-Auth-Token
required: true
type: string
default: "{{TOKEN}}"
4. Click on the eye (Environment quick look) and create a new Environment and select the Environment to use it
- Add a new baseUrl environment variable and set it to the URL for REST API
5. Update the auth /v1/auth call with the appropriate NeuVector user credentials
6. Add a test code into the /v1/auth call to extract the authentication token and save it into the TOKEN variable
var jsonData = JSON.parse(responseBody); postman.setEnvironmentVariable("TOKEN", jsonData.token.token);
7. NeuVector by default uses self-signed certificates. You need to disable certificate verification under settings > SSL certificate verification = OFF
8. Test it
Ensure the Environment is selected. Now you should be able to click the "Send" button on the /v1/auth call. The response should be 200, and the TOKEN variable should be populated so the subsequent call will automatically use it.
You can verify by clicking on the eye next to the selected environment or make a GET request to the /v1/controller endpoint and should receive a 200 response with the controller details. If the /v1/auth was unsuccessful, you would receive error code 3 saying Authentication failed. Recheck the /v1/auth test to ensure the token is captured and stored as an environment variable.
Disclaimer
This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.
- Document ID:000020929
- Creation Date: 06-Jun-2023
- Modified Date:06-Jun-2023
-
- SUSE NeuVector
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com