Nav

To Simulate Data in REST APIs

Exchange lets you provide simulated data for testing OAS or RAML REST APIs. The simulated data is provided in the Mocking Service feature.

Simulating data access (Mocking Service) appears in Exchange:

  • In the API console that appears on the right side of an asset detail screen. The Mocking Service lets you add simulated data to an API function and test the API with the data.

    Mocking in API Console

  • As an instance with each version of an API.

    Mocking instance in versions

  • API Instances that lists the Mocking Service URL.

    API Instances Mocking Service URL

To Accept Simulated Data in an API

  1. From Design Center > API Specification, provide example data that the implementation returns. Alternatively, you can develop an OAS (Swagger) specification from a text editor and add the example data there.

  2. In the REST specification provide an HTTP status code for a successful API call.

To Test a REST API With Simulated Data

  1. In Exchange, click a REST API.

  2. Click a function such as GET.

  3. In the API console on the right of the screen, click Send to send simulated data to the API.

    Send simulated data to a REST function

    Exchange sends the data and lists the response, which in this example returns the HTTP 200 OK status to indicate success, and lists the data that is sent from the API using the simulated data.