0
0
Postmantesting~5 mins

x-www-form-urlencoded body in Postman

Choose your learning style9 modes available
Introduction

We use x-www-form-urlencoded to send simple form data in HTTP requests. It turns data into key-value pairs that servers can easily read.

When submitting login forms with username and password.
When sending small amounts of data like search queries.
When APIs expect data in a simple key-value format.
When testing web forms that use POST method.
When you want to simulate browser form submissions.
Syntax
Postman
key1=value1&key2=value2&key3=value3
Keys and values are URL encoded to handle spaces and special characters.
Pairs are joined by '&' and keys are separated from values by '='.
Examples
Sends username and password as form data.
Postman
username=johndoe&password=12345
Search query with spaces encoded as '+'.
Postman
search=coffee+shop&location=New+York
Multiple form fields sent together.
Postman
color=red&size=medium&quantity=2
Sample Program

This is a simple HTTP POST request sending login data using x-www-form-urlencoded format.

Postman
POST /login HTTP/1.1
Host: example.com
Content-Type: application/x-www-form-urlencoded

username=johndoe&password=12345
OutputSuccess
Important Notes

Always set the Content-Type header to 'application/x-www-form-urlencoded' when sending this data.

Use URL encoding for special characters to avoid errors.

This format is best for simple data, not for files or complex objects.

Summary

x-www-form-urlencoded sends form data as key-value pairs joined by '&'.

It is commonly used for simple POST requests like login or search forms.

Remember to set the correct Content-Type header and encode data properly.