Table of Contents

Search

  1. Preface
  2. Introduction to API Manager
  3. API management
  4. Organizational access policies
  5. API-specific policies
  6. API groups
  7. Authentication and authorization
  8. API Microgateway Service
  9. Analytics

API Manager Guide

API Manager Guide

Interactively testing a managed API

Interactively testing a managed API

You can interactively test a managed API created for a REST API in a Swagger interface. You can view the API URL, the HTTP status codes, the request parameters, and the response parameters. You can also execute the API for testing purposes, or get a sample cURL command.
  1. In the
    API Registry
    page, click to select a managed API, or click to open the Actions menu and select
    View API Details
    .
    The API details window appears.
  2. Select the
    Swagger
    tab.
  3. If the managed API requires authentication, the
    Authorization
    dialog box appears. You might need to perform one of the following actions based on the authentication type that the managed API uses:
    • If the managed API uses JSON Web Token (JWT) authentication, no action is required.
      API Manager
      generates a JWT token and authenticates to the managed API.
    • If the managed API doesn't use JWT authentication and uses basic authentication, enter the username and password of a user who is authorized to access the managed API.
    • If the managed API uses only OAuth 2.0 authentication, enter the credentials of an OAuth 2.0 client that allows access to the managed API.
  4. To expand the view in the
    Swagger
    tab, click the arrows in the upper right corner.
  5. To view the API request body and response codes, click any button that displays an API method.
    For example, for an API with a POST method, a
    POST
    button is displayed. Click the
    POST
    button to view the API request body and response code. The input fields are displayed in the request body and the output fields are displayed in the response body with the data types and field descriptions.
  6. To view the request body in JSON format, select
    application/json
    . To view the request body in XML format, select
    application/xml
    .
  7. To test the API semantics, in the request body panel, perform the following steps:
    1. Click
      Try it out
      .
    2. Edit the request body. Replace any parameter type with a value.
      If a query parameter in a managed API URL includes spaces, the access request fails. Use
      POST
      to pass a query parameter that includes spaces.
    3. To test the updated request body, click
      Execute
      .
      The
      Server response
      panel displays the response body, response headers, and request duration time.
    4. To clear the server response, click
      Clear
      .
    5. To cancel the request body changes, click
      Cancel
      . To change the request body again, click
      Edit
      .
  8. To view the request or response syntax, in the
    Models
    panel, click the right arrow near the request or response entry.
    The model request or response body is displayed. A red asterisk next to an element indicates a required element. The input fields are displayed in the request body and the output fields are displayed in the response body with the data types and field descriptions.

0 COMMENTS

We’d like to hear from you!