Mock Collection

Mock collections provide a structured way to manage your mocks. Each collection can optionally include a static “path” that is automatically prepended to the mock endpoints within that collection. This feature is particularly useful for versioning your mocks, ensuring consistency and clarity across different versions of your API.

Key benefits

  1. Efficient Organization:

    • Group related mocks together, making it easier to manage and locate them.
  1. Better Versioning:

    • Utilize the static "path" feature to prepend a version identifier or other relevant prefixes to your mock endpoints.

    • Simplify the process of updating and managing multiple versions of your API.

Example

Consider a collection for API version 1.0:

  • Collection path: /api/v1
  • Mock Endpoints:

    • /users

    • /products

With the collection path, the actual mock endpoints become:

  • /api/v1/users
  • /api/v1/products

This approach ensures that all endpoints within the collection are easily versioned, improving maintainability and clarity.

Create a new collection

  1. Go to Mocks Dashboard
  1. Click on New Collection.

  1. Enter the details of the Mock Collection and then click on Save.

    1. Name: Give a collection a name.

    2. Collection Path: A path which gets prepended to all the mocks inside this collection.

      1. So if the collection path is “/api/v1”, then all the child mocks endpoint will start with this collection path.
    3. Description: Give collection a description.

Move mock into collection

Once the collection is created you can move the mocks into it.

  1. Click on the options button in right and click Move.

  2. Select the appropriate collection and click Move.

Updated on