To Publish and Test the API Design

This procedure builds on designing the RAML root, a data type, and resource in visual design mode.

In this procedure, you publish the API you designed to Exchange. In Exchange, you simulate calling the API. When you turn on the mocking service, and send a request to the API, the mocking service returns the example response you specified in the API. When you turn off the mocking service, and repeat the request, the API returns actual data from the JSONPlaceholder service.

  1. Click Publish to Exchange Publish to Exchange icon.

    Publish API Specification to Exchange appears.

  2. Accept the default options, check that Valid RAML appears below the Main file, and click Publish.

    The success message appears.

    success publish
  3. Click View in Exchange.

    The API Summary appears on the left and an API overview on the right.

    api summary
  4. In API Summary, click GET.

    API Console replaces the overview in the right pane.

  5. Accept the default Mocking Service in the right pane, and replace num* with 1 in URI Parameters.

    api console v
  6. Click Send.

    A status 200 and the example response you specified during design is returned.

  7. Instead of Mocking Service, select RAML Base URI.

  8. In URI Parameters, enter 3 and click Send.

    A status 200 and actual data from JSONPlaceholder service appears. Comments about post 3 are returned.

    "postId": 3,
    "id": 11,
    "name": "fugit labore quia mollitia quas deserunt nostrum sunt",
    "email": "",
    "body": "ut dolorum nostrum id quia aut est fuga est inventore vel eligendi explicabo quis consectetur aut occaecati repellat id natus quo est ut blanditiis quia ut vel ut maiores ea"
    "postId": 3,
    "id": 12,
    "name": "modi ut eos dolores illum nam dolor",
    "email": "",
    "body": "expedita maiores dignissimos facilis ipsum est rem est fugit velit sequi eum odio dolores dolor totam occaecati ratione eius rem velit"
  9. Try entering a URI parameter outside the limits you specified in the data type. For example, enter 7.

    An error is indicated.

In this topic: