Use Postman to Test APIs

If you want to test WatchGuard public APIs but do not want to write code to generate requests, you can use Postman to submit API requests through a user interface.

To download and install Postman, go to https://www.getpostman.com/downloads/.

You must enable API access in your WatchGuard Cloud account before you can use Postman to test WatchGuard public APIs. For more information, go to Enable API Access.

Download API Specification Files

To get started, download the .yaml specification files for both the WatchGuard Authentication API and the WatchGuard public API you want to test.

To download the WatchGuard Authentication API specification:

  1. In WatchGuard Cloud, select Administration > Managed Access.
  2. Click Download Authentication Spec.

To download the specification for a WatchGuard public API:

  1. In this API documentation, go to the page for the public API you want to test.
  2. Click Download the API specification.

Import API Specification Files into Postman

After you download the API specification files, import them into Postman. Postman uses the information in the specification files to create a collection, which groups requests to the endpoints in an API.

To import an API specification into Postman:

  1. Open Postman.
  2. Select File > Import.
    The Import dialog box opens.

  3. Click Files, then select the .yaml API specification file you downloaded.
    The Choose How to Import your API dialog box opens.

  4. Select Postman Collection, then click Import.
    Postman imports the specification and creates a new collection in the Collections tab.
  5. Navigate through the collection folders to see and select specific requests.

    Screen shot of a collection and request in Postman

Request an Access Token in Postman

All API requests you make to a public API from Postman must include an access token. To get an access token, use Postman to make a request to the /oauth/token endpoint in the WatchGuard Authentication API. You can use the access token in requests for 60 minutes before it expires and you must request another token.

To request an access token in Postman:

  1. In the Collections tab, in the Authentication APIs collection, click the /oauth/token request.
    The authorization request opens.
  2. Select the Auth tab.

    Screen shot of the oauth/token request Auth tab

  3. In the Username text box, type the readwrite access id you received when you enabled API access in WatchGuard Cloud.
  4. In the Password text box, type the readwrite password you specified when you enabled API access in WatchGuard Cloud.
  5. Select the Body tab.

  6. In the grant_type parameter row, in the Value column, type client_credentials.
  7. In the scope parameter row, in the Value column, type api-access.
  8. Click Send.
    Postman sends the request and a response appears.
  9. In the response, in the access_token parameter, copy the text between the quotation marks. Do not copy the quotation marks.

    Screen shot of a response to the oauth/token request

We recommend you set up a variable in Postman for your access token. This makes it easier to update requests when you generate a new token. You might also want to create variables for any other information you need to include in multiple requests, such as your WatchGuard Cloud account ID or API Key. For more information, go to Postman documentation.

 

Configure and Send API Requests in Postman

Now that you have an access token, you can configure and send a request to a WatchGuard public API.

Each API endpoint has different required parameters that you must include with your request. To determine the information you need to configure in Postman, see the API documentation for the type of request you want to make.

To configure and send a request to a public API in Postman:

  1. In the Collections tab, click the request you want to make.
  2. In the Params tab, specify values for request and path parameters listed in the API documentation.
  3. In the Auth tab, from the Type drop-down list, select Bearer Token.

    Screen shot of the Auth tab in Postman for a public API request

  4. In the Token text box, paste the access token you received from the WatchGuard Authentication API.
  5. In the Headers tab, in an empty row, in the Key column, type WatchGuard-API-Key.

    Screen shot of the Headers tab in a public API request

  6. In the same row, in the Value column, type the API key you received when you enabled API access in WatchGuard Cloud.
  7. Specify values for other header parameters listed in the API documentation.
  8. In the Body tab, edit the json text and specify values for request body parameters listed in the API documentation.
  9. Click Send.
    Postman sends the request and a response appears.