× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I am experimenting with QSYS2.HTTP_GET and the USPS APIs, Using Run SQL Scripts on PUB400.COM.
And I'm having a problem...

This example,taken from their web site, works in Postman, and also pasting into Firefox.

http://production.shippingapis.com/ShippingAPI.dll?API=Verify
&XML=
<AddressValidateRequest USERID="xxxxxxxxx">
<Revision>1</Revision>
<Address ID="0">
<Address1>SUITE K</Address1>
<Address2>29851 Aventura</Address2>
<City/>
<State>CA</State>
<Zip5>92688</Zip5>
<Zip4/>
</Address>
</AddressValidateRequest>

In Run SQL Scripts I thought code like below would work, but it always returns error 80040B19,
with the message "XML Syntax Error: Please check the XML request to see if it can be parsed."

values
QSYS2.HTTP_GET('http://production.shippingapis.com/ShippingAPI.dll' concat
url_encode('?API=Verify' concat
'&XML='concat
'<AddressValidateRequest USERID="xxxxxxxxx">' concat
'<Revision>1</Revision>' concat
'<Address ID="1">' concat
'<Address1></Address1>' concat
'<Address2>8 Wildwood Drive</Address2>' concat
'<City>Old Lyme</City>' concat
'<State>CT</State>' concat
'<Zip5>06371</Zip5>' concat
'<Zip4></Zip4>' concat
'</Address>' concat
'</AddressValidateRequest>'),
'{
"header":"Content-Type,text/xml",
"header":"Accept,*",
"header":"Content type,charset=UTF-8"
}'
)
;

Can anyone suggest what I'm doing wrong?

The USERID is correct, just XXXed out here.
The XML validates.
I probably don't need the headers--they don't seem to make any difference.

USPS info, if necessary:

https://www.usps.com/business/web-tools-apis/general-api-developer-guide.htm#_Toc24631955

Client Protocols

HTTP/HTTPS protocols are used for exchange of data. This is to facility passage through corporate firewalls and inclusion of multiple technologies for implementation. The simple example of this is a URL in a standard browser of the form:

http://production.shippingapis.com/ShippingAPI.dll?
API=APINAME&XML=<APINAMEREQUEST USERNAME=’your account’>
<tag>data</tag><tag1>data</tag1></APINAMEREQUEST>

https://www.usps.com/business/web-tools-apis/address-information-api.htm#_Toc39492052



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.