0
0
PostmanHow-ToBeginner ยท 3 min read

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 POST or PUT to send data.
  • Headers: Set Content-Type to application/xml or text/xml to tell the server you are sending XML.
  • Body: Choose raw and select XML format, 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-Type header to application/xml or text/xml, causing the server to reject the data.
  • Choosing the wrong body type (like form-data or x-www-form-urlencoded) instead of raw with 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

StepActionDetails
1Select MethodChoose POST or PUT depending on API
2Set HeadersAdd Content-Type: application/xml or text/xml
3Set Body TypeChoose raw and select XML from dropdown
4Enter XMLPaste your XML content in the body area
5Send RequestClick 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.