Apidog Docs
🇺🇸 English
  • 🇺🇸 English
  • 🇯🇵 日本語
HomeLearning CenterSupport CenterAPI References
HomeLearning CenterSupport CenterAPI References
Discord Community
Slack Community
X / Twitter
🇺🇸 English
  • 🇺🇸 English
  • 🇯🇵 日本語
  1. Design APIs
  • Apidog Learning Center
  • Get started
    • Introduce Apidog
    • Basic concepts in Apidog
    • Navigating Apidog
    • Quick Start
      • Overview
      • Specify a new endpoint
      • Make a request to the endpoint
      • Add an assertion
      • Create a test scenario
      • Share your API documentation
      • Explore more
      • Send a request and save as an endpoint
    • Migration
      • Overview
      • Manual import
      • Scheduled import
      • Import options
      • Export data
      • Import from...
        • Import from Postman
        • Import OpenAPI (Swagger) spec
        • Import cURL
        • Import Markdowns
        • Import from Insomnia
        • Import from apiDoc
        • Import .har file
        • Import WSDL
  • Design APIs
    • Overview
    • Create a new API project
    • Endpoint basics
    • Components
    • Common fields
    • Global parameters
    • Endpoint change history
    • Batch endpoint management
    • Configure multiple request body examples
    • Schemas
      • Overview
      • Create a new schema
      • Build a schema
      • Generate Schemas from JSON etc.
    • Security schemes
      • Overview
      • Create a security scheme
      • Use the security scheme
      • Security scheme in online documentation
    • Advanced features
      • Custom endpoint fields
      • Import endpoints as test steps
      • Endpoint status
      • Appearance of parameter lists
      • Endpoint unique idenfication
  • Develop and Debug APIs
    • Overview
    • Generate requests
    • Send requests
    • Endpoint cases
    • Dynamic values
    • Validate responses
    • Design-first Mode & Request-first Mode
    • Generate code
    • Environments & variables
      • Overview
      • Using variables
      • Environments & services
    • Vault secrets
      • Overview
      • HashiCorp Vault
      • Azure Key Vault
      • AWS Secrets Manager
    • Pre/Post processors
      • Overview
      • Assertion
      • Extract variable
      • Wait
      • Database operations
        • Overview
        • MongoDB
        • Redis
        • Oracle Client
      • Using scripts
        • Overview
        • Postman scripts reference
        • Pre processor scripts
        • Post processor scripts
        • Public scripts
        • Calling other programming languages
        • Using JS libraries
        • Visualizing responses
        • Script examples
          • Assertion scripts
          • Using variables in scripts
          • Using scripts to modify request messages
          • Other examples
    • Dynamic values Modules
  • Mock API data
    • Overview
    • Smart mock
    • Custom mock
    • Mock priority sequence
    • Mock scripts
    • Cloud mock
    • Self-hosted runner mock
    • Mock language (Locales)
  • Automated tests
    • Overview
    • Test reports
    • Test scenarios
      • Create a test scenario
      • Pass data between requests
      • Flow control conditions
      • Import endpoints/endpoint cases from other projects
      • Sync data from endpoints/endpoint cases
      • Export test scenarios
    • Run test scenarios
      • Run a test scenario
      • Data-driven testing
      • Run test scenarios in batch
      • Scheduled tasks
      • Manage the runtime environment of APIs from other projects
    • Test APIs
      • Integration testing
      • Performance testing
      • End-to-end testing
      • Regression testing
    • Apidog CLI
      • Overview
      • Installing and running Apidog CLI
      • Apidog CLI Options
    • CI/CD
      • Overview
      • Integrate with Jenkins
      • Integration with Gitlab
  • Publish API Docs
    • Overview
    • API Technologies Supported
    • Quick share
    • View the API documentation
    • Publish docs sites
    • Folder tree settings
    • Custom layouts
    • Visibility settings
    • Endpoint SEO settings
    • Custom domain
    • Embedding values in document URLs
    • Documentation Search
    • Integrating Google Analytics with Doc Sites
    • CORS Proxy
    • API Versions
      • Overview
      • Create API versions
      • Publish API versions
      • Share endpoints with API versions
  • Send requests
    • Overview
    • gRPC
    • Use request proxy agents for debugging
    • SOAP/WebService
    • GraphQL
    • WebSocket
    • Socket.IO
    • SSE debugging
    • Create requests
      • Request History
      • Request basics
      • Parameters and body
      • Request headers
      • Request settings
      • HTTP/2
    • Authentication and authorization
      • Overview
      • CA and client certificates
      • Authorization types supported by Apidog
      • Digest Auth
      • OAuth 1.0
      • OAuth 2.0
      • Hawk Authentication
      • Kerberos
      • NTLM
      • Akamai EdgeGrid
    • Response and cookies
      • Overview
      • API response in Apidog
      • Create and send cookies
      • Debug requests
      • Save the request as an endpoint
  • Branches
    • Overview
    • Create a new sprint branch
    • Test APIs in a branch
    • Design API in a branch
    • Merge sprint branches
    • Manage sprint branches
  • Apidog MCP Server
    • Overview
    • Conntect API Specification within Apidog Project to AI via Apidog MCP Server
    • Conntect Online API Documentation Published by Apidog to AI via Apidog MCP Server
    • Conntect OpenAPI Files to AI via Apidog MCP Server
  • Best practices
    • How to handle API signatures
    • How to access OAuth 2.0 protected APIs
    • Apidog collaboration workflow
    • Managing authentication state in Apidog
  • Administration
    • Onboarding Checklist
      • Basic Concepts
      • Onboarding Guide
    • Managing Teams
      • Managing Teams
      • Managing Team Members
      • Member Roles & Permission Settings
      • Team Activities
      • Team Resources
        • General Runner
        • Team Variables
        • Request Proxy Agent
      • Real-time Collaborations
        • Team Collaboration
    • Managing Projects
      • Managing Projects
      • Managing Project Members
      • Notification Settings
      • Project Resources
        • Database Connection
    • Managing Organizations
      • Single Sign-On (SSO)
        • SSO Overview
        • Configure Microsoft Entra ID
        • Configure Okta
        • Configure SSO for an Organization
        • Managing user accounts
        • Mapping Groups to Teams
      • SCIM Provisioning
        • Intro to SCIM Provisioning
        • Microsoft Entra ID
        • Okta
      • Organization Resources
        • Self-hosted Runner
  • Billing
    • Overview
    • Credits
    • Unable to use credit cards?
    • Managing subscriptions
    • Upgrade plan
  • Data & Security
    • Where is Apidog's data stored, and how is data security ensured?
    • How is user data stored? Will this data be public? Or will it be private? Will all data be stored in the cloud?
    • When sending requests, do they go through the Apidog server? Is data security ensured?
  • Add-ons
    • API Hub
    • Apidog Intellij IDEA plugin
    • Browser Extension
      • Chrome
      • Microsoft Edge
    • Request Proxy
      • Request proxy in Apidog web
      • Request proxy in shared docs
      • Request proxy in Apidog client
  • Account & preferences
    • Language settings
    • Data backup
    • Network proxy configuration
    • Hot keys
    • Updating Apidog
    • Generate OpenAPI access token
    • Deleting account
    • Account settings
  • References
    • API-Design First Approach
    • Apidog OpenAPI/Swagger Specificaiton Extensions
    • JSONPath
    • XPath
    • Regular Expressions
    • JSON Schema
    • CSV File Format
    • Install Java Environment
    • Runner deployment environment
    • Apidog flavored Markdown
  • Apidog Europe
    • Apidog Europe
  • Support Center
  1. Design APIs

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.
multiple-request-body-examples.png

Configuring multiple request body examples#

Apidog version 2.7.0 or later is required.
1
Create a new request body example
Go to the Edit page of your endpoint documentation.
Locate the Request Body section.
Click the + Add button to create a new request body example.
creating-new-request-body-example.png
2
Configure the request body example
Example Name (optional): If left blank, it will default to Example 1, Example 2, etc.
Example Value (required): Provide the actual example data for the request body.
Description (optional): Add a description to explain the example. Supports Markdown formatting for rich text.
OAS Key (optional): Used when exporting OpenAPI specifications. If not provided, a serial number will be used instead.
OAS Extensions (custom fields): If provided, this will be retained during export.
configure-request-body-example.png
3
Save & Use the request body example
Once you’ve saved the example, it becomes available for use. During debugging, you can easily select from different examples to test your endpoints.
use-request-body-example-during-debugging.png
TIP
For request bodies of Raw type, only the first example value is displayed during debugging.

Extracting request parameters as examples#

1
Extract request parameters as examples
While debugging, if you’ve manually configured the request body and want to save it as an example, simply click:Extract-> Extract to "Request Example".
extract-request-parameters-as-examples.png
2
Choose the Extraction option
You’ll be prompted to choose how to save the request parameters:
Overwrite the Example: Replace a previously saved example.
New Example: Save it as a brand-new example.
choose-extraction-options.png
TIP
The current debugging value will be automatically filled into the example by default.

Use scenarios#

Using request body examples during debugging#

1
Go to theRun page of the endpoint documentation and locate theAuto-generatesection.
2
Click the dropdown menu to select a request body example. The example will automatically populate.
switch-request-body-examples-debugging.png
3
You can switch between examples in real-time and send requests with the selected example.
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.
single-request-body-display.png
For multiple request body examples: Allows switching between examples in a side-by-side layout, displaying example names and Markdown descriptions.
request-body-examples-display.png
TIP
The display order for request body examples follows this priority:
1.
Example Name > OAS Key > Serial Number (auto-incremented from1).
2.
Non-empty items are displayed first.

OAS compliance#

OAS key#

OAS key controls the field names of the examples when exporting OpenAPI specifications.
1.
Configuration: Fill in the OAS Key for the request body examples.
configuring-request-body-oas-key.png
2.
Export Rules:
When filled: The provided OAS key is used as the field name within the objectexamples.
When not filled: Serial numbers (starting from1) are automatically used as field names.
When filled
When not filled:

 "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`"
    }
  }       
"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`"
   }
 }       

OAS Extensions#

You can add custom OpenAPI Specification (OAS) extensions to examples.
1.
Configuration: Input JSON key-value pairs in the OAS Extension field.
{
  "x-demo": true,
  "x-scenario": "error_case"
}
add-oas-extensions-to-examples.png
2.
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#

How to Enable Multiple Request Body Examples in Old Projects?
No manual action is required! When you add a second request body example to an existing endpoint, the system automatically upgrades the format to support multiple examples.
How to Handle Multiple Request Body Examples When Exporting OAS?
Will the Order of the Request Bodu Examples Change in the Exported OAS?
How to Make Exported Example Names More Friendly?
Previous
Batch endpoint management
Next
Overview
Built with