0
0
PostmanHow-ToBeginner ยท 4 min read

How to Send Form Data in Postman: Step-by-Step Guide

To send form data in Postman, select the Body tab, then choose either x-www-form-urlencoded or form-data as the data type. Enter your key-value pairs for the form fields, then send the request to submit the form data.
๐Ÿ“

Syntax

In Postman, form data is sent in the Body section of the request. You can choose between two main types:

  • x-www-form-urlencoded: Encodes form fields as URL-encoded key-value pairs.
  • form-data: Sends data as multipart/form-data, useful for files and text fields.

Each key represents a form field name, and the value is the field content.

http
POST /your-api-endpoint HTTP/1.1
Host: example.com
Content-Type: application/x-www-form-urlencoded

key1=value1&key2=value2
๐Ÿ’ป

Example

This example shows how to send form data using x-www-form-urlencoded in Postman to submit a login form with username and password.

http
POST https://example.com/api/login

Body tab:
- Select <code>x-www-form-urlencoded</code>
- Add key: <code>username</code>, value: <code>user123</code>
- Add key: <code>password</code>, value: <code>pass123</code>
Output
HTTP/1.1 200 OK { "message": "Login successful", "token": "abc123xyz" }
โš ๏ธ

Common Pitfalls

  • Not selecting the Body tab or wrong data type causes the server to not receive form data.
  • Using raw body type instead of x-www-form-urlencoded or form-data for form submissions.
  • For file uploads, forgetting to use form-data and the file input type.
http
Wrong way:
POST https://example.com/api/login

Body tab:
- Select <code>raw</code>
- Enter JSON: {"username":"user123","password":"pass123"}

Right way:
POST https://example.com/api/login

Body tab:
- Select <code>x-www-form-urlencoded</code>
- Add key: <code>username</code>, value: <code>user123</code>
- Add key: <code>password</code>, value: <code>pass123</code>
๐Ÿ“Š

Quick Reference

  • Body tab: Choose x-www-form-urlencoded for simple form fields.
  • Body tab: Choose form-data for files or mixed data.
  • Key-value pairs: Enter form field names and values.
  • Headers: Postman sets Content-Type automatically based on body type.
โœ…

Key Takeaways

Always select the Body tab and choose the correct form data type before sending.
Use x-www-form-urlencoded for simple key-value pairs and form-data for file uploads.
Enter form fields as key-value pairs to simulate form submission accurately.
Avoid using raw JSON when the API expects form data format.
Postman automatically sets the Content-Type header based on your body selection.