Testing an API with the API Manager test tool

You can test the API from within API Manager to ensure that is defined and implemented correctly.

About this task

The API Manager user interface has an integrated test tool. As part of the testing process the test tool stages and publishes a Product for you. The test tool then calls the API and displays the result of that call.

Procedure

To test an API, complete the following steps.

  1. If you have not previously pinned the UI navigation pane then click the Navigate to icon The Navigate to icon.
    The API Manager UI navigation pane opens. To pin the UI navigation pane, click the Pin menu icon The Pin menu icon..
  2. Click Drafts in the UI navigation pane, and then click APIs.
    The APIs tab opens.
  3. Click the name of the API that you want to test.
  4. Click the Assemble tab.
  5. Click the Test icon The Test icon.
  6. If you have not yet configured the test tool for the API you are testing, or if you want to change the configuration of the test tool for your API, complete the following steps:
    1. If you have already configured the test tool, click Change setup.
    2. In the Catalog field, select the Catalog in which you want to test. The Catalog must be a development Catalog; for information on enabling development mode for a Catalog, see Creating and configuring Catalogs.
    3. To use an existing Product, in the Product field, select the Product with which you want to test your API.
    4. If your API is not included in the Product, click Add API.
    5. If you have made changes since you last published your Product, click Republish product.
    6. If you want to create a new Product to test the API with, provide a name for the Product in the Name field, and then click Create and publish.
    7. If there are multiple Plans in your chosen Product that contain your API, select the Plan you want to use in the Plan section's Name field.
      [V5.0.3 or later]Note: If automatic subscription is enabled for the selected Catalog, you do not need to select a Plan because a test application, which is subscribed to all the Plans in the Catalog, is used automatically. For information on enabling automatic subscription for a Catalog, see Creating and configuring Catalogs.
    8. If you want to test by using an existing application, select the application from the Application field and then, if it is not already subscribed to the Product you are using, click Subscribe.
      [V5.0.3 or later]Note: If automatic subscription is enabled for the selected Catalog, you do not need to provide an application because a test application is used automatically. For information on enabling automatic subscription for a Catalog, see Creating and configuring Catalogs.
    9. If you want to create a new application to test with, provide a name for the application in the App name field and then click Create and subscribe.
      Note:
      • You cannot access this application through the Developer Portal. Record the client ID and secret for your new application.
      • [V5.0.3 or later]If automatic subscription is enabled for the selected Catalog, you do not need to provide an application because a test application is used automatically. For information on enabling automatic subscription for a Catalog, see Creating and configuring Catalogs.
    10. Click Next.
  7. If your API is not included in the Product for which your test tool is configured, click Add API.
  8. If you have made changes since you last published the Product with which you are testing your API, click Republish product.
  9. In the Operation field, select the operation you want to test.
    The fields necessary to call your operation are populated by the test tool.
  10. If you have input parameters, complete the corresponding fields.
  11. If you want to run the test multiple times, select Repeat and then, in the Stop after: field, specify how many times you want your test to call the API. Select Stop on error to stop the test if it encounters an error.
  12. Click Invoke to run the test.
  13. Optional: Click Debug to view information about the API configuration.

    DataPower Gateway only[V5.0.3 or later]Additional debug information, such as the input and output of the policy, is available for the invoke, map, and proxy policies.

    [V5.0.7 or later]Restriction: If no API configuration information is displayed when you click the Debug button, a possible reason might be that access to analytics data within API Connect has been switched off. Contact your cloud administrator for confirmation. (For more information, see Configuring destination targets for API Connect analytics data.)

Results

You successfully tested an API.
Note: You can also use the Explore tool within API Manager to test API endpoints. Click Explore and select Drafts or a specific Catalog. The API Explore tool opens and shows the operations for all of the APIs that are contained in your Drafts view or in the specified Catalog. The left pane of the Explore window can be used to select an operation to test. The center pane displays summary information about the endpoint, including its parameters, model instance data, and response codes, and the right pane provides template code to call the endpoint.