Using examples - Cloud

Talend Cloud API Designer User Guide

Version
Cloud
Language
English
Product
Talend Cloud
Module
Talend API Designer
Content
Design and Development > Designing APIs
Last publication date
2024-03-13

Add sample data in example fields throughout your API.

In Talend Cloud API Designer, you can add example values for various elements of your API. Once you have defined an example, it is used when making API calls to your mock.

In the following example, a data type was created using an example.

Screenshot of the Character data type that was generated from a JSON example.

This data type is then used as a response body for an operation.

The Character data type is returned for the method called Get a Star Wars character by ID.

When testing the operation in Talend Cloud API Tester, the example is returned as the response.

Response with the character example. Here the character is Luke Skywalker.

You can define examples in different parts of your API, and some might override the others when making calls to your mock. Here, the example from the data type is used, but you can also define an example for the operation's response.

A new example is defined for the response. Here the character is Leia Organa.

When testing the operation in Talend Cloud API Tester, the example provided in the operation takes precedence over the one defined in the data type.

The character of the example response is now Leia Organa.

In a data type, you can define an example for the entire object, but also for individual properties. If you use both, the example used for the whole object is returned when testing the mock.

External examples are not supported.