Define one or several responses for your operation.
Procedure
- To add responses to your operation, click the name of the operation, scroll down to the RESPONSES section and click Add.
-
Select a status code and add a description if needed.
You can select:
- A specific status code such as 200.
- A response range such as 2XX.
- A Default response.
- To add a header, click Add to the right of HEADERS.
-
Enter a Name.
Start typing a name to see a drop-down list of headers.
Example
-
Select a Type.
You can use a reusable data type.
- Click more attributes to add more information in your response.
- If you need to define more headers, click Add a header and repeat the previous steps as many times as necessary.
-
To define a body, click Add to the right of
BODY.
Linking response values to other operations is not supported.
-
Click the Media Types field to add media types, if
needed.
You can add as many media types as necessary.
- Enter a Description if needed.
-
Select a Type and add the corresponding
properties.
You can use a reusable data type or create a new data type. Click Extract data type if you want to save the data type you created in your API and reuse it.Tip: If you add a value for your header in the Examples, Enum or Default, it will be returned when testing your mock with Talend Cloud API Tester.
Example
- Click Add to the right of BODY to define a new body with different media types, if needed.
-
Click Add to the right of
RESPONSES to add a new response, if needed.
You can add as many responses as needed, as long as each status code is unique.
- Click Save.