Raw body lets you send exact text or XML data in your API requests. This helps test how the server handles specific input formats.
0
0
Raw body (text, XML) in Postman
Introduction
You want to send plain text data to an API, like a message or note.
You need to test an API that accepts XML formatted data.
You want to simulate sending custom payloads that are not JSON or form data.
You are testing how the server processes raw text inputs.
You want to check if the API correctly parses XML requests.
Syntax
Postman
POST /api/example HTTP/1.1
Host: example.com
Content-Type: text/plain
Your raw text data hereSet the Content-Type header to match your raw data type (e.g., text/plain or application/xml).
In Postman, select 'raw' in the Body tab and choose the data format from the dropdown.
Examples
Sends plain text as the request body.
Postman
POST /api/message HTTP/1.1 Host: example.com Content-Type: text/plain Hello, this is a plain text message.
Sends XML data as the request body.
Postman
POST /api/xml HTTP/1.1
Host: example.com
Content-Type: application/xml
<note><to>User</to><message>Hello XML</message></note>Sample Program
This request sends an XML order to the server. The server should parse the XML and respond accordingly.
Postman
POST /api/submit HTTP/1.1 Host: example.com Content-Type: application/xml <order><id>123</id><item>Book</item></order>
OutputSuccess
Important Notes
Always match the Content-Type header with the raw data format you send.
Raw body is useful when APIs do not accept JSON or form data.
Use Postman's preview or response tabs to verify the server's reply.
Summary
Raw body lets you send exact text or XML in API requests.
Set the correct Content-Type header to help the server understand your data.
Use raw body to test APIs that expect plain text or XML inputs.