AwareIM 8.4. Trying to hookup the zipcode radius API from zipcodeapi.com.
Ultimately, I need to send a URL string as the request. Below in red is what the API request needs to look like:
If I send that string via the browser with my proper API key, I get a perfect json result, so my key works. I have a BO to receive the response and have set the REST object to "Write into object in Context" and the object should receive multiple zip codes and store each to the ZipCode attribute of the ReturnedZipCodes object via mapping. When I trigger the API service, it creates a single object but does not include the ZipCode attribute. I have tried putting the entire request string into the Base URL param, though the docs say not to. I have also tried putting just the zipcodeapi.com URL in the base URL param and putting the remainder in the request body as text/xml, which returns null. It seems so simple...
All thoughts appreciated.
Help me make this simple API work
Help me make this simple API work
- Attachments
-
- API Request.png (16.71 KiB) Viewed 6831 times
V8.8
MySQL, AWS EC2, S3
PDFtk Toolkit
MySQL, AWS EC2, S3
PDFtk Toolkit
Re: Help me make this simple API work
Here's some log information I found (key is redacted). So the json data is being returned, just not committed to the BO.
Calling REST URL http://www.zipcodeapi.com/rest/KEYREDAC ... 031/5/mile .Parameter string is null Body string is:null
REST Service returned:{"zip_codes":[{"zip_code":"22151","distance":4.733,"city":"Springfield","state":"VA"},{"zip_code":"22032","distance":3.188,"city":"Fairfax","state":"VA"},{"zip_code":"22003","distance":3.159,"city":"Annandale","state":"VA"},{"zip_code":"22030","distance":4.57,"city":"Fairfax","state":"VA"},{"zip_code":"22034","distance":1.689,"city":"Fairfax","state":"VA"},{"zip_code":"22036","distance":1.689,"city":"Fairfax","state":"VA"},{"zip_code":"22037","distance":1.689,"city":"Fairfax","state":"VA"},{"zip_code":"22038","distance":1.689,"city":"Fairfax","state":"VA"},{"zip_code":"22031","distance":0,"city":"Fairfax","state":"VA"},{"zip_code":"22047","distance":2.19,"city":"Falls Church","state":"VA"},{"zip_code":"22042","distance":3.448,"city":"Falls Church","state":"VA"},{"zip_code":"22081","distance":1.347,"city":"Merrifield","state":"VA"},{"zip_code":"22082","distance":1.347,"city":"Merrifield","state":"VA"},{"zip_code":"22116","distance":1.347,"city":"Merrifield","state":"VA"},{"zip_code":"22118","distance":1.347,"city":"Merrifield","state":"VA"},{"zip_code":"22119","distance":1.347,"city":"Merrifield","state":"VA"},{"zip_code":"22120","distance":2.318,"city":"Merrifield","state":"VA"},{"zip_code":"22185","distance":2.582,"city":"Vienna","state":"VA"},{"zip_code":"22046","distance":4.685,"city":"Falls Church","state":"VA"},{"zip_code":"22027","distance":3.19,"city":"Dunn Loring","state":"VA"},{"zip_code":"22180","distance":2.534,"city":"Vienna","state":"VA"},{"zip_code":"22124","distance":4.581,"city":"Oakton","state":"VA"},{"zip_code":"22183","distance":2.839,"city":"Vienna","state":"VA"},{"zip_code":"22184","distance":2.839,"city":"Vienna","state":"VA"},{"zip_code":"22043","distance":4.53,"city":"Falls Church","state":"VA"},{"zip_code":"22181","distance":3.736,"city":"Vienna","state":"VA"}]}
FAULT: ERROR: org.openadaptor.adaptor.jms.JMSSink - txnCommit() failed with JMS Queue/Topic PublishException: org.openadaptor.adaptor.jms.PublishException: org.openadaptor.adaptor.jms.JMSPublisher - commit() called when not initialized
ERROR: transaction commit failed (will call rollback) , ERROR: org.openadaptor.adaptor.jms.JMSSink - txnCommit() failed with JMS Queue/Topic PublishException: org.openadaptor.adaptor.jms.PublishException: org.openadaptor.adaptor.jms.JMSPublisher - commit() called when not initialized
Calling REST URL http://www.zipcodeapi.com/rest/KEYREDAC ... 031/5/mile .Parameter string is null Body string is:null
REST Service returned:{"zip_codes":[{"zip_code":"22151","distance":4.733,"city":"Springfield","state":"VA"},{"zip_code":"22032","distance":3.188,"city":"Fairfax","state":"VA"},{"zip_code":"22003","distance":3.159,"city":"Annandale","state":"VA"},{"zip_code":"22030","distance":4.57,"city":"Fairfax","state":"VA"},{"zip_code":"22034","distance":1.689,"city":"Fairfax","state":"VA"},{"zip_code":"22036","distance":1.689,"city":"Fairfax","state":"VA"},{"zip_code":"22037","distance":1.689,"city":"Fairfax","state":"VA"},{"zip_code":"22038","distance":1.689,"city":"Fairfax","state":"VA"},{"zip_code":"22031","distance":0,"city":"Fairfax","state":"VA"},{"zip_code":"22047","distance":2.19,"city":"Falls Church","state":"VA"},{"zip_code":"22042","distance":3.448,"city":"Falls Church","state":"VA"},{"zip_code":"22081","distance":1.347,"city":"Merrifield","state":"VA"},{"zip_code":"22082","distance":1.347,"city":"Merrifield","state":"VA"},{"zip_code":"22116","distance":1.347,"city":"Merrifield","state":"VA"},{"zip_code":"22118","distance":1.347,"city":"Merrifield","state":"VA"},{"zip_code":"22119","distance":1.347,"city":"Merrifield","state":"VA"},{"zip_code":"22120","distance":2.318,"city":"Merrifield","state":"VA"},{"zip_code":"22185","distance":2.582,"city":"Vienna","state":"VA"},{"zip_code":"22046","distance":4.685,"city":"Falls Church","state":"VA"},{"zip_code":"22027","distance":3.19,"city":"Dunn Loring","state":"VA"},{"zip_code":"22180","distance":2.534,"city":"Vienna","state":"VA"},{"zip_code":"22124","distance":4.581,"city":"Oakton","state":"VA"},{"zip_code":"22183","distance":2.839,"city":"Vienna","state":"VA"},{"zip_code":"22184","distance":2.839,"city":"Vienna","state":"VA"},{"zip_code":"22043","distance":4.53,"city":"Falls Church","state":"VA"},{"zip_code":"22181","distance":3.736,"city":"Vienna","state":"VA"}]}
FAULT: ERROR: org.openadaptor.adaptor.jms.JMSSink - txnCommit() failed with JMS Queue/Topic PublishException: org.openadaptor.adaptor.jms.PublishException: org.openadaptor.adaptor.jms.JMSPublisher - commit() called when not initialized
ERROR: transaction commit failed (will call rollback) , ERROR: org.openadaptor.adaptor.jms.JMSSink - txnCommit() failed with JMS Queue/Topic PublishException: org.openadaptor.adaptor.jms.PublishException: org.openadaptor.adaptor.jms.JMSPublisher - commit() called when not initialized
V8.8
MySQL, AWS EC2, S3
PDFtk Toolkit
MySQL, AWS EC2, S3
PDFtk Toolkit
Re: Help me make this simple API work
So the issue is usually the Aware bo structure.
Please post a screen shot of the bo fields
Please post a screen shot of the bo fields
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
Re: Help me make this simple API work
Here is the BO that receives the Zip Codes. It's called ReturnedZipCodes. Also a shot of the mapping screen for the Reply.
- Attachments
-
- ReturnedZipCodes.png (8.87 KiB) Viewed 6823 times
-
- ZipCode BO.png (47.31 KiB) Viewed 6823 times
V8.8
MySQL, AWS EC2, S3
PDFtk Toolkit
MySQL, AWS EC2, S3
PDFtk Toolkit
Re: Help me make this simple API work
simple
its all in the structure
i was going to do more, but dont have the time.
you dont really need the form... or need to run this.
the key are the TWO BOs needed to store the result
those zips on the form are not used.
am using the hardcoded Base URL in the REST as you did
j
its all in the structure
i was going to do more, but dont have the time.
you dont really need the form... or need to run this.
the key are the TWO BOs needed to store the result
those zips on the form are not used.
am using the hardcoded Base URL in the REST as you did
j
- Attachments
-
- zipcodes.zip
- (40.14 KiB) Downloaded 669 times
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
Re: Help me make this simple API work
Take a look at this [hypothetical] JSON reply:
Its easy to see that the "header" record contains 4 fields... and then the "child" recs (from the array).
So if you were to build BOs for this, you would have succeeded first try (most likely).
But the ZipCode reply fools you because it doesn't look like there are any "header" fields - and there aren't really, which is why you'd want to have only 1 file for the reply.
Code: Select all
{
"AnalysisID": "101",
"Confidence": "99",
"NumZips": 4,
"zip_codes": [
{
"zip_code": "22151",
"distance": 4.733,
"city": "Springfield",
"state": "VA"
},
{
"zip_code": "22032",
"distance": 3.188,
"city": "Fairfax",
"state": "VA"
},
{
"zip_code": "22003",
"distance": 3.159,
"city": "Annandale",
"state": "VA"
},
{
"zip_code": "22030",
"distance": 4.57,
"city": "Fairfax",
"state": "VA"
}
]
}
So if you were to build BOs for this, you would have succeeded first try (most likely).
But the ZipCode reply fools you because it doesn't look like there are any "header" fields - and there aren't really, which is why you'd want to have only 1 file for the reply.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL