Skip to main content Skip to complementary content

Defining responses

Define one or several responses for your operation.

Procedure

  1. To add responses to your operation, click the name of the operation, scroll down to the RESPONSES section and click Add.
  2. 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.
  3. To add a header, click Add to the right of HEADERS.
  4. Enter a Name.
    Start typing a name to see a drop-down list of headers.

    Example

    Screenshot of the list of headers that start with "Content".
  5. Select a Type.
    You can use a reusable data type.
  6. Click more attributes to add more information in your response.
  7. If you need to define more headers, click Add a header and repeat the previous steps as many times as necessary.
  8. To define a body, click Add to the right of BODY.
    Linking response values to other operations is not supported.
  9. Click the Media Types field to add media types, if needed.
    You can add as many media types as necessary.
  10. Enter a Description if needed.
  11. 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.
    Information noteTip: 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

    Screenshot of a Content-Type header with a Film media type.
  12. Click Add to the right of BODY to define a new body with different media types, if needed.
  13. 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.
  14. Click Save.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!