Testing an API by using the Developer Portal test tool

You can test the behavior of an API without the need to write any code by using the Developer Portal test tool. You provide the necessary API parameters within the test tool and click Invoke to see the response.

Before you begin

To use the Developer Portal test tool with an API that requires an App client ID, you must first complete the following tasks:

About this task

The Developer Portal test tool is an interactive API document test tool. If the operation that you want to test does not require a client ID, then you can use Developer Portal test tool without the need to sign in. However, if the operation that you want to interact with requires a client ID, then you must sign in to the Developer Portal first.

Using the Developer Portal test tool is subject to the rate limit that is applied to an operation or Plan. For example, if an operation has a rate limit of 10 requests per minute and you invoke the operation, the number of requests that can be made is reduced to nine. The limitations are triggered every time that you click invoke within the minute interval. This caveat affects the quota of the App that is selected to use with the Developer Portal test tool, but it does not affect the quota of the other Apps that are using the same operation or Plan.

To test an API in the Developer Portal, the Allow this API to be tested check box must be selected in the API Manager. For more information, see Creating API definitions.

Restriction:
  • There are security mechanisms that prevent you using the Developer Portal test tool to test an Implicit or Authorization Code grant type in an OAuth provider API. Other grant types in the same OAuth provider API can be tested. If your OAuth provider allows those actions to function correctly from the test tool, you can disable this option. For more information, see Disabling test tool restrictions.
  • You cannot use the Developer Portal test tool with suspended applications.
  • You can only test an unenforced API if testable=true, and if the existing API implements CORS and is using HTTPS.
Note: GraphQL APIs can be tested from the Developer Portal user interface. However, not all authentication methods are supported. You must use one of the following authentication methods:
  • Unsecured
  • Client ID, passed in the header
  • Client ID and secret, passed in the header
Also, cost metrics are not supported, and rate limits specific to GraphQL are not listed in Product plans.

Procedure

  1. To use the Developer Portal test tool with an API that does not require the client ID of an App, complete the following steps:
    1. Click API Products.
      All of the APIs that can be used by application developers are displayed.
    2. Click the name of the API that you want to test.
    3. Select an operation and then select Try It.
    4. Click Try this operation.
    5. Supply the values for required headers or parameters.
    6. If the operation is secured with Basic Authentication, supply the credentials.
    7. Click Send Request.
      The result is displayed in the Response Body field. You can continue to test different parameter values as necessary.
      Note:

      The first time that you click Try It, you might be presented with a security error. Copy the URL from the Request URL field, open it in a browser window, and accept the security certificate. You are not presented with the security error again.

      Also, for performance reasons, if the payload is large, more than 1500 DOM highlighted elements, you get the response, but it is not pretty printed.

  2. To use the Developer Portal test tool with an API that does require the client ID of an App, complete the following steps:
    1. Sign in to the Developer Portal.
    2. If you have not already done so, you must create an App so that you can test an API that requires a client ID. For more information, see Registering an application.
    3. Ensure that your App is subscribed to the Plan that contains the API that you want to test. For more information, see Exploring APIs and Products in the Developer Portal.
    4. Click API Products.
      All of the APIs that can be used by application developers are displayed.
    5. Click the API that you want to test.
    6. Select the Provide credentials for Client ID (API Key) operation and then select Try It.
      The API Key Identification window displays.
    7. Use the Register an application in order to select a client ID drop-down list to select an App to test the API with.
    8. Click Save credentials.
    9. If a client secret is required, enter the value in the Client Secret field.
    10. Find the operation that you want to test, then click Try It.
    11. Supply the required parameters and values.
    12. If the operation is secured with Basic Authentication, supply the credentials.
    13. Click Send.
      The result is displayed in the Response section. You can continue to test different field values as necessary.
      Note: The first time that you click Invoke, you might be presented with a security error. Click the link that is provided to accept the security certificate. You are not presented with the security error again.