Cloud mock
Cloud mock is an essential feature for teams that require a continuously available mock endpoint. Unlike local mocks, which are served from the user's machine and become unavailable when the computer is turned off, cloud mocks provide a persistent and accessible solution for teams. Here are some key aspects and use cases of cloud mocks:
- Team-wide accessibility: All members of a team share the same cloud mock URL, promoting collaboration and consistency.
- Continuous availability: Cloud mocks remain accessible 24/7, regardless of individual team members' computer status.
- Ideal for public API documentation: Can be used to create sandbox environments for public-facing API documentation.
- Non-production data source: Serves as a reliable data source for non-production environments.
Enabling cloud mock
To enable cloud mocks for your project:
- Navigate to "Project Settings"
- Select "Mock Settings"
- Toggle on the "Cloud Mock" feature
Using cloud mocks
Once enabled, you can access and use cloud mocks in the following ways:
- Visit the endpoint and click on the "Cloud Mock" button in the Mock tab to obtain the cloud mock URL.
- Use the "Request" button to instantly retrieve response data.
- For GET requests, you can directly access the cloud mock URL in a web browser to view the response data.
Implementing access control
Cloud mocks support access control through token authentication:
- Go to "Project Settings" - "Mock Settings"
- Set the access permission to "Token Authentication"
To use the authenticated cloud mock:
Append the token to the request URL:
https://mock.apidog.com/m1/2689726-0-default/users?apidogToken=GdfNrEm6lxM9nDGGIMCWC1OPSiZ6hGOi
For Quick Requests, add the
apidogToken
parameter to the Header parameters.For form-data and x-www-form-urlencoded requests, add the
apidogToken
parameter to the Body parameters.
By implementing cloud mocks, teams can ensure consistent and always-available mock endpoints for their API development and testing processes. This approach streamlines collaboration, improves documentation, and provides a reliable data source for non-production environments.