showing results for - "post xml with axios nodejs"
Brady
24 May 2017
1var xmlBodyStr = `<?xml version="1.0" encoding="UTF-8"?>
2       <req:KnownTrackingRequest xmlns:req="http://www.example.com" 
3                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
4                xsi:schemaLocation="http://www.example.com
5                TrackingRequestKnown.xsd">
6         <Request>
7           <ServiceHeader>
8              <MessageTime>2002-06-25T11:28:56-08:00</MessageTime>
9              <MessageReference>1234567890123456789012345678</MessageReference>
10              <SiteID>SiteID</SiteID>
11              <Password>Password</Password>
12           </ServiceHeader>
13         </Request>
14         <LanguageCode>en</LanguageCode>
15         <AWBNumber>01234567890</AWBNumber>
16         <LevelOfDetails>LAST_CHECK_POINT_ONLY</LevelOfDetails>`;
17
18var config = {
19     headers: {'Content-Type': 'text/xml'}
20};
21
22axios.post('https://POST_URL', xmlBodyStr, config); 
23