XML (eXtensible Markup Language) is an extensible markup language that provides structured information: data, documents, configuration, and more. XML is called extensible because it does not capture the markup used in documents: you can create markup according to the needs of a specific area, limited only by the rules of XML syntax. An XML file is a simple text format that uses custom XML tags to describe the structure of a document and how it should be stored and transported.
HTTP GET is the most popular of the nine commonly used HTTP methods. GET request method is used to retrieve data from the specified URL. GET requests should only receive data and not send data to the server in the body of a GET message and should not change the server's state.
HTTP GET Request Example
GET /echo/ HTTP/1.1
Why is it important to send the Accept header in the XML request?
Your client needs to indicate what the XML expects by sending an Accept: application/xml header to receive the XML from the server. Without this header, the server may return data in a different format.
Accept Header Example
If the server returned XML in its response, it notifies the client using the Content-Type: application/xml response header.
Content-Type Response Header Example
Get XML request Example
An example of a server response to our XML GET request:
Server XML Response Example
HTTP/1.1 200 OK
Content-Type: application/xml; charset=utf-8