axios get xml code example
Example 1: send xmlhttprequest with axios
var instance = axios.create({
baseURL: 'https://some-domain.com/api/',
headers: {"X-Requested-With": "XMLHttpRequest"}
});
Example 2: post xml with axios nodejs
var xmlBodyStr = `<?xml version="1.0" encoding="UTF-8"?>
<req:KnownTrackingRequest xmlns:req="http://www.example.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.example.com
TrackingRequestKnown.xsd">
<Request>
<ServiceHeader>
<MessageTime>2002-06-25T11:28:56-08:00</MessageTime>
<MessageReference>1234567890123456789012345678</MessageReference>
<SiteID>SiteID</SiteID>
<Password>Password</Password>
</ServiceHeader>
</Request>
<LanguageCode>en</LanguageCode>
<AWBNumber>01234567890</AWBNumber>
<LevelOfDetails>LAST_CHECK_POINT_ONLY</LevelOfDetails>`;
var config = {
headers: {'Content-Type': 'text/xml'}
};
axios.post('https://POST_URL', xmlBodyStr, config);