Horacio Posted June 27, 2008 Posted June 27, 2008 (edited) I'm looking at the USPS's Web Tools™ API for address standardization and it seems a pretty straight forward XML request response loop but as I'm a lazy guy I'm wondering if anyone else had done this already? Given that I've never seen the solution out there, what sort of pitfalls might I get trying to implement it in FM? Thanks Oh, for those who might be interested the details can be found at: USPS Web Tool APIs Edited June 27, 2008 by Guest add url
Lee Smith Posted June 27, 2008 Posted June 27, 2008 Did you look in the example file folder that came with FileMaker's Application Folder. There is an example of this there? There also examples at Databasepros.com Briandunning.com filemakermagazine.com and you might do a search of http://searchfilemaker.com/ for Web Viewer and you might pull up a couple of more. HTH Lee
iMarcW Posted June 28, 2008 Posted June 28, 2008 The FileMaker WebViewer example shows how to do UPS tracking, and Brian Dunning's site sells zip code databases that use latitude and longitude to calculate distances, etc., but the only tool I found like what Horatio was talking about (via searchfilemaker.com--like that site) was the USPS Verify BlackBox tool from DataIsland.com. It seems to be reasonably priced, though it requires the Troi URL plugin. I tried signing up to access the USPS API once, and the site told me it couldn't be used (at least not by me) for any type of address verification or data processing, after making me register and specify what I wanted to use it for from a list of choices. Maybe they have loosened their restrictions since then. At some point, I will probably look into the DataIsland software or get one of the raw zip code files from Brian Dunning's site (via Zipwise.com). Any other ideas?
Lee Smith Posted June 28, 2008 Posted June 28, 2008 There are several things at Brian Dunning's Site, including the Custom Function Library, and some Web View Examples. In the Web View Examples, there is at least one for DHL, USPS, UPS, along with some for Geocoding Lee
Fenton Posted June 28, 2008 Posted June 28, 2008 The attached example file has 3 different methods. The first came from someone else's file. I cannot remember who, so please take credit if it was yours. The file itself did not say who it was. 1. Web Viewer method, using (longish) FileMaker script to parse out the data. 2. zippShell method; similar to above, but using zippShell and curl to get the data. Windows users could use curl, or substitute wget instead. It uses the same FileMaker script method to parse the data. 3. My own method; uses AppleScript and curl to to get the data. Uses AppleScript running do shell scripts command line to parse the data. It is the fastest. 4. I haven't see the USPS xml commands yet. That would likely be the best method. The parsing seems to be fairly fast, and a stable structure; but I'd prefer xml. I'll have to check that out. (The file is just the lightweight verify the address, nothing fancy.) [P.S. I changed the file slightly. I used the "strings" command to remove blank lines that curl returned, in the AppleScript method. It makes the parsing more reliable.] [1/23/2011 Modified original file to use 'printf' instead of 'echo', as the '-n' option is mostly unsupported on Macs anymore.] USPS AddressVerify_fej.fp7.zip
iMarcW Posted June 28, 2008 Posted June 28, 2008 Wow. Nice work. I don't know about Horacio, but this is all I would ever need. And it gets the info straight from the USPS site, not through a third-party web service that might not be around forever.
aholtzapfel Posted June 28, 2008 Posted June 28, 2008 WebViewer Example was mine. This works well most of the time but will fail to standardize the address if more than one result is returned.
Fenton Posted June 28, 2008 Posted June 28, 2008 I changed the file slightly. I used the "strings" command to remove blank lines that curl returned, in the AppleScript method. It makes the parsing more reliable. And put your name on your method :-]
Horacio Posted July 1, 2008 Author Posted July 1, 2008 Excellent! This aprses the jsp version of the USPS adress validator. And certainly works well enough. I was interested in how to approach the USPS xml request response APIs but it would seem there are some "usage agreement" issues so this works well enough, in fact it works which is way better than the xml approach. I'm going to play with this solution for the moment and explore the API's later Thanks again!!!
Fenton Posted July 1, 2008 Posted July 1, 2008 (edited) Yeah, I looked at the xml. My first impression was, wow, this looks simple, this is the way to go. Then, when I applied for "permission" to use it to standardize database records, they wrote back that permission was denied, but I could buy it on CDs for $3,800 a year. Edited July 1, 2008 by Guest Removed seditious propaganda
iMarcW Posted July 2, 2008 Posted July 2, 2008 I'm glad it wasn't just me who was miffed by their policies and the way they made them known. The form I filled out had several options related to standardization, only to have them come back and say, in so many words, "you'd like to do that, huh? Well, you can't. And now we know where you live if you try to do it anyway."
aholtzapfel Posted September 15, 2008 Posted September 15, 2008 FYI: The County information provided by USPS.com is NOT 100% accurate. (I have had several instances that this has caused me problems.)
Newbies GulfCoastShots Posted September 8, 2010 Newbies Posted September 8, 2010 Novice here -- sort of. Was a DBA years ago so have a solid grasp of concepts, but very rusty skills and getting back into the swing of things. Trying to scrub the addresses from customer orders prior to shipping via USPS, and like the AppleScript version of this. Problem is, I'm not sure how to move what's here over into my environment. I can run the table and its set of all three types of scripts fine, but when I try and move over the GetAddressAS script, there are glitches. Anyone feel like pointing an eager learning at a good primer on whatever it is I'm trying to do is even called? Import a script? Integrate an external table? I have my own address block, and want to add a button that does what the "Validate" button does on this one?
Newbies fmuzer Posted January 23, 2011 Newbies Posted January 23, 2011 The attached example file has 3 different methods. The first came from someone else's file. I cannot remember who, so please take credit if it was yours. The file itself did not say who it was. 1. Web Viewer method, using (longish) FileMaker script to parse out the data. 2. zippShell method; similar to above, but using zippShell and curl to get the data. Windows users could use curl, or substitute wget instead. It uses the same FileMaker script method to parse the data. 3. My own method; uses AppleScript and curl to to get the data. Uses AppleScript running do shell scripts command line to parse the data. It is the fastest. 4. I haven't see the USPS xml commands yet. That would likely be the best method. The parsing seems to be fairly fast, and a stable structure; but I'd prefer xml. I'll have to check that out. (The file is just the lightweight verify the address, nothing fancy.) [P.S. I changed the file slightly. I used the "strings" command to remove blank lines that curl returned, in the AppleScript method. It makes the parsing more reliable. And put your name on your method <img src='http://fmforums.com/forum/public/style_emoticons/<#EMO_DIR#>/biggrin.gif' class='bbc_emoticon' alt=':' />-] Thank you very much for this file. It is very helpful. However the Apple Script method seems to break and it returns "-n" in the State and City and Zip fields. I'm using FMPA 11 and Snowleopard.
bruceR Posted January 23, 2011 Posted January 23, 2011 Thank you very much for this file. It is very helpful. However the Apple Script method seems to break and it returns "-n" in the State and City and Zip fields. I'm using FMPA 11 and Snowleopard. Modified Fenton's version, stripped -n flag and added some error checks to other calcs. Works for me in FM11A/Snow Leopard. From man page for echo: Some shells may provide a builtin echo command which is similar or identical to this utility. Most notably, the builtin echo in sh(1) does not accept the -n option. Consult the builtin(1) manual page. USPS AddressVerify_fej_bfr.fp7.zip
Newbies fmuzer Posted January 23, 2011 Newbies Posted January 23, 2011 Thank you! No more problems with this file.
Recommended Posts
This topic is 5055 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now