Test an API

You can expand and test API methods listed on the API details page. The required steps depend on whether the API expects authentication or not. This information is shown above the method list.

Test an unsecured API

If an API does not require authentication, testing the methods is very straightforward.

  1. Click on the method you want to test.
  2. Fill in any values the method requires and select the content type you want.
  3. Click Try it out!.

The details of the response are shown below the method description.

Test a secured API

An API exposed in the API Catalog can have the following authorization methods configured in API Manager:

  • API Key authorization
  • OAuth
  • HTTP Basic authentication
  • Invoke Policy

You can test any of the configured authorization methods when testing a method. Testing OAuth authentication requires an OAuth access token, see Request an OAuth access token.

Note   For Invoke Policy, the option to select credentials is not available, but the description of the API is displayed.
  1. Click on the method you want to test.
  2. To use the same authorization method for all methods, select Use same credential for all methods. Unselect this option, if you want to choose the authorization method separately when testing each method.
  3. Select the key or token you want to use for the authorization.
  4. Fill in any values the method requires and select the content type you want.
  5. Click Try it out!.

API Gateway acts as an authentication and authorization server, and authorizes API Portal to access the API. API Portal returns a formatted result set. If an error occurs, API Portal returns the error status code and error reason details.

API Portal Authorization sample screen

Request an OAuth access token

If the API requires OAuth authentication, you must request an access token before trying the API:

  1. Click on the method you want to test.
  2. Ensure the authorization method is OAuth, and select OAuth client credentials from the drop-down list.
  3. Click on the Request token link.
  4. Example OAuth authorization request
  5. Select the permissions for API Portal, and click Authorize.
  6. Authorize access for API Portal
  7. The authorization token is displayed as shown below:

    Example OAuth authorization code

  8. To discard the authorization token and get a new one, click the Discard token link and repeat the procedure.

After you select the authorization type, expand a method and click Try it out! to test it.

For additional information about OAuth (OAuth 2.0) deleted access configuration and usage, see the API Gateway OAuth User Guide.

Related Links