I send a request to a site to obtain the 3 nearest aviation weather stations to a specific location, providing the long/lat co-ordinates and my api key.
I get the results back BUT, I'm not populating the BO Records for some reason that I can't fathom. I know the results are correct because the specific location is my home airfield which is not itself a reporting weather station
So clearly my BO structure must be wrong but from the video tutorial, I can't figure out what I'm doing wrong
This is the returned data from the server logs. (Actually - this is just one of the three returned stations
REST Service returned:
[
{"station{
"city":"Manchester",
"country":"GB",
"elevation_ft":257,
"elevation_m":78,
"iata":"MAN",
"icao":"EGCC",
"latitude":53.35369873046875,
"longitude":-2.2749500274658203,
"name":"Manchester Airport",
"note":"Ringway Airport, RAF Ringway","reporting":true,
"runways":[
{"length_ft":10007,"width_ft":148,"ident1":"05R","ident2":"23L"},{"length_ft":10000,"width_ft":148,"ident1":"05L","ident2":"23R"}
],
"state":"ENG",
"type":"large_airport",
"website":"http://www.manchesterairport.co.uk/",
"wiki":"https://en.wikipedia.org/wiki/Manchester_Airport"
},
"coordinate_distance":0.5566678650945238,
"nautical_miles":20.06989913050994,
"miles":23.0960274432964,
"kilometers":37.169453189704406}
]
I have a BO called Airports and a BO called WeatherStations. The "runways" array is ignored. The only items that get written are the last 4 items which are at the outermost level of the data and written into "Airports".
Airports has a reference attrinute called Station which refers to WeatherStations. WeatherStations holds all the other attributes - but WeatherStations never get created.
SOLVED * REST BO Structure help
SOLVED * REST BO Structure help
Last edited by rocketman on Wed Apr 29, 2020 3:36 pm, edited 1 time in total.
Rocketman
V8.7 Developer Edition. Server 2016 Standard edition. MySql 5.5
V8.7 Developer Edition. Server 2016 Standard edition. MySql 5.5
Re: REST BO Structure help
The Dr. is in:
Diagnosis:
1) what you have posted isn't valid JSON
2) "station" (from the buggy JSON) isn't the same as "Station" from your post, so its impossible to tell if your error is due to typos.
RX:
1) Post screenshots of the Attributes table from all relevant BOs
2) Post correct JSON
3) Inject yourself with Lysol, and call me in the morning
Diagnosis:
1) what you have posted isn't valid JSON
2) "station" (from the buggy JSON) isn't the same as "Station" from your post, so its impossible to tell if your error is due to typos.
RX:
1) Post screenshots of the Attributes table from all relevant BOs
2) Post correct JSON
3) Inject yourself with Lysol, and call me in the morning
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: REST BO Structure help
Like Jaymer siad, the JSON is not valid.
If I'm not mistaken on the structure, the JSON should look like this.
Validate JSON: https://jsonformatter.curiousconcept.com/
I think your Airports BO used to capture the reply should have a reference attribute "station" to BO WeatherStations and WeatherStations should have a ref attribute 'runways'.
If I'm not mistaken on the structure, the JSON should look like this.
Code: Select all
[
{
"station":
{
"city": "Manchester",
"country": "GB",
"elevation_ft": 257,
"elevation_m": 78,
"iata": "MAN",
"icao": "EGCC",
"latitude": 53.35369873046875,
"longitude": -2.2749500274658203,
"name": "Manchester Airport",
"note": "Ringway Airport, RAF Ringway",
"reporting": true,
"runways": [
{
"length_ft":10007,"width_ft":148,"ident1":"05R","ident2":"23L"
},
{
"length_ft":10000,"width_ft":148,"ident1":"05L","ident2":"23R"
}
],
"state": "ENG",
"type": "large_airport",
"website": "http://www.manchesterairport.co.uk/",
"wiki": "https://en.wikipedia.org/wiki/Manchester_Airport"
}
},
{
"coordinate_distance": 0.5566678650945238,
"nautical_miles": 20.06989913050994,
"miles": 23.0960274432964,
"kilometers": 37.169453189704406
}
]
I think your Airports BO used to capture the reply should have a reference attribute "station" to BO WeatherStations and WeatherStations should have a ref attribute 'runways'.
Re: REST BO Structure help
Jeez - you'd think life would be easy in the 21st century. How do you paste a simple screenshot into a post. Do I have to turn the facility on somewhere? - and how do you get those scrolling windows in?
Sorry to be a pain guys.
PS ... No Lysol - I've stuck a UV light where the sun doesn't normally gain access
Sorry to be a pain guys.
PS ... No Lysol - I've stuck a UV light where the sun doesn't normally gain access
Rocketman
V8.7 Developer Edition. Server 2016 Standard edition. MySql 5.5
V8.7 Developer Edition. Server 2016 Standard edition. MySql 5.5
Re: REST BO Structure help
Well, you might be almost there if you just fix the station<>Station issue.
I read this late last night. But with fresh eyes, that might be your only issue.
It’s case sensitive.
I read this late last night. But with fresh eyes, that might be your only issue.
It’s case sensitive.
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: REST BO Structure help
Nope - still the same. I dropped the JSON return into that validator link that Rennur posted and it came back valid.
Since I can't seem to drop screenshots into here, I've attached a PDF with everything in.
Thanks for looking at it
WTF!!! I can't even attach a PDF??? ... tears hair out in frustration. This has got to be the worse bulletin board on the planet!!
More tha one way to skin a cat - try https://1drv.ms/b/s!AmlhuKdaEBz0i6UWY0k ... g?e=jq0TZS
Since I can't seem to drop screenshots into here, I've attached a PDF with everything in.
Thanks for looking at it
WTF!!! I can't even attach a PDF??? ... tears hair out in frustration. This has got to be the worse bulletin board on the planet!!
More tha one way to skin a cat - try https://1drv.ms/b/s!AmlhuKdaEBz0i6UWY0k ... g?e=jq0TZS
Rocketman
V8.7 Developer Edition. Server 2016 Standard edition. MySql 5.5
V8.7 Developer Edition. Server 2016 Standard edition. MySql 5.5
Re: REST BO Structure help
The reporting attribute of Weatherstation is not Plain Text (there are no quotes around true). Try changing the type for reporting to Yes/No .
Bob
Re: REST BO Structure help
Thanks Bob, I’ll try that later.
So I’m guessing from all this that we are just not seeing the kind of error messages we’d either see on screen or in the log viewer
Is there any other way of hunting these things down? Must confess i’ve Never really dived into json
So I’m guessing from all this that we are just not seeing the kind of error messages we’d either see on screen or in the log viewer
Is there any other way of hunting these things down? Must confess i’ve Never really dived into json
Rocketman
V8.7 Developer Edition. Server 2016 Standard edition. MySql 5.5
V8.7 Developer Edition. Server 2016 Standard edition. MySql 5.5
Re: REST BO Structure help
Well, - nothing has worked so far. What might be interesting is whichever BO I try to put the results in, it always generates three records. Apart from "Airports" they are always empty and at no time does it create any referenced attribute records
Will try again tomorrow
Will try again tomorrow
Rocketman
V8.7 Developer Edition. Server 2016 Standard edition. MySql 5.5
V8.7 Developer Edition. Server 2016 Standard edition. MySql 5.5
-
- Posts: 1457
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: REST BO Structure help
What is your field mappingrocketman wrote:Well, - nothing has worked so far. What might be interesting is whichever BO I try to put the results in, it always generates three records. Apart from "Airports" they are always empty and at no time does it create any referenced attribute records
Will try again tomorrow
Re: REST BO Structure help
Actually, curiosity got the better of me so supplies of midnight oil are now on the low side.
Wondering whether there are too many nested layers that AIM can't cope with (the whole thing is bounded by [ ]
So we have three mains and nested in each we have station and in each of the stations there are multiple runways.
Tonight I successfully requested the METAR (Meteorological Terminal Aviation Routine Weather Report) for a single station (no [ ] bounding brackets) the single report had several subsections but only a single layer down - if that makes sense. - COMPLETE SUCCESS
So we have:
STATION INFO
some primitives
Multiple Cloud Layers info
Multiple Wind Speed layers info
Multiple wind direction layers info
Anyone successfully handled complex multiple records and subs within subs? It would be good to get "Nearest Stations" working properly since the workaround - whilst do-able - is going to be a of a pain in the ****
Wondering whether there are too many nested layers that AIM can't cope with (the whole thing is bounded by [ ]
So we have three mains and nested in each we have station and in each of the stations there are multiple runways.
Tonight I successfully requested the METAR (Meteorological Terminal Aviation Routine Weather Report) for a single station (no [ ] bounding brackets) the single report had several subsections but only a single layer down - if that makes sense. - COMPLETE SUCCESS
So we have:
STATION INFO
some primitives
Multiple Cloud Layers info
Multiple Wind Speed layers info
Multiple wind direction layers info
Anyone successfully handled complex multiple records and subs within subs? It would be good to get "Nearest Stations" working properly since the workaround - whilst do-able - is going to be a of a pain in the ****
Rocketman
V8.7 Developer Edition. Server 2016 Standard edition. MySql 5.5
V8.7 Developer Edition. Server 2016 Standard edition. MySql 5.5
Re: REST BO Structure help
What is your field mapping
There are no field mappings. All BO attributes are identical to the json incoming
[/quote]There are no field mappings. All BO attributes are identical to the json incoming
Rocketman
V8.7 Developer Edition. Server 2016 Standard edition. MySql 5.5
V8.7 Developer Edition. Server 2016 Standard edition. MySql 5.5
-
- Posts: 1457
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: REST BO Structure help
Hmm I wonder if it is getting confused by not having a root BO with the multiple responses. Not having looked at REST since I tested the Weather API it may be that it is expecting one response, that response potentially being multiples nested within it?Wondering whether there are too many nested layers that AIM can't cope with (the whole thing is bounded by [ ]
So we have three mains and nested in each we have station and in each of the stations there are multiple runways.
If you had ResponseBO that has nothing but a peer multiple reference to Airport?
Dinner Done! North-enders are thick. Howay the lads!
Here ya go.
Had to pay $10 to get the multi-station reply.
Gonna try to get a refund cause I only made 2 API calls - the 2nd one was because I added Runways (even though you said they were being ignored, yet you had a BO for them)
You can add more fields - I did a small set.
Jaymer...
Oh, and insert your token on the Base URL
Had to pay $10 to get the multi-station reply.
Gonna try to get a refund cause I only made 2 API calls - the 2nd one was because I added Runways (even though you said they were being ignored, yet you had a BO for them)
You can add more fields - I did a small set.
Jaymer...
Oh, and insert your token on the Base URL
- Attachments
-
- rod.bsv.zip
- (44.85 KiB) Downloaded 466 times
Last edited by Jaymer on Wed Apr 29, 2020 10:31 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
Jaymer
Aware Programming & Consulting - Tampa FL
Refund
That was easy - sent AVWX owner an email. Cool!
Thanks for helping. The subscription has been canceled and a refund issued.
On Tue, Apr 28, 2020 at 10:32 PM Jaymer <[email protected]> wrote:
hi
I’m in Tampa (seffner)
Per this thread, https://www.awareim.com/forum/viewtopic.php?f=1&t=11631
I signed up to help a colleague new to REST.
Only made 2 calls - could I get a refund? $9 would be fine.
thx
jaymer…
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