Import a definition into an API

In this topic, you learn how to add a definition based on a sample response of your API. In many cases, importing a definition is faster than adding one manually. After importing a definition you can still make changes.

We use the API Client to create a response in JSON format. You can instead use a JSON or YAML response that you created another way, that is, outside Neptune DXP.

Prerequisites

  • You have configured an API of any type.

  • You have added an operation to the API.

Procedure

  1. In the Cockpit, go to Connectivity and click API Client.

  2. In the API table, go to your API and click the operation you want to add a definition to.

    Result: The test page for the selected operation opens. You see the endpoint, and any parameters and headers that are defined for the operation.

    api client api overview
  3. If you want to change the response, edit parameters, headers or the endpoint.

  4. Click Send.

    Result: The Response tab opens.

    api client send

    You see the type, URL, response body, and headers.

  5. Copy the response body to the clipboard.

  6. On the shell bar, click the Neptune icon or use the search bar to navigate to the API Designer.

  7. In the API table, click the API.

    Result: The API configuration dialog opens.

  8. Navigate to the Definitions tab and click + to add a definition.

  9. Enter a Name and Description.

  10. Navigate to the Properties tab.

  11. On the toolbar, click JSON Import.

    Result: The Import API dialog opens.

  12. Paste the response from the clipboard and click Import.

    api designer JSON Import

    Result: The API Designer adds properties based on the response. You can still add, edit, or delete properties.

  13. Click Save.

Results

  • You have imported a definition with properties from a sample response.