I have an API in C# that won’t map to JSON-RPC due to the fact that JSON-RPC is Procedurally oriented.
How in JSON-RPC would you represent an Object Oriented API?
I can of course use the JSON-RPC extensions so that the request would look like:
{ "jsonrpc":"2.0", method:"ObjectName.Method", "params":[], "id": 1 }
But it feels kinda hackish and also requires a lot of work to define.
I can also include it as a parameter but again it just doesn’t feel right.
Is there a best practice regarding working against an Object Oriented API using JSON-RPC?
JSON-RPC is JSON Remote Procedure Call and by default procedure oriented.
However if you work over HTTP you can see each RPC service as object. I.e. if you access
/foo/barand callbeepover JSON-RPC over HTTP then you callbeepmethod offooservice ofbarobject.Otherwise you may do it the way all OOP mapped over procedure calls:
Where foo is “pointer” to object, for RPC it may be object UUID. (That is how it is actually done in some RPCS).
So you call
Goes to: