Sending the API request

Fill in fields to set up the request for an API that you want to debug on the Test tab.

You can complete this task either by using the API Designer UI application, or by using the browser based API Manager UI.

Open the Test tab

  1. Log in to API Manager or API Designer.
  2. In the navigation list, click Develop icon Develop, then select the APIs tab.
  3. Click the title of the API you want to test.
  4. On the API Design page, click the Test tab in the page header.

Fill in the "Request" section

Use the Request section of the page to set up the request URL, the authentication mechanism, and the request parameters. Complete the following steps to fill in the fields needed for configuring the request.

  1. Select an operation and request URL from the list provided.
  2. On the Parameters tab, define header, query and path parameters.

    An empty row is provided for you to define parameters; enter the parameter name in the Key field, select query, header, or path in the Located in field as appropriate, and supply a string value in the Value field. As you begin to define a new parameter, a further empty row is added automatically.

    Default header parameters and values are provided. For example, if the API has client ID or client secret definitions applied, the corresponding keys are added as header parameters, with the values preset; for details on configuring client ID and client security definitions, see Creating an API key security definition.

    The following table lists some common header definitions that are used in a request:

    Table 1. Common request headers
    Key Value Comments
    Accepts media_type/subtype Specify the type of content that the response headers should use. The default is application/json.
    X-IBM-Client-Id client_ID_val If you are using the built-in test application in the Sandbox catalog, the value is pre-populated automatically. If you are using your own client application, replace the value with the client ID of your application.
    X-IBM-Client-Secret client_secret_value If you are using the built-in test application in the Sandbox catalog, the value is pre-populated automatically. If you are using your own client application, replace the value with the client secret of your application..
    Authorization Bearer access_token Encode the token in base64. API Connect cannot encode the token for you.
    Content-Type media_type/subtype Specify the type of content that the response body should use; for example, application/json or image/png.

    If the API has path or query parameters defined, these are added to the parameters list, ready for you to supply values; for details on configuring path and query parameters, see Defining Paths for a REST API and Configuring an operation.

  3. If your API definition uses Basic authorization for the security setting, click the Authentication tab and provide the User name and Password needed for authenticating with the user registry.

    When you invoke the API, API Connect populates a header using the provided information.

    If you API definition does not use Basic authorization, the Authentication tab is not available.

  4. If the operation is POST or PUT, set up the request body.
    1. Click the Body tab.
    2. Type the information for the body of the request.

Send the request

When your API request is configured, click Send to execute the call.

If a message displays indicating "No Response", the API call cannot be completed. Possible causes of this problem are as follows::

  • CORS is not enabled in the API’s definition

    Edit the API’s definition and enable CORS. Then, save the change and publish the API. If you are using your own client app, remember to subscribe it to the API again after publishing.

  • The gateway service URL has an invalid certificate

    Follow the instructions to accept the certificate and continue testing.

  • The browser cannot connect to the gateway service