Question Manoj K · Apr 1, 2017

Hi

I tried to access one server to another server in Cache Rest Service, I tried 

Parameter HandleCorsRequest = 1;

and

<Route Url="/data/:first/:second" Method="GET" Call="GetData" Cors="true"/>

But not working,

Can anyone tell me the solution??

Thanks in advance!!

5
1 1739
Question Manoj K · Mar 3, 2017

I created a simple CRUD operation using Rest Services in Cache.

 Class EX.example Extends %CSP.REST
{

XData UrlMap
{
<Routes>
<Route Url="/insert/:loc/:ssn/:name" Method="GET" Call="hello"/>
<Route Url="/update/:key/:loc/:ssn/:name" Method="GET" Call="iam"/>
<Route Url="/delete/:key" Method="GET" Call="there"/>
<Route Url="/findid/:key" Method="GET" Call="now"/>
</Routes>
}

ClassMethod hello(name As %String, ssn As %String, loc As %String) As %Status
{
s mName=$zcvt(name,"U"),mKey=ssn,mLoc=loc
s ns=$namespace
znspace "USER"
try{
s obj=##class(Sample.Classes).%New()
s obj.
5
0 533
Question Manoj K · Feb 27, 2017

Hi, I tried the new rest file in User namespace. But I couldn't run it.

Here the Code:

 Class com.Testing Extends %CSP.REST
{

XData UrlMap
{
<Routes>
<Route Url="/insert" Method="POST" Call="one"/>
<Route Url="/print" Method="POST" Call="two"/>
<Route Url="/update" Method="POST" Call="three"/>
</Routes>
}

ClassMethod one()
{
Write "This is 1st Method!!"
Quit
}

ClassMethod two()
{
Write !,"This is 2nd method"
Quit
}

ClassMethod three()
{
Write 
5
0 611