Example

It has the examples for the request / response bodies. These examples will be used to provide samples on the right pane of API help document.

Possible Locations

Child Elements

  • Description
  • Value   required
    Give the actual example of request or response in this element.

Attributes


Name Type Description
name
required
String Name for the sample request / response of the resource.

Note:

The attribute name is mandatory only when the example is a child of <components>.

Example

Imagine that we want a sample GET response of the trips resource to be added to the help document. So you have to add the sample to the example as shown here,

copy

<example name="Sample response of GET trips">
    <description> This is the core data of our trips resource. </description> 
    <value>
        {
            "trips": [
                {
                    "trip_name":"Spring Break - John Doe",
                    "destination": "Bali",
                    "start_time": "2023-11-13T17:30:00",
                    "end_time": "2023-11-17T22:30:00",
                    "no_of_days": 4
                }
            ]
        }
    </value>
</example>

Last Updated 2025-05-30 16:54:59 +0530 IST