How to create a restful api in Intersystems cache with %CSP.REST
Hello Guys,
Can you please guide me to create a RESTful API service in our cache (using intersystems cache kit) with CSP (Cache Server Pages ) object script.
Class REST.NativeDIspatcher Extends %CSP.REST
{
XData UrlMap [XMLNamespace = "http://www.native.rest.com/urlmap" ]
{
<Routes>
<!-- <Route Url="/:name" Method="GET" Call="displaySystem" Cors="false" /> -->
<Route Url="/:ostype" Method="GET" Call="externalFreeze" Cors="false" />
</Routes>
}
ClassMethod externalFreeze(Ostype as %String) as %Status{
set status = ##Class(Backup.General).ExternalFreeze()
WRITE "EXTERNAL FREEZE RESPONSE FOUND " _status
QUIT $$$OK
}
}
I had written above code snippet but, I need to explore more using %CSP.REST object script language.
Can anyone suggest/ share sample code snippet to create a REST service web application using %CSP.REST object script language.
Thanks,
Chandrasekhar Reddy,
Email: cbandi@purestorage.com | +91 9880318877
The online documentation is here:
There is some training in the InterSystems Learning portal (you'll need to enrol/login):
e.g.
I wrote this tutorial some time ago https://community.intersystems.com/post/lets-write-angular-1x-app-cach%C...
It covers making an AngularJS front end with a basic Cache REST backend