USPS has changed their web page, and I was using an API from ZIP-Codes.com to access the USPS API, because I am not great at using this stuff. Then USPS changed their API, and ZIP-Codes.com has just changed theirs, and I have not had the chance to test ouf how either of those work. I looked at the ZIP-Codes.com info, and their developer sent an email saying that he saw that I looked at it, and asked why I had not used it. I just sent a reply that explained basically what was going on, along with the Panorama code I had been using, so maybe he will explain what I need to do. To use it, you need a key, which I had, but of course, I did not want to post it with my key, and I never got around to adding code to look for the key, which should be a permanent variable, and asking you to go get one if you do not have one.
I think the USPS API may be simpler now, but then, I am pretty simple myself! The USPS service is free, and the ZIP-Codes is free for like 2500 lookups a day, which is more than adequate for my usage.
Anyway, if anyone wants to try to get it to work, this is my code:
local vAddress1, vAddress2, vCity, vState, vZip, vQuery, rAddress1, rAddress2, rCity, rState, rZip5, rZip4, rError, rDictionary, APIKey
APIKey = “####################"
vAddress1=encodeurlquery(Parameter(1))
vAddress2=encodeurlquery(Parameter(2))
vCity=encodeurlquery(Parameter(3))
vState=encodeurlquery(Parameter(4))
vZip=encodeurlquery(Parameter(5)[1,5])
loadurl vQuery, “https://api.zip-codes.com/ZipCodesAPI.svc/1.0/ZipCodeOfAddress?address=” + vAddress1 + “&address1=” + vAddress2 + “&city=” + vCity + “&state=”+vState+“&zipcode=”+vZip+“&key=”+APIKey
rAddress1=tagdata(vQuery,‘Address2": “’,‘”,’,1)
rAddress2=tagdata(vQuery,‘Address1": “’,‘”,’,1)
rCity=tagdata(vQuery,‘City": “’,‘”,’,1)
rState=tagdata(vQuery,‘State": “’,‘”,’,1)
rZip5=tagdata(vQuery,‘Zip5": “’,‘”,’,1)
rZip4=tagdata(vQuery,‘Zip4": “’,‘”’,1)
rError=tagdata(vQuery,’ “Error”: “‘,’”',1)
rDictionary=“”
setdictionaryvalue rDictionary,“ADDRESS”,rAddress1+rAddress2
setdictionaryvalue rDictionary,“CITY”,rCity
setdictionaryvalue rDictionary,“STATE”,rState
setdictionaryvalue rDictionary,“ZIP9”,rZip5+“-”+rZip4
setdictionaryvalue rDictionary,“ERROR”,rError
//displaydata dumpdictionary(rDictionary)
setparameter 6,rDictionary