[CLOSED] the OLD Official v8.1 REST thread - examples, ...]

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
Jaymer
Posts: 2455
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

[CLOSED] the OLD Official v8.1 REST thread - examples, ...]

Post by Jaymer »

Lets test the new 8.1 REST functions - help share your knowledge with the "rest" of us.

EDITED: I'm going to start a new post. Lots of this was due to buggy REST implementation. Not worth reading thru.
Last edited by Jaymer on Fri Apr 20, 2018 1:28 am, edited 2 times in total.
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
Posts: 2455
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: the Official v8.1 REST thread - examples, services, etc.

Post by Jaymer »

Trying to follow some examples on this page:
https://www.soapui.org/rest-testing/get ... arted.html

Getting this error setting up a REST Intelligent Object
Screen Shot 2018-03-07 at 5.41.35 PM.png
Screen Shot 2018-03-07 at 5.41.35 PM.png (38.56 KiB) Viewed 28631 times
1) Is questionable what to use for the "BASE URL"
http://maps.googleapis.com/maps/api/geocode/xml OR
http://maps.googleapis.com/
(and with or without trailing "/" does it matter?)

2) From the pic, I used this as the parameter string:
?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false
(is it supposed to have the "?" in front?)

Seems pretty basic - just no idea how to get this to work.
Downloaded that Soap program from them and got a result within 5 minutes.
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
BenHayat
Posts: 2749
Joined: Thu Dec 23, 2010 5:48 am
Location: Fla, USA
Contact:

Re: the Official v8.1 REST thread - examples, services, etc.

Post by BenHayat »

Unfortunately, the documentation is very nil on this new feature, so I don't know how support expects us to test a NEW feature with almost no guidelines and examples.

I searched all the documents under "REST" word and most of the stuff I found were either old or words that had "REST" in it.
Jaymer
Posts: 2455
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: the Official v8.1 REST thread - examples, services, etc.

Post by Jaymer »

I keep getting the "Singleton" error - I don't know what to do.
I was getting stopped just by trying to add 1 service - there's a lot more complicated screen once you get to OAUTH.

Since there is a pulldown of OAUTH examples, and none of it makes much sense, I'm now onto my 3rd test.
I'm trying TRELLO, since I had an account.
(I didn't want to screw around with my facebook, twitter, etc. account that I regularly use).

I got my TRELLO API KEY and followed their docs to get the secret.
Then, according to the UserGuide, you need to have a LIRU and SystemSettings field to accept the return key.

but even after doing all that, I still get a SINGLETON error when saving.
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
Posts: 2455
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: the Official v8.1 REST thread - examples, services, etc.

Post by Jaymer »

BenHayat wrote:Unfortunately, the documentation is very nil on this new feature, so I don't know how support expects us to test a NEW feature with almost no guidelines and examples.
Well, thats the purpose of THIS thread. Hopefully, Vlad or someone else can post here and we can move forward with focused examples.
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
customaware
Posts: 2405
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Re: the Official v8.1 REST thread - examples, services, etc.

Post by customaware »

+1000
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
PointsWell
Posts: 1460
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: the Official v8.1 REST thread - examples, services, etc.

Post by PointsWell »

The Singleton message is not an error it is a nota bene reminder that you can only have one instance of the BO when running.

What I have done is prefaced the calling of the service with a process step IF NOT EXISTS THEN CREATE.

Also I don't think your parameters don't need a ? in them, that is added when the two are brought together.

What I have been doing so far is to create a BO that is just parameters ServiceName.Parameters

Then I parse the parameters into that and set that as the REST Service Parameters

I've been practicing with the OpenWeather API
api.openweathermap.org/data/2.5/weather?q=London,uk

So the parameters BO looks like this, where CITY is a BO and the Key for the API is kept in SystemSettings

Code: Select all

CREATE tWeather WITH tWeather.Parameter='q='+City.Name+','+City.Country+SystemSettings.KeyWeather
It has been working successfully to submit the request and I get a result back but haven't worked out the JSON to put it back into the CITY BO.

From the Server Output:

Code: Select all

Calling REST URL http://api.openweathermap.org/data/2.5/weather?q=London,Uk&APPID=KEYREDACTED  .Parameter string is q=London,Uk&APPID=KEYREDACTED
REST Service returned:{"coord":{"lon":-0.13,"lat":51.51},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"base":"stations","main":{"temp":278.55,"pressure":992,"humidity":86,"temp_min":277.15,"temp_max":280.15},"visibility":10000,"wind":{"speed":6.7,"deg":250},"clouds":{"all":20},"dt":1520490300,"sys":{"type":1,"id":5168,"message":0.0091,"country":"GB","sunrise":1520490598,"sunset":1520531603},"id":2643743,"name":"London","cod":200}
UnionSystems
Posts: 197
Joined: Fri Jun 17, 2016 7:10 am
Location: Brisbane Australia
Contact:

Re: the Official v8.1 REST thread - examples, services, etc.

Post by UnionSystems »

Sean, page 167 of 8.1 User Guide says AwareIM will parse the reply.

Code: Select all

For JSON and XML replies you can get Aware IM to automatically parse the contents of the reply into attributes of some object.  Aware IM will create a new instance of such object and populate its attributes from the values of the corresponding fields in the reply. By default Aware IM will try to find an attribute with exactly the same name as in the JSON/XML attribute definition, but you can also provide your own mapping between names in JSON/XML and the corresponding Aware IM attribute names.
AWS Linux, Windows Server, AIM 8.4 & 8.6
PointsWell
Posts: 1460
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: the Official v8.1 REST thread - examples, services, etc.

Post by PointsWell »

Yeah I have it going into some BOs now, but I am getting a random error that I don't understand

So JSON goes into:

Weather:
Weather.coords
Weather.main
Weather.weather

WeatherCoords:
WeatherCoords.lat
WeatherCoords.lon

WeatherMain:
WeatherMain.temp
WeatherMain.temp_min
WeatherMain.temp_max

Etc etc
But the server console is showing an Queue error

Code: Select all

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
But the data is there
PointsWell
Posts: 1460
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: the Official v8.1 REST thread - examples, services, etc.

Post by PointsWell »

So I've got my first REST call to work.

I've posted the BSV and some instructions at https://www.awareim.com/forum/viewtopic ... 511#p46511
Jaymer
Posts: 2455
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: the Official v8.1 REST thread - examples, services, etc.

Post by Jaymer »

Problems with OAuth REST calls

I tried TRELLO, with no luck, then Yahoo.
Initially, I was getting this error:
Screen Shot 2018-03-08 at 9.50.57 PM.png
Screen Shot 2018-03-08 at 9.50.57 PM.png (17.39 KiB) Viewed 28548 times
but thats no longer an issue.

I get a reply from Yahoo saying its not happy with OAuth.
Turns out that this [Aware included] setup string to get a Request Token is not valid.
Screen Shot 2018-03-08 at 10.20.09 PM.png
Screen Shot 2018-03-08 at 10.20.09 PM.png (27.15 KiB) Viewed 28548 times
There is a mysterious double quote at the end, PLUS the URL says its moved or outdated.
So there's no way for the AIM mechanism to get authorized.
Will have to dig around to try and find what that call is supposed to be.
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
PointsWell
Posts: 1460
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: the Official v8.1 REST thread - examples, services, etc.

Post by PointsWell »

Jaymer
Posts: 2455
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: the Official v8.1 REST thread - examples, services, etc.

Post by Jaymer »

Given that the Yahoo API URL was incorrect, I went back to Trello.
I get a response now... but its a parser error.
And in the Tomcat output window, this:
Screen Shot 2018-03-08 at 10.51.41 PM.png
Screen Shot 2018-03-08 at 10.51.41 PM.png (100.09 KiB) Viewed 28545 times
So after 3 hours down the drain tonight, I'm going to bed.
Sean got his Weather example to work, but it didn't use any OAuth.
We will crack the code eventually.
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
Posts: 2455
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: the Official v8.1 REST thread - examples, services, etc.

Post by Jaymer »

THREAD CLOSED
See new topic: https://www.awareim.com/forum/viewtopic ... 874#p46874

Lots of this was due to buggy REST implementation. Not worth reading thru.
Last edited by Jaymer on Fri Apr 20, 2018 1:27 am, edited 1 time in total.
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
BenHayat
Posts: 2749
Joined: Thu Dec 23, 2010 5:48 am
Location: Fla, USA
Contact:

Re: the Official v8.1 REST thread - examples, services, etc.

Post by BenHayat »

Just put a [CLOSED] in front of the title.
Post Reply