Why does Postman picks a lesser example response over a better matching one?

I’ve read the Matching Algorithm page a few times, but still don’t understand why Postman picks a lesser response over a more matching one. Let me clarify with images.

^^ This is my request. It has three parameters and will remain this way. It’s nothing special

^^ This is example response 1, where both page and limit parameters match. Not using CompanyId as this can vary in the actual application. The response that includes a example request isn’t special either.

^^ This is example response #2 that only on page parameter differs from response #1 - and on this parameter not matching with the actual request

Whilst both responses are identical to each other and the request, with the difference of the ?page parameter, Postman still picks the one that matches slightly less.

I want to mock pagination in the application by using different responses, based on first- or second page (parameter). Apparently I’m unable to do so.

Can someone help me out?

Hi @sjeefr

You wouldn’t be able to retrieve the mock response just by changing the page parameters in your requests. This behavior can only be expected when you have your mock example responses defined in the same manner. Here is one GitHub thread that explains on how the example responses are fetched when you have an identical endpoints.

Also, here is a mock collection that can be imported into the app - which explains various ways to use the mock in your responses. Hope this helps! :slight_smile: