API Academy
🌐 English
  • 🌐 English
  • 🌐 繁體中文
HomePetstore APIExplore more APIs
HomePetstore APIExplore more APIs
🌐 English
  • 🌐 English
  • 🌐 繁體中文
🌐 English
  • 🌐 English
  • 🌐 繁體中文
  1. Mocking APIs
  • Introduction
  • Table of Contents
  • API Academy
    • Get Started
      • What is an API?
      • How Does an API Work?
      • How to Call an API?
      • How to Read an API Documentation?
      • Chapter Summary
      • Get realtime weather
    • API Fundamentals
      • API Funtamentals: Overview
      • Method & Path
      • Parameters
      • Request Body
      • Responses
      • API Specification & OAS
      • Chapter Summary
    • Working with APIs
      • Working with APIs: Overview
      • Making Requests from Spec
      • Environments and Variables
      • Chaining Multiple Endpoints
      • Handling Authentication
      • Handling API Signatures
      • Introduction to Scripts
      • Chapter Summary
    • Mocking APIs
      • Mocking APIs: Overview
      • Smart Mock
      • Mock Expectations
      • Cloud Mock
      • Mock Scripts
      • Chapter Summary
    • Designing APIs
      • Designing APIs: Overview
      • Introduction to API Design
      • Creating Your First API Project
      • Analyzing Requirements and Planning Your API
      • Designing Data Models
      • Designing Endpoints
      • Using Components and Reusability
      • Setting Up Authentication
      • API Design Guidelines
      • Chapter Summary
    • Developing APIs
      • Developing APIs: Overview
      • Setup: Install Your AI Coding Assistant
      • Quick Start: From Spec to Running API in 30 Minutes
      • Understanding the Generated Code
      • Testing Your API with Apidog
      • Deployment: Put Your API Online
      • Chapter Summary
    • Testing APIs
      • Testing APIs: Overview
      • Getting Started: Your First Test Scenario
      • Integration Testing and Data Passing
      • Dynamic Values
      • Assertions and Validations
      • Flow Control: If, For, ForEach
      • Data-Driven Testing
      • Performance Testing
      • Test Reports and Analysis
      • CI/CD Integration
      • Scheduled Tasks and Automation
      • Advanced Testing Strategies
      • Chapter Summary
    • API Documentations
      • API Documentations: Overview
      • Publishing Your First API Doc
      • Customizing Documentation Appearance
      • Interactive Features for Consumers
      • Advanced Publishing Settings
      • Managing API Versions
      • Chapter Summary
    • Advanced API Technologies
      • API Technologies: Overview
      • GraphQL
      • gRPC
      • WebSocket
      • Socket.IO
      • Server-Sent Events (SSE)
      • SOAP
      • Chapter Summary
    • API Lifecycle
      • API Lifecycle: Overview
      • Stages of the API Lifecycle
      • API Governance
      • API Security Best Practices
      • Monitoring and Analytics
      • API Versioning Strategies
      • The Future of APIs
      • Chapter Summary
    • API Security
      • API Security: Overview
      • API Security Fundamentals
      • Authentication vs Authorization
      • Understanding OAuth 2.0 and OpenID Connect
      • JSON Web Tokens (JWT)
      • OWASP API Security Top 10
      • Encryption and HTTPS
      • Chapter Summary
    • API Tools
      • API Tools: Overview
      • The Evolution of API Tools
      • API Clients
      • Command Line Tools (cURL, HTTPie)
      • API Design and Documentation Tools
      • API Mocking Tools
      • API Testing Tools
      • All-in-One API Platforms
      • Chapter Summary
    • API Gateway
      • API Gateway: Overview
      • What is an API Gateway?
      • Key Features of API Gateways
      • API Gateway vs Load Balancer vs Service Mesh
      • Popular API Gateway Solutions
      • The BFF (Backend for Frontend) Pattern
      • Chapter Summary
  • Modern Pet Store
    • Pet
      • Get Pet
      • Update Pet
      • Delete Pet
      • Create Pet
      • List Pets
      • Upload Pet Image
    • User
      • Update User
      • Get User
      • Delete User
      • Login
      • Logout
      • Create User
    • Store
      • List Inventory
      • Create Order
      • Get Order
      • Delete Order
      • Callback Example
      • Pay for an Order
    • Payments
      • Pay Order
    • Chat
      • Create Chat Completion
    • Webhooks
      • Pet Adopted Event
      • New Pet Available Event
  • Schemas
    • Pet
    • Category
    • User
    • ApiResponse
    • OrderPayment
    • Tag
    • Order
    • Links-Order
    • PetCollection
    • Bank Card
    • Bank Account
    • Links
    • Error
HomePetstore APIExplore more APIs
HomePetstore APIExplore more APIs
🌐 English
  • 🌐 English
  • 🌐 繁體中文
🌐 English
  • 🌐 English
  • 🌐 繁體中文
  1. Mocking APIs

Cloud Mock

Cloud Mock is Apidog's cloud-hosted mock server that provides 24/7 availability and team-wide access. Unlike Local Mock (which runs on your computer), Cloud Mock is deployed on Apidog's servers, making it accessible from anywhere, anytime.
In this article, we'll learn how to enable and use Cloud Mock for the Pet Store API, enabling better team collaboration and continuous availability.

1. What Is Cloud Mock?#

Cloud Mock is a mock server hosted on Apidog's cloud infrastructure. Unlike Local Mock (which runs on your computer), Cloud Mock runs on Apidog's servers, providing:
24/7 availability: Works even when your computer is off
Team-wide access: All team members share the same mock URLs
Accessible from anywhere: Use it from any device or location
Ideal for collaboration: Perfect for team development, public documentation, and CI/CD pipelines

Cloud Mock vs. Local Mock#

FeatureLocal MockCloud Mock
LocationYour computerApidog's servers
AvailabilityOnly when Apidog is open24/7, always available
AccessPersonal (each team member has their own)Shared (team-wide)
Best forLocal development and debuggingTeam collaboration, public APIs, CI/CD

2. When to Use Cloud Mock#

Use Cloud Mock when you need:
Team collaboration: Multiple developers need to access the same mock data
Continuous integration: CI/CD pipelines need always-available mock endpoints
Public documentation: Share mock APIs in public API documentation
Remote access: Access mock data from different devices or locations
Stable testing: Need mock endpoints that don't depend on individual machines

3. Enabling Cloud Mock#

Let's enable Cloud Mock for your Pet Store API project:

Step 1: Open Project Settings#

1.
In your Apidog project, click the Settings icon (usually in the top-right corner)
2.
Select "Project Settings"
3.
Navigate to "Mock Settings"

Step 2: Enable Cloud Mock#

1.
Find the "Cloud Mock" toggle
2.
Turn it ON
3.
Cloud Mock is now enabled for your project
image.png

4. Using Cloud Mock#

Once enabled, you can access Cloud Mock in several ways:

Method 1: Get Cloud Mock URL#

1.
Open any endpoint in your project (e.g., GET /pets/{id})
2.
Switch to the "Mock" tab
3.
Click the "Cloud Mock" button
4.
Copy the cloud mock URL
The URL will look like:
https://mock.apidog.com/m1/1138249-1130478-default/pets/{id}
For example, to get a pet with ID pet_1Nv0FGQ9RKHgCVdK:
https://mock.apidog.com/m1/1138249-1130478-default/pets/pet_1Nv0FGQ9RKHgCVdK

Method 2: Use Request Button#

1.
In the Mock tab, click the "Request" button
2.
Apidog will send a request to the Cloud Mock server
3.
View the response in the response panel

Method 3: Switch Environment#

1.
In the top-right corner, click the environment switcher
2.
Select "Cloud Mock" from the dropdown
3.
All requests in Apidog will now go to Cloud Mock instead of the actual API

5. Access Control (Optional)#

For security, you can enable token authentication for Cloud Mock:

Enable Token Authentication#

1.
Go to Project Settings β†’ Mock Settings
2.
Set Access Permission to "Token Authentication"
3.
A token will be generated for your project

Using Authenticated Cloud Mock#

When token authentication is enabled, you need to include the token in your requests:
Option 1: URL Parameter
https://mock.apidog.com/m1/1138249-1130478-default/pets/pet_1Nv0FGQ9RKHgCVdK?apidogToken=YOUR_TOKEN
Option 2: Header Parameter
Add apidogToken to your request headers:
apidogToken: YOUR_TOKEN
Option 3: Body Parameter (for form-data or x-www-form-urlencoded)
Add apidogToken to your request body parameters.

6. Example: Using Cloud Mock with Pet Store API#

Let's see Cloud Mock in action:

Step 1: Enable Cloud Mock#

1.
Enable Cloud Mock in Project Settings (as shown above)

Step 2: Get the Cloud Mock URL#

1.
Open GET /pets/{id} endpoint
2.
Go to the Mock tab
3.
Click "Cloud Mock" to get the cloud mock URL

Step 3: Test the Cloud Mock#

1.
Copy the cloud mock URL
2.
Replace {id} with a pet ID (e.g., pet_1Nv0FGQ9RKHgCVdK)
3.
Paste the URL in your browser or use it in your application
4.
You'll receive Smart Mock-generated data from the cloud
Example URL:
https://mock.apidog.com/m1/1138249-1130478-default/pets/pet_1Nv0FGQ9RKHgCVdK
Example Response:
{
  "id": "pet_1Nv0FGQ9RKHgCVdK",
  "species": "CAT",
  "name": "Whiskers",
  "breed": "Domestic Shorthair",
  "ageMonths": 18,
  "size": "MEDIUM",
  "color": "Orange Tabby",
  "gender": "MALE",
  "goodWithKids": true,
  "goodWithPets": true,
  "adoptionFee": 75,
  "description": "Friendly and playful orange tabby looking for a loving home",
  "status": "AVAILABLE",
  "intakeDate": "2024-06-15",
  "photos": [
    "https://cdn.petstoreapi.com/pets/pet_1Nv0FGQ9RKHgCVdK/photo1.jpg",
    "https://cdn.petstoreapi.com/pets/pet_1Nv0FGQ9RKHgCVdK/photo2.jpg"
  ],
  "medicalInfo": {
    "spayedNeutered": true,
    "vaccinated": true,
    "microchipped": true,
    "specialNeeds": false
  }
}
You can also test other endpoints, such as:
List Pets: GET https://mock.apidog.com/m1/1138249-1130478-default/pets
Create Pet: POST https://mock.apidog.com/m1/1138249-1130478-default/pets

Step 4: Share with Your Team#

Share the cloud mock URL with your team members. They can use the same URL to access the same mock data, ensuring consistency across the team.

7. Key Takeaways#

Cloud Mock provides 24/7 availability and team-wide access to mock APIs
Always available: Works even when your computer is off
Team collaboration: All team members share the same mock URLs
Easy to enable: Just toggle it on in Project Settings
Access control: Optional token authentication for security
Multiple access methods: URL, Request button, or environment switching
Same functionality: Supports Smart Mock, Mock Expectations, and Mock Scripts

Cloud Mock enables seamless team collaboration and continuous availability for your mock APIs. In the next article, we'll learn about Mock Scriptsβ€”how to create dynamic mock responses that maintain logical relationships between request and response data.
Continue with β†’ Mock Scripts
Modified atΒ 2025-12-25 09:45:27
Previous
Mock Expectations
Next
Mock Scripts
Built with