WireMock Stub Mappings API

Operations on stub mappings

OpenAPI Specification

wiremock-stub-mappings-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: WireMock Admin Near Misses Stub Mappings API
  description: The WireMock Admin REST API provides programmatic control over a running WireMock server instance. It supports creating, updating, and deleting stub mappings; querying the request journal; recording and replaying real API traffic; managing stateful scenarios; and performing system operations such as reset and shutdown. Available under the /__admin/ path prefix on any running WireMock instance.
  version: 2.35.0
  contact:
    name: WireMock Community
    url: https://wiremock.org/
servers:
- url: http://localhost:8080
  description: Local WireMock server instance
tags:
- name: Stub Mappings
  description: Operations on stub mappings
  externalDocs:
    description: User documentation
    url: http://wiremock.org/docs/stubbing/
paths:
  /__admin/mappings:
    get:
      summary: Get All Stub Mappings
      tags:
      - Stub Mappings
      parameters:
      - description: The maximum number of results to return
        in: query
        name: limit
        required: false
        example: 10
        schema:
          type: integer
      - description: The start index of the results to return
        in: query
        name: offset
        required: false
        example: 0
        schema:
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: schemas/stub-mappings.yaml
              example:
                $ref: examples/stub-mappings.yaml
          description: All stub mappings
    post:
      summary: Create a New Stub Mapping
      tags:
      - Stub Mappings
      requestBody:
        $ref: '#/components/requestBodies/stubMapping'
      responses:
        '201':
          $ref: '#/components/responses/stubMapping'
    delete:
      summary: Delete All Stub Mappings
      tags:
      - Stub Mappings
      responses:
        '200':
          description: Successfully deleted
  /__admin/mappings/reset:
    post:
      summary: Reset Stub Mappings
      description: Restores stub mappings to the defaults defined back in the backing store
      tags:
      - Stub Mappings
      responses:
        '200':
          description: Successfully reset
  /__admin/mappings/save:
    post:
      summary: Persist Stub Mappings
      description: Save all persistent stub mappings to the backing store
      tags:
      - Stub Mappings
      responses:
        '200':
          description: Successfully saved
  /__admin/mappings/import:
    post:
      summary: Import Stub Mappings
      description: Import given stub mappings to the backing store
      tags:
      - Stub Mappings
      responses:
        '200':
          description: Successfully imported
  /__admin/mappings/{stubMappingId}:
    parameters:
    - description: The UUID of stub mapping
      in: path
      name: stubMappingId
      required: true
      example: 730d3e32-d098-4169-a20c-554c3bedce58
      schema:
        type: string
    get:
      summary: Get Stub Mapping by ID
      tags:
      - Stub Mappings
      responses:
        '404':
          description: Stub mapping not found
        '200':
          $ref: '#/components/responses/stubMapping'
    put:
      summary: Update a Stub Mapping
      tags:
      - Stub Mappings
      requestBody:
        $ref: '#/components/requestBodies/stubMapping'
      responses:
        '404':
          description: Stub mapping not found
        '200':
          $ref: '#/components/responses/stubMapping'
    delete:
      summary: Delete a Stub Mapping
      tags:
      - Stub Mappings
      responses:
        '404':
          description: Stub mapping not found
        '200':
          description: OK
  /__admin/mappings/find-by-metadata:
    post:
      description: Find stubs by matching on their metadata
      tags:
      - Stub Mappings
      requestBody:
        content:
          application/json:
            schema:
              $ref: schemas/content-pattern.yaml
            example:
              $ref: examples/by-metadata-request.yaml
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: schemas/stub-mappings.yaml
              example:
                $ref: examples/stub-mappings.yaml
          description: Matched stub mappings
  /__admin/mappings/remove-by-metadata:
    post:
      summary: Delete Stub Mappings Matching Metadata
      tags:
      - Stub Mappings
      requestBody:
        content:
          application/json:
            schema:
              $ref: schemas/content-pattern.yaml
            example:
              $ref: examples/by-metadata-request.yaml
      responses:
        '200':
          description: The stub mappings were successfully removed
components:
  requestBodies:
    stubMapping:
      content:
        application/json:
          schema:
            $ref: schemas/stub-mapping.yaml
          example:
            $ref: examples/stub-mapping-no-id.yaml
  responses:
    stubMapping:
      description: The stub mapping
      content:
        application/json:
          schema:
            $ref: schemas/stub-mapping.yaml
          example:
            $ref: examples/stub-mapping-with-id.yaml
externalDocs:
  description: WireMock User Documentation
  url: https://wiremock.org/docs/