0 Replies Latest reply on Oct 26, 2018 11:48 AM by John Wilson

    API call using URL action

    John Wilson

      I have been trying to set up an API call to the USPS to lookup zip +4 for a selected address in a tableau worksheet. the API looks like this:

       

      http://production.shippingapis.com/ShippingAPITest.dll?API=Verify &XML=<AddressValidateRequest USERID="651NORTH0110"><Address ID="0"><Address1></Address1> <Address2>6406 Ivy Lane</Address2><City>Greenbelt</City><State>MD</State> <Zip5></Zip5><Zip4></Zip4></Address></AddressValidateRequest>

       

      Several issues have come up. when tableau looks at the url string it sees anything in the <> brackets as a field that is to be inserted so it does not work

      I have created a table with each of these fields ie: Zip5, /Zip5, State, /State etc so tableau will allow them to be in the string but when it sends the url command the http looks like this:

      http://production.shippingapis.com/ShippingAPITest.dll?API=Verify%20&XML=AddressValidateRequest%20USERID%3D%22651NORTH0110%22Address%20ID%3D%220%22Address1%2FAddress1%20Address26406%20Ivy%20Lane%2FAddress2CityGreenbelt%2FCityStateMD%2FState%20Zip5%2FZip5Zip4%2FZip4%2FAddress%2FAddressValidateRequest

       

      I get a format error as follows

      <?xml version="1.0" encoding="UTF-8"?>

      -<Error>

      <Number>80040B19</Number>

      <Description>XML Syntax Error: Please check the XML request to see if it can be parsed.</Description>

      <Source>USPSCOM::DoAuth</Source>

      </Error>

       

      It is not sending the <> characters, instead it is replacing them %2F

       

      IS this possible or is there a better way?

      BTW i dont have the WEB API plugin

      Thanks