Replies:

I have used this in order to call python code in the server, it calls bcrypt encryption in python.

Encriptar
  Set password = "password"
  Set tSC = ##class(EnsLib.JavaGateway.Service).RunCommandViaCPIPE("python -c 'import bcrypt; print(bcrypt.hashpw("_$c(34)_password_$c(34)_", bcrypt.gensalt(10)))'",.pDevice,.pOutput)
  Write pOutput,!
Quit

Is it possible?: Yes
Is it a good idea: No

Proof of concept of bad idea:

Class Rest.BadExample Extends %CSP.Page
{

Parameter CHARSET = "utf-8";

Parameter CONTENTTYPE = "application/json";

ClassMethod OnPage() As %Status
{

  Set String = "[ {code:1,description:'cat'},{code:2,description:'lyon'}]"
  Write String

  Quit $$$OK
}

}

As Eduard said, you should make your own class that inherits from %CSP.REST

A simple example that you can follow is in the ENSDEMO namespace, the class is Demo.REST.MathService.cls
 

Followers:
Gery has no followers yet.
Following:
Gery has not followed anybody yet.
Global Masters badges:
Gery has no Global Masters badges yet.