Install and Configure the Postman App
Table of Contents
Scope
Intended Audience: Channel Partners or higher
This article outlines how to install and configure the Postman App with the PBX API.
Requirements
- OAuth Client ID and Client Secret (If you don't have this, create a support case)
- Channel Partner Access to Manager Portal or higher
- Existing Postman Account
Install Postman
Postman has a web version as well as a desktop app. This article outlines how to install Postman using the desktop app, but you may also skip this section and follow along using the web app.
- Navigate to the Postman home page
- To download the desktop app, click the icon for your matching operating system
- Click Download the App
NOTE: You may need to select additional options for your particular operating system
- Download and run the installation file to finish installing
- Sign in to the app using your Postman credentials
Import the NS API Collection
- Open the Postman App
- Click Collections
- Click Import
- Click Link and enter this URL: https://<your FQDN>/ns-api/apidoc/api_doc_collection.json
- Click Continue
- Click Import
- Right-click the collection to rename it if you wish
Add Environment Variables
- Click on Environments
- Click the + sign to create a new environment
- Enter a descriptive name
- Add the following variables and values *ensure there is no typo's or linebreaks
Variable | Initial Value |
---|---|
api_url | https://api.ucaasnetwork.com/ns-api |
token_type | Bearer |
createtokenpasswordoauth2_client_id | Your oauth2 client id |
createtokenpasswordoauth2_client_secret | Your client secret |
createtokenpasswordoauth2_username | Your portal username |
createtokenpasswordoauth2_password | Your portal password |
createtokenpasswordoauth2_grant_type | password |
- Click Save
Generate OAuth Token
- Click Collections
- Open the previously imported collection
- Click the dropdown at the top right and select the newly created environment
- Search for and select CreateTokenPasswordOauth2
- Click Tests
- Delete all of the code and replace it with the code below. This will allow us to save the access token as an environment variable for future use
pm.test("Generating access token", function () { pm.response.to.have.status(200); var token = JSON.parse(responseBody); console.log('Access token is saved') pm.environment.set("token", JSON.stringify(token) ); pm.environment.set("access_token", token.access_token); });
- Click Save
- Click Send to test
- If your credentials or your client_id/secret are invalid, then you will get an assertion error in the Test Results as shown below. (ie: Generating access token | AssertionError: expected response to have status code 200 but got 403 )
- If everything went well, you will receive a JSON response with your access token, territory, username, etc.. letting you know that you have been authenticated successfully. Click on Test Results to verify.
- This token is only valid for 60 minutes or 3600 seconds. Once the token has expired, you will have to send this query again