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 select API Client.

  2. In the API table, go to your API and select 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

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

  4. Select Send.

    Result: The Response tab opens. You see the type, URL, response body, and headers.

  5. Copy the response body to the clipboard.

  6. On the shell bar, select the Neptune icon or use the search bar to go to the API Designer.

  7. In the API table, select the API.

    Result: The API configuration dialog opens.

  8. In the Definitions tab, select + to add a definition.

  9. Enter a Name and Description.

  10. Go to the Properties tab.

  11. On the toolbar, select JSON Import.

    Result: The Import API dialog opens.

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

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

  13. Select Save.

Results

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