3.6. Test an API

Once users are done designing and publishing APIs, they need to test the APIs for functionality. DigitMarket™ API Manager’s Test feature is a simple and interactive interface that allows users to compose and send requests, and view responses to those requests. In short, it allows users to test the functionality of their APIs, without having to write a single line of code. This feature enables users to easily validate the responses of their API calls from within the DigitMarket™ API Manager application, instead of having to use any third-party application to do the same.

In DigitMarket™ API Manager, users can test their APIs by invoking the following methods:

  • GET: Allows users to obtain information
  • POST: Allows users to add new information
  • PUT: Allows users to replace exiting information
  • PATCH: Allows users to update certain exiting information
  • DELETE: Allows users to delete exiting information
  • OPTIONS: Allows users to request for information about the communication option available for a resource

Note

Test feature is only available for published REST/SOAP APIs.

To test a REST API:

  1. Navigate to the REST API Configuration screen of a published API and click Test.

    Test REST APIs

    Fig. 3.195 Test REST APIs

  2. On the Test page, enter the required parameters necessary to test the API.

    Test

    Fig. 3.196 Test

  3. From the method drop-down, select the required method for the API call.

    Select Method

    Fig. 3.197 Select Method

  4. In the Select request URL field, enter the API endpoint.

    Select request URL

    Fig. 3.198 Select request URL

  5. Under Request Headers, click the toggle button to enable Key and Value fields to enter the mandatory headers. You can enter more than one header.

    Request Headers

    Fig. 3.199 Request Headers

  6. Under the Request Body, enter the request body, if present.

    Request Body

    Fig. 3.200 Request Body

  7. Click Send. The response from the Gateway will be displayed under the Response Headers and Response Body.

    Response Headers

    Fig. 3.201 Response Headers

    Response Body

    Fig. 3.202 Response Body

To test a SOAP API:

  1. Navigate to the API Configuration screen of a published API and click Test.

    Test SOAP APIs

    Fig. 3.203 Test SOAP APIs

  2. On the Test page, enter the required parameters necessary to test the API.

    Test

    Fig. 3.204 Test

  3. From the method drop-down, select the required method for the API call.

    Select Method

    Fig. 3.205 Select Method

  4. In the Select request URL field, enter the API endpoint.

    Select request URL

    Fig. 3.206 Select request URL

  5. Under Request Headers, click the toggle button to enable Key and Value fields to enter the mandatory headers. You can enter more than one header.

    Request Headers

    Fig. 3.207 Request Headers

  6. Under the Request Body, enter the request body, if present.

    Request Body

    Fig. 3.208 Request Body

  7. Click Send. The response from the Gateway will be displayed under the Response Headers and Response Body.

    Response Headers

    Fig. 3.209 Response Headers

    Response Body

    Fig. 3.210 Response Body