Mock server always returning "mockRequestNotFoundError"

Archived topic — some details may be out of date.
Mock servers built from saved collection examples are still supported. Postman now also has code-based mocks: JavaScript request handlers plus a config.yaml, stored as files in your Git repository, which you can run locally or deploy. Create one in the app, or use the Postman CLI to generate one from an OpenAPI spec, collection or dataset (postman mock generate) and run it (postman mock run). See About mocks and Create a mock.
Working with an AI coding agent? The Postman plugin can build and run mocks for you.
For current help, see the Postman docs, try the free Postman tools (no account needed), or join us on Discord.

I created a new collection with a single request to learn how to use Postman mock servers and, while I managed to successfully make it private, return different examples for a single route depending on query parameters… Everything broke down when attempting to return an example of a request that has a JSON body.

All I’m receiving now from the mock server is the following error:

{
        "error": {
        "name": "mockRequestNotFoundError",
        "message": "Double check your method and the request path and try again.",
        "header": "No matching requests"
    }
}

Additional data

Hey @epablom :wave:

Welcome to the Postman Community! :postman:

It’s a little difficult to see what’s going on with the cropped images.

Do you have more examples in the request that could be returned?

Is it returning the correct example of you were to use the x-mock-response-name header and the example name as the value?

If you could provide more details, it will help to narrow down what the issue might be here. :pray:

There aren’t any other examples for the query and this one is the only request in the collection.

Using the x-mock-response-name header does, indeed, work. Although it’d be nice to know if there’s another solution to the problem, since I’m aiming to call a similar mock server with the same problem (and a fairly larger collection and set of examples) from an external app in the near future.


Let me know whatever other info would be useful (or what other format instead of the cropped images would). :))

Finally found the problem.

The thing was that the API I was given wasn’t following REST architecture standards and good practices.