How to combine several json bodies with same structure but different values in 1 request

Hello community,
I was trying to find a solution of combining several json bodies with same structure but different values in 1 request.
Please find the example below.


Obviously this is a bad request. But I’m curious is there a way to make it like that or I should try something else.

P.S. I’m using CSV file for the variables.

Thanks in advance!

Your API doesn’t support that. Code would have to be changed in the implementation to support an array instead of a single object.

1 Like

Thanks for that information @allen.helton! Would you please suggest how to make it with different approach in order to achieve my goal?

What specifically is your goal?

@allenheltondev, My goal is to run all the similar requests at once using variables from CSV file. If it’s not clear enough, I’ll give you more info.

Why though, so you don’t have to build more Postman tests?

Because if that’s your hard requirement, you have to go modify the API code.

@allenheltondev My task is to make it with one request, that’s why. So I’m trying to figure out how.

Ok, so then you need to go change the API source code.

Based on your error message, I’d imagine you need to create a new DTO, ‘UserAnswerList’ that is just a collection of ‘UserAnswer’.

Then you’d need to make sure to update your controller to accept that DTO instead of UserAnswer.

I believe your approach is correct, but I’m not going to change the API source code.
Please, ignore that error message.
If I can’t do it with an array, it should be another way like pre-request script or something else.

The only way to do your task is to change code.

This is not something you can do in Postman.

Hey, @vdespa, what do you think about this?
May be this one: Data-driven testing in Postman - YouTube or Postman - Running a request multiple times with different data sets (external data files) - YouTube is what I should try.