Create Stateful Endpoint Set
Assisted Creation of Stateful Mock APIs
The Create Stateful Endpoint Set feature in WireMock Cloud automates the creation of pre-configured stateful stubs. This allows for quick setup of RESTful API mocks with built-in request-response handling and state management across multiple HTTP methods.
Using this feature, WireMock Cloud automatically generates:
- GET, POST, PUT, and DELETE stubs for the specified resource
- A default 404 response for unmatched requests
This feature requires the REST mock API template. It is not available in the Unstructured / Blank mock API template.
How It Works
You provide:
-
Create a new REST mock API
-
Click the Stateful Set button near the bottom of the stub list:
-
Supply a POST endpoint page (e.g.,
/users
): -
Provide a sample request body for the
POST
e.g.: -
Input a the correlated sample response body for the given request body e.g.:
-
Click the Create Stateful set button:
New stubs will be created that are automatically configured with stateful functionality.
- A POST stub that creates a new resource in the mock API’s stateful memory
- A GET stub that lists all of the resources stored in the mock API’s stateful memory
- A GET stub that retrieves a stroed resource by its identifier
- A PUT stub that updates the stored data of a resource
- A DELETE stub that removes the stored resource
- A DELETE stub that removes all stored resources from the mock API’s stateful memory
- A fallback 404 response for unknown requests
You will want to further modify the stubs to better simulate the APIs real-world stateful behavior.