How to Send XML in Postman: Step-by-Step Guide
To send
XML in Postman, select the POST method, go to the Body tab, choose raw, and set the format to XML. Then paste your XML content and set the Content-Type header to application/xml or text/xml.Syntax
To send XML in Postman, you need to set the HTTP method, headers, and body correctly:
- Method: Usually
POSTorPUTto send data. - Headers: Set
Content-Typetoapplication/xmlortext/xmlto tell the server you are sending XML. - Body: Choose
rawand selectXMLformat, then enter your XML content.
http
POST /your-api-endpoint HTTP/1.1 Host: example.com Content-Type: application/xml <note> <to>User</to> <from>Tester</from> <message>Hello XML</message> </note>
Example
This example shows how to send a simple XML payload in Postman to an API endpoint.
http
POST https://example.com/api/sendxml Headers: Content-Type: application/xml Body (raw, XML): <note> <to>John</to> <from>QA</from> <heading>Reminder</heading> <body>Don't forget the meeting at 10 AM.</body> </note>
Output
HTTP/1.1 200 OK
Content-Type: application/xml
<response>
<status>Success</status>
<message>XML received</message>
</response>
Common Pitfalls
Common mistakes when sending XML in Postman include:
- Not setting the
Content-Typeheader toapplication/xmlortext/xml, causing the server to reject the data. - Choosing the wrong body type (like
form-dataorx-www-form-urlencoded) instead ofrawwith XML format. - Malformed XML syntax in the body, which leads to server errors.
http
Wrong way:
Headers:
Content-Type: application/json
Body (raw, JSON):
{
"to": "John",
"from": "QA"
}
Right way:
Headers:
Content-Type: application/xml
Body (raw, XML):
<note>
<to>John</to>
<from>QA</from>
</note>Quick Reference
| Step | Action | Details |
|---|---|---|
| 1 | Select Method | Choose POST or PUT depending on API |
| 2 | Set Headers | Add Content-Type: application/xml or text/xml |
| 3 | Set Body Type | Choose raw and select XML from dropdown |
| 4 | Enter XML | Paste your XML content in the body area |
| 5 | Send Request | Click Send and check response |
Key Takeaways
Always set the Content-Type header to application/xml or text/xml when sending XML.
Use the raw body type and select XML format in Postman to send XML data correctly.
Check your XML syntax carefully to avoid server errors.
POST or PUT methods are commonly used to send XML payloads.
Verify the server response to confirm your XML was received successfully.