Same request with different examples

collections

#1

Hi, How do I resolve this problem wherein I have the same request, path, parameters, etc, with Happy response code 200 and an error response of 400 ? I tried making two examples in one request but this doesn’t work.


#2

Are you making 2 separate postman calls?

I tried making two examples in one request but this doesn’t work.

This sounds like you were trying to make two “widgets” in a single postman request.
Does your API allow you to create two “widgets” in a single API request?

Is there another API endpoint that would allow you to create multiple “widgets”. These are things your development team might be able to answer better.

If it is just a case of proper formatting in your request body we might be able to help if you provide the 2 request that you had mentioned above as examples.


#3

hi, thanks for your reply, here is the scenario,

Happy flow post:

[POST] https://postman/api/v1/address 

Content-Type:application/json
x-udid:{{x-udid-new}}

post body:

{
“postalCode”: “9999AP”,
“houseNumber”: “6”,
“street”: “streetName”,
“city”: “Amsterdam”.
}

expected happy response:

Response 201 Created
header: Content-Type: application/json
Body:
{
“name” : “proceedToIdentification”,
“isCompleted” : false
}

For Error flow, the same request, with a different request body will be

{
“postalCode”: “AAAAAAAAAP”,
“houseNumber”: “6”,
“street”: “streetName”,
“city”: “Amsterdam”.
}

expected response body and status code

Response Status code is 400 Bad request
Body:
{
“code” : 400,
“message” : “invalid data”
}

I create only one request, and add two Examples on this request, I tried also creating two request calls and create each Example and save in my collections, and still i get a wrong response.

What I notice is, each time I add another Example, the last example is returned when the request is the same. I check the Mock matching algorithm and i found out that this only check for path and parameters. And most of the examples are GET, no POST, PUT.