I would like to use REST calls to call my serverside RPC module functions.
I actually have something close in-place already but it gives me a 500 internal server error and I don't know how to troubleshoot. Below is what I have. RPC is enabled for the module and in my project settings. CORS is allowed.
rpc(moduleName: string, methodName: string, params: any[]): Promise<any> {
let data = {
jsonrpc: '2.0',
//id: 167972631107,
module: moduleName,
method: methodName,
params: params
};
let headers = new Headers({
'Content-Type': 'application/json'
});
return this.http.post(`http://127.0.0.1:8081/rpc/`, JSON.stringify(data), headers).toPromise();
}