Contact Us 1-800-596-4880

To Simulate Calls to the API (API Manager)

This procedure builds on the JSONPlaceholder API example. When you designed this API, you included in the resource definition a JSON example of data. The example represents the response you expect from an actual API implementation when you send a valid request. You use the mocking service in API Console to provide a base URI for the API simulation. When you call the API, the mocking service returns the response in API Console: the status code 200 and example data in JSON.

  1. From the API Administration page, click the product version number.

  2. On the API version details page, click Edit API in API Designer.

  3. Above the API console on the right, turn on the Mocking Service.

    In your RAML definition, the baseUri changes to a mocking service URI.

  4. In the API Console, click GET.

    designing your api 35775

    Click Try it, then GET to return the example data.

    The user information in your example appears:

    [
       {
          "id": 1,
          "name": "Leanne Graham",
          "username": "Bret",
          "email": "Sincere@april.biz",
          "address": {
            "street": "Kulas Light",
            "suite": "Apt. 556",
            "city": "Gwenborough",
            "zipcode": "92998-3874",
            "geo": {
              "lat": "-37.3159",
              "lng": "81.1496"
            }
          },
          "phone": "1-770-736-8031 x56442",
          "website": "hildegard.org",
          "company": {
            "name": "Romaguera-Crona",
            "catchPhrase": "Multi-layered client-server neural-net",
            "bs": "harness real-time e-markets"
          }
        },
        ...