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:

  1. Create a new REST mock API

  2. Click the Stateful Set button near the bottom of the stub list:

  3. Supply a POST endpoint page (e.g., /users):

  4. Provide a sample request body for the POST e.g.:

    {
        "firstName": "Betty",
        "lastName": "Boop",
        "organization": "Finance"
    }
    
  5. Input a the correlated sample response body for the given request body e.g.:

    {
        "contactId": "4",
        "firstName": "Betty",
        "lastName": "Boop",
        "organization": "Finance",
        "created_utc": "2025-02-28T15:58:35Z"
    }
    
  6. 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.