Configure multiple request body examples
Apidog supports configuring multiple examples for request bodies of JSON, XML, Raw, and MsgPack type. This feature is useful for:
- Configuring examples for different business scenarios: For instance, normal requests vs. exception requests.
- Compliance with OAS 3.0/3.1 specifications: Supports exporting standard OpenAPI specifications.
- Quickly switching between examples: Useful during debugging and automated tests.
Configuring multiple request body examples
Apidog version must be 2.7.0 or higher.
:::tip
For request bodies of Raw type, only the first example value is displayed during debugging.
:::
Extracting request parameters as examples
:::tip
The current debugging value will be automatically filled into the example by default.
:::
Use scenarios
Using request body examples during debugging
:::info Advanced Settings
Click the dropdown icon next toAuto-generate
to access the following options:
- EXAMPLES: Choose from predefined request body examples.
- Generate Each Time: Automatically generate random values based on mock rules.
- Auto-generation Preference: For more advanced configurations, refer to Generate Requests.
:::
Documentation display
- For single request body example: Shown in a simplified view without displaying the example name.
- For multiple request body examples: Allows switching between examples in a side-by-side layout, displaying example names and Markdown descriptions.

:::tip
The display order for request body examples follows this priority:
- Example Name > OAS Key > Serial Number (auto-incremented from
1
). - Non-empty items are displayed first.
:::
OAS compliance
OAS key
OAS key controls the field names of the examples when exporting OpenAPI specifications.
- Configuration: Fill in the
OAS Key
for the request body examples.
- Export Rules:
- When filled: The provided OAS key is used as the field name within the object
examples
. - When not filled: Serial numbers (starting from
1
) are automatically used as field names.
```json
"examples": {
"example1": {
"value": {
"name": "Blake Keeling",
"id": "165061",
"email": "Blake.Keeling@gmail.com"
},
"summary": "example1",
"description": "This is`example 1`"
},
"example2": {
"value": {
"name": "Jolie Kutch",
"id": "138164",
"email": "Jolie_Kutch@hotmail.com"
},
"summary": "example 2",
"description": "This is`example 2`"
}
}
```
</Column>
<Column>
```json
"examples": {
"1": {
"value": {
"name": "Blake Keeling",
"id": "165061",
"email": "Blake.Keeling@gmail.com"
},
"summary": "example1",
"description": "This is`example 1`"
},
"2": {
"value": {
"name": "Jolie Kutch",
"id": "138164",
"email": "Jolie_Kutch@hotmail.com"
},
"summary": "example 2",
"description": "This is`example 2`"
}
}
```
</Column>
</Columns>
</Container>
OAS Extensions
You can add custom OpenAPI Specification (OAS) extensions to examples.
- Configuration: Input JSON key-value pairs in the OAS Extension field.
{
"x-demo": true,
"x-scenario": "error_case"
}
- Export Effect: The custom OAS extensions will be fully preserved and included in the exported OpenAPI specifications.
"examples": {
"example1": {
"x-demo": true,
"x-scenario": "error_case",
"value": {
"name": "Blake Keeling",
"id": "165061",
"email": "Blake.Keeling@gmail.com"
},
"summary": "example1",
"description": "This is`example 1`"
}
}
FAQs
</Column>
<Column>
</Column>
</Columns>
Last modified: 2 days ago