Apidog

All-in-one Collaborative API Development Platform

API Design

API Documentation

API Debugging

API Mock

API Automated Testing

Sign up for free

How to Send POST XML with Postman

Start for free
Contents
Home / Applied skills / How to Send POST XML with Postman

How to Send POST XML with Postman

In this article, we will explore the process of sending POST requests with XML data using Postman. We'll walk you through the steps to effectively send XML data to a web service or API, making it simple and easy to work with this common data format.

Postman is a well-known API testing tool that allows you to send various types of HTTP requests. In this article, we'll walk you through how to use Postman to send XML data.

What is XML Data?

XML data is data represented in XML (eXtensible Markup Language) format. XML has a hierarchical structure and represents data using tags and elements. It is commonly used as a data format for data provided by APIs and for specifying the format of API requests and responses.

Example of XML Data

Here is a simple example of the structure of XML data used in APIs:

<root>
  <person>
    <name>John Doe</name>
    <age>30</age>
    <email>john.doe@example.com</email>
  </person>
  <person>
    <name>Jane Smith</name>
    <age>25</age>
    <email>jane.smith@example.com</email>
  </person>
</root>

In this example, rootis the root element, and personthe elements represent multiple person information. Each personelement has elements such as name, ageand emailso on, each of which represents individual data.

Using XML Data in APIs

API XML data is one of the common formats used for data structuring and flexible data representation. XML is used as the primary format for data exchange. It is also common to see XML as the specified data exchange format in the requirements of many industry standards.

However, in recent years the use of XML data has tended to decline as the JSON (JavaScript Object Notation) format has become more commonly used, making it lighter and easier to handle.

For Postman, sometimes POST requests require an XML request to the web service you used, but when you check the available data exchange formats you only see options for , , , and , form-dataso x-www-form-urlencodedmany rawusers binaryI'm at a loss as to how to send XML data.

What is POST Request?

A POST request is a type of HTTP request method used to send data to a server to create or update a resource. It is commonly used when submitting forms or uploading files to a web application.

An Ultimate Guide to HTTP POST Request Method
In a POST request, data is sent within the request body, allowing for the transmission of information such as form submissions, file uploads, or API interactions.

So, next, we will show you the detailed steps to send POST XML using Postman.

Sending POST XML Data Using Postman

  1. Open the Postman app and click the "+" button in the top left to create a new "HTTP Request."
HTTP Request

2. In the request creation screen, set the method to "POST" and enter the URL of the API endpoint.

POST request

3. For sending data in XML format, go to the Headers tab, enter "Content-Type" in the Key field, and set its Value to "text/xml."

xml data format

4. Switch to the Body tab, choose "raw" and "XML (text/xml)" from the dropdown, and enter your XML data. For example

for example:

<?xml version="1.0" 
encoding="UTF-8"?>
<request>
    <name>John</name>
    <age>18</age>
    <gender>male</gender>
</request>

5. Click the "Send" button to send the XML request to the specified server and receive the response.

Send request

Easier XML Data Sending with Apidog

In the above section, we explained how to send POST XML data using Postman. Sending XML data with Postman can be complex.  Next, we'll introduce you to a more efficient solution for sending XML data using Apidog.

Apidog is a powerful API design and documentation platform that offers a seamless development experience for working with XML-based APIs. With Apidog, you can easily create, edit, and visualize your XML-based API, providing a user-friendly interface to design and document your API, which is especially valuable for beginners in the XML development space.

button

Get started to access features like automatic code generation, mock server creation, and API testing, enhancing the efficiency and productivity of your XML API development process. Steps for Sending XML Data with Apidog:

Step 1. Open Apidog, access your project and create a new API.

Create an New API

Step 2. Click on "Debug" in the lower-left corner to switch to debug mode.

Debug

Step 3. Enter the endpoint URL, and select "XML" in the Body tab.

4. Input the XML data you want to send. For example:

<?xml version="1.0" 
encoding="UTF-8"?>
<request>
    <name>John</name>
    <age>18</age>
    <gender>male</gender>
</request>

5. Click the Send button to send the XML data and receive the response.

Using Apidog simplifies the process of sending XML data as you don't need to manually configure the "Content-Type" header key and value, and you can directly send XML-formatted data.

button