I have endpoint which takes few parameters and body as input, and I want to test it in Postman. But, when I input data into 'form-data' section in Postman backend throws error that I am missing body. If I try input data into 'raw' (Text) it complains that I forgot about parameters. How can I combine params and body?
EDIT:
'form-data' section
'raw' section
Parameters for that endpoint are following:
@RequestParam("to") String to,
@RequestParam("subject") String subject,
@RequestBody String content,
@RequestParam("isMultipart") Boolean isMultipart,
@RequestParam("isHtml") Boolean isHtml
Right-click selected text, and choose EncodeURIComponent to manually encode a parameter value. To send a path parameter, enter the parameter name into the URL field, after a colon, for example :id . When you enter a path parameter, Postman will populate it in the Params tab, where you can also edit it.
Enter the same URL in the Postman text field; you will get the multiple parameters in the Params tab. Even you can write each of the parameters and send a request with multiple parameters.
To send data using the HTTP POST method, you must include the data in the body of the HTTP POST message and specify the MIME type of the data with a Content-Type header. Below is an example of an HTTP POST request to send JSON data to the server. The size and data type for HTTP POST requests is not limited.
For the request params you would add them to the end of the URL
rather than in the request body, like you have done in the image.
[email protected]&subject=Testing mailing feature&isMultipart=false&isHTML=true
This can be seen in the Postman UI when you select the Params
button, this can be found next to the Send
button.
I'm unsure about the string
that you need in the request body and in what format the endpoint requires this data.
If it's in a JSON format you could add {"content": "Some new content"}
to the raw
body and select JSON (application/json)
from the dropdown, this will also set the correct request header.
Edit:
The UI has changed slightly since this answer was given. The Params
tab is now placed in a less confusing place.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With