Description: An example of a REST web service implemented with ObjectScript that demonstrates a number of development best practices. This is the companion to a live webinar presented by InterSystems Learning Services on December 7, 2017.
Requirements: 2016.2 or higher.
To install:
- Create the CSP application
/rnr
for the desired namespace. - Set the Dispatch Class option for
/rnr
toRNR.Service
. - Load the files in the RestAndRelaxation directory to a new project using Atelier.
- Compile the new project in Atelier.
Instructions:
You can consult the URLMap in the RNR.Travel.BestPractices class to see which resources are available. Here are a few examples you can try with your favorite REST testing utility.
-
To retrieve a list of travel reservations, make a GET request to
http://<server>:<port>/rnr/travel/reservations
. -
To add a new travel reservation, send a POST request to
http://<server>:<port>/rnr/travel/reservation
using the following JSON as an example for the request body:
{
"customer": "Michael",
"startLocation": "Boston",
"destination": "London",
"startDate": "2018-02-01",
"endDate": "2018-02-10"
}
Enjoy!
— MS