Api Calls In Progress

Phillip

Member
Is there any way to call an API and read the return in Progress? I need to call the API for SmartyStreets.com to verify an address each time our sales representatives input a new address for a customer. I'm not totally familiar with API's beyond their function/basic use so if someone could explain to me how to read the response it would be greatly appreciated. Just a basic overview. This API can function by modifying a web address string similar to below:

Code:
https://api.smartystreets.com/street-address
?street=3785+South+Las+Vegs+Av
&city=Los+Vegas
&state=NV
&auth-id=<AUTH_ID>
&auth-token=<AUTH_TOKEN>

When you run the code above, it generates a web page with all the information fields listed. I would just need to parse select information fields out to correct our DB fields.

Thanks
 

TomBascom

Curmudgeon
That looks like a REST service.

There are many ways to call such things -- the "best" way will depend on what version of Progress you have (and possibly what OS it is running on).
 

Phillip

Member
That looks like a REST service.

There are many ways to call such things -- the "best" way will depend on what version of Progress you have (and possibly what OS it is running on).

We're running Progress 9.1E in an all-Windows environment. About 95% of our PCs are on Windows 7 also.
 

TomBascom

Curmudgeon
With 9.1E you are better off not trying to use the 4gl. To use pure 4gl you would have to write socket code and that is going to be a challenge with "https" in the mix.

You would be better off interfacing to "curl". Either as an external command via os-command or via an active-x or dll. Curl is readily available: cURL - Download And, as always, google is your friend -- "curl for windows".
 

Phillip

Member
Okay, I was able to get curl running and it returns the corrected address depending on the input. My next question is what way would you recommend to grab this data and input it into various fields in an App? I can have it dump the output to a text file and parse it that way, I just wanted to make sure there wasn't a better way out there. I know the newer versions of Progress allow web services but we are stuck with 9.1E for now so I'll have to make do.

Thanks for the help everyone.
 

TheMadDBA

Active Member
Depending on the returned content you can use INPUT THROUGH and IMPORT UNFORMATTED to read each line. Assuming it is all text with carriage returns and line feeds.
 

Phillip

Member
Depending on the returned content you can use INPUT THROUGH and IMPORT UNFORMATTED to read each line. Assuming it is all text with carriage returns and line feeds.
How do I reference the command line for importing? I think I saw somewhere that you say IMPORT UNFORMATTED echo? Thanks
 
Top