Exposing REST Question

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
rocketman
Posts: 1252
Joined: Fri Jan 02, 2009 11:22 pm
Location: Preston UK
Contact:

Exposing REST Question

Post by rocketman »

OK, so I created a Service and succesfully received the request url and sent back a list of courses that still had some availability. All Good - in fact easy peasy. Sample return below (sorry to anyone wanting to learn to glide - courses are full)

{
"response": [
{
"DurationDays": 5,
"PlacesAvailable": 0,
"CourseDate": "Mon, Sep 12, 2022",
"PlacesOnCourse": 6,
"CourseNumber": 8,
"WebSubject": "Public Course (double)"}
,
{
"DurationDays": 5,
"PlacesAvailable": 0,
"CourseDate": "Mon, Aug 8, 2022",
"PlacesOnCourse": 3,
"CourseNumber": 6,
"WebSubject": "Public Course"}
, ...........

So Now I want to allow a website visitor to book a place. I've got as far as creating the service, have a process that does a find supposdly based on an incoming url parameter - but I can't for the life of me get the syntax right. In the log it keeps finding all the courses (even though it returns only one)

So my code is FIND Courses WHERE Courses.CourseID=Courses.CourseID and I've tried ?Courses.CourseID, ?CourseID, ?Parameter and the URL is
http://localhost:8080/AwareIM/REST/XXXX ... CourseID=3

Logviewer shows me that 8 items are being found so CourseID=3 is not being picked up and fed into the FIND in the process. The rest of the process works as I do get a single return. So I'm stumped. How do you construct the FIND to receive the url input?

<WebCourses>
<DurationDays/>
<PlacesAvailable/>
<CourseDate/>
<PlacesOnCourse/>
<CourseNumber/>
<WebSubject>Booked</WebSubject>
</WebCourses>
Rocketman

V8.7 Developer Edition. Server 2016 Standard edition. MySql 5.5
Jaymer
Posts: 2450
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Exposing REST Question

Post by Jaymer »

knee bone connected to the leg bone,
leg bone connected to the shin bone,
shin bone connected to the ankle bone.
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: 2450
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Exposing REST Question

Post by Jaymer »

Incoming service (CourseBook) connected to process (web_CourseBook)
Screen Shot 2022-03-30 at 3.07.59 PM.png
Screen Shot 2022-03-30 at 3.07.59 PM.png (40.29 KiB) Viewed 1593 times


process has Input BO (REST_CourseBook)
Screen Shot 2022-03-30 at 3.08.42 PM.png
Screen Shot 2022-03-30 at 3.08.42 PM.png (20.44 KiB) Viewed 1593 times


input BO (REST_CourseBook, not persisted) has fields for aware to store the passed-in parameters
Screen Shot 2022-03-30 at 3.09.12 PM.png
Screen Shot 2022-03-30 at 3.09.12 PM.png (10.3 KiB) Viewed 1593 times


So the process gets called by the incoming request,
the process has access to the parms,
to then do: FIND Courses WHERE Courses.CourseID = REST_CourseBook.CourseID
which aligns with this URL:

Code: Select all

http://localhost:8080/AwareIM/REST/XXXX/CourseBook?CourseID=3
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
rocketman
Posts: 1252
Joined: Fri Jan 02, 2009 11:22 pm
Location: Preston UK
Contact:

Re: Exposing REST Question

Post by rocketman »

Ttttttttttttttsssssssssssssss - Boooom.

Every one a winner - every egg a bird.

Thanks @jaymer Now off to conquer the world (well ok - maybe tomorrow)

<WebCourses>
<DurationDays/>
<PlacesAvailable/>
<CourseDate>Mon, Aug 1, 2022</CourseDate>
<PlacesOnCourse/>
<CourseNumber>5</CourseNumber>
<WebSubject>Full</WebSubject>
</WebCourses>
Rocketman

V8.7 Developer Edition. Server 2016 Standard edition. MySql 5.5
Post Reply