Add a definitions and properties
Definitions let you define how an API response looks like. To simplify the work when you integrate data from an API into an application, create a definition for each possible response the API gives.
In this task, you learn how to add a definition to an external API manually. With many APIs, you can import definitions or derive definitions from sample requests instead. Learn more.
Prerequisites
-
You have configured an external API.
-
You have added an operation to an external API.
Procedure
-
Navigate to the Definitions tab and click + to add a definition.
-
Enter a Name, for example,
Films
, and Description. -
Navigate to the Properties tab and click + Add.
Result: The API Designer adds a new line to specify a property.
-
For each property, enter a Name that indicates what kind of information the property holds, for example,
title
,episode_id
,producer
, andcharacters
. -
Select the allowed Type for the property.
If you select Array
orObject
, go to the Actions column and click + to add sub-properties to the property. -
Enter a Description.
-
If you want the property to be mandatory, activate the Required box.
-
Click Save.
If you used the example data in this topic, your properties look like this:
Additionally: You can use the JSON Import functionality to import definitions from JSON: