Passing an array through postman not working but through swagger it works fine?

Viewed 49

I am trying to implement a method where i simply retrieve the products that i provide the body with. So if i add [1,3,5] i will return products with those specific IDs, however this works fine on swagger as seen below this is how i pass my ids. enter image description here

I have also use a [FromBody] call in my controller call like this

[HttpPost("findListOfProducts")]
public async Task<IEnumerable<Product>> GetListOfProductsAsync([FromBody]List<int> ids)

However in postman im passing my data through Body -> raw and setting it as JSON in such format

[ 1, 3 ]

However it gives me a 404, and i dont get why its wrong, the reason i wanna know is because once i do an axios.post its also failing and i think its the way of me sending those data that is wrong.

0 Answers
Related