Postman Tutorial Part 52 – How To Send Parameterized XML Payload In Postman

As a part of Postman Tutorial – End to End , in this post, we will learn how can we send a XML payload and parameterized XML payload to request in Postman.

We can pass payload to a request in multiple ways. Sending XML payload is one of them. We also learnt how can we send a JSON and JSON with variables i.e. Parameterized JSON payload to a request.

Example API for Demo :-

We will be going to use RestFul-Booker Create Booking API for Demo. Create Booking API accepts JSON and XML payloads. We will create a booking by passing XML payload in Postman.

We can see header details and example request body in API documentation:-

Note :- We need to pass a header named “Content-Type” as “text/xml“. It is not supporting “application/xml“. In all latest APIs , you will see ” application/xml “. ” text/xml ” is superior of ” application/xml “.

Let’s start :-

Pass Create Booking API to URI section and add “Context-Type” header in Postman :-

Pass request body as XML :-

Click on Send button, and you will see a booking created.

So above are simple steps to pass a XML payload to request.

You can see we have passed all hard coded values in payload which is not always a good option. We can parameterized XML payload to pass values dynamically and achieve data driven as well.

Passing variables in XML payalod is same as we use variables at different places in Postman i.e. {{variableName}}. Let’s see this in action.

I will create an environment “Data Booking” in Postman and put all required values there and will use those variables in payload.

Let’s put variable names in XML payload as below:-

Select created environment file and hit “Send” key:-

Simple. It is similar to passing variables in JSON payload.

If you would like to see response in XML, set a header named “Accept” and set it as “application/xml”.

Hit the Send button and by default you will see response in XML :-

We will see extracting values from XML response in upcoming posts.

You can import example collection from here.

If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.

You can find all Selenium related post here.
You can find all API manual and automation related posts here.
You can find frequently asked Java Programs here.

1 thought on “Postman Tutorial Part 52 – How To Send Parameterized XML Payload In Postman

  1. This was nice.. The way you cover every part of the tool is awesome like the small beautify feature sitting at the corner.

    Covering XML part which covers the content-type and accept part

Leave a Reply

Your email address will not be published. Required fields are marked *