CodeMonkey
CodeMonkey

Reputation: 12424

Passing a file as a parameter for a Spring web service via Postman

I am creating a Spring REST web service for someone who got a client which will use my web service. I have installed the Postman client to test the web service.

One of the web service's parameters is defined as follows:

@RequestParam(value="param2", required=true) MultipartFile param2

I am able to pass strings to the web service but how can I pass a file as a parameter for the web service using Postman? The problem is that many examples I've seen instructing how to do it, had an option to choose a file in the request builder in the form tab. However, in my case there's for some reason a seperate tab for the form and the files and I'm not sure how to give the file I upload a key and add it to the POST parameters.

Upvotes: 3

Views: 13048

Answers (1)

GargantuanTezMaximus
GargantuanTezMaximus

Reputation: 1118

There are a couple of different ways depending on the type:

1) As form-data

enter image description here

2) As binary

enter image description here

Upvotes: 5

Related Questions