Apidog Docs
πŸ‡ΊπŸ‡Έ English
  • πŸ‡ΊπŸ‡Έ English
  • πŸ‡―πŸ‡΅ ζ—₯本θͺž
HomeLearning CenterSupport CenterAPI References
HomeLearning CenterSupport CenterAPI References
Discord Community
Slack Community
X / Twitter
πŸ‡ΊπŸ‡Έ English
  • πŸ‡ΊπŸ‡Έ English
  • πŸ‡―πŸ‡΅ ζ—₯本θͺž
  1. Mock API data
  • 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
      • Generate Schemas from JSON etc.
      • Build a schema
      • Overview
      • Create a new schema
    • 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
  • 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 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. Mock API data

Mock API Data in Apidog

Apidog provides an efficient mock engine that can generate reasonable responses based on API specs without the need for specific configuration, making it highly efficient.
API mocking can be used in the following scenarios:
1.
During parallel frontend and backend development, when the API spec is available but the API hasn't been developed yet. In this case, the frontend can use mock data to assist in development.
2.
When the API contains production data that's inconvenient to call directly, the frontend can use mock data to aid in development.
3.
During testing, when external data requires a test dataset, mock data can be used as the data source.

Getting started#

1
Specify an endpoint or import an API spec; this endpoint needs to have a specified response.
2
Go to "Mock" tab, and click the mock URL to copy.
image.png
3
Paste this URL in your browser to obtain mock data. Refreshing will update the data.

What can Apidog mocking do?#

Apidog's Mock functionality can fulfill the following requirements:
1.
Return automatically generated data based on the API Spec.
2.
Return the response example specified in the API Spec.
3.
Return a specified response.
4.
Return different custom responses based on different request parameters.
5.
Return a response whose parameters are related to the request parameters.

Mock server#

Apidog provides three mock methods: Local mock, Cloud mock, and Runner mock.

Local mock#

Local mock is a server installed on your computer along with the Apidog client. It opens when the Apidog client is opened and only works when your Apidog client is open.
Local mock is suitable for local frontend debugging scenarios.
You can see the URL of this Local mock server in the Local mock environment in the environment management popup.
The local mock server cannot be closed or removed from the environment.
Local mock is only available in Apidog Client but not Apidog Web.

Cloud mock#

Cloud mock has the same functionality as local mock but is deployed on Apidog servers. Unlike local mock, it doesn't depend on whether your local machine is open, and you can access cloud mock data from any machine at any time.
Cloud mock is suitable as a sandbox environment for public APIs.
Cloud mock supports encrypted access.
It is off by default but can be turned on or off.
Learn more about Cloud mock.

Runner mock#

The Runner mock server is located on the team's self-deployed runner. The team needs to deploy the runner on a server first, then all team members can use this runner to mock data. It also doesn't depend on whether your local machine is open.
Runner mock is suitable for use as a data source for large-scale automated testing or as a sandbox environment for non-public APIs.
Learn more about Self-hosted runner mock.

Accessing the mock server#

There are two main ways to access the mock server: URL access and Apidog sending.

URL access#

In every HTTP endpoint in Apidog, you'll see a "mock" module. It's in the "API" tab in DESIGN mode and in the "Mock" tab in DEBUG mode.
Here, you can copy the mock URL and use it anywhere to request mock data.
If the endpoint specifies multiple responses or multiple mock expectations, each response/expectation will have its own mock URL.
image.png
You can click "Request" to make these request in Apidog directly.
Note: If you use "Click to copy", it copies only the URL here, not including the method and body. You'll need to add these necessary parts when making the request.

Accessing mock data within Apidog#

In each Apidog project, you can find Local mock and Cloud mock in the environment switcher in the top right corner.
When you switch the environment to Local mock/Cloud mock, requests in Apidog will be sent to the corresponding mock environment.
Note: Only endpoints in Apidog with paths starting with '/' will be sent to the mock environment. Endpoints with their own prefixed URL that don't start with '/' won't be sent to the mock environment.
Modified atΒ 2025-03-14 08:40:42
Previous
Dynamic values Modules
Next
Smart mock
Built with