Single Endpoint Architecture

A JSON-RPC service commonly exposes one HTTP endpoint, for example POST /rpc. The endpoint does not represent one business operation. It represents the entry point into the RPC dispatcher.

POST /rpc

In REST, different operations are often represented by different URLs. In JSON-RPC, the URL stays the same and the requested operation is named inside the message.

Every operation uses the same endpoint. The operation is selected by the JSON-RPC method field. For example, the following request calls the Bank.MakeDeposit method to deposit 250.00 into an account with number A-100:

{
  "jsonrpc": "2.0",
  "method": "Bank.MakeDeposit",
  "params": {
    "accountNumber": "A-100",
    "amount": 250.00
  },
  "id": "1"
}

What the Endpoint Does

When the HTTP request is received, the endpoint:

The following ASP.NET Core example shows how the endpoint can be implemented as a minimal API. The IJsonRpcDispatcher is a custom service that routes requests to handlers based on the method name.

app.MapPost("/rpc", async (JsonRpcRequest request, IJsonRpcDispatcher dispatcher) =>
{
    JsonRpcResponse response = await dispatcher.DispatchAsync(request);
    return Results.Ok(response);
})
.WithName("JsonRpcEndpoint")
.WithSummary("Executes a JSON-RPC 2.0 request.")
.WithDescription("Send all JSON-RPC calls to this single endpoint. The method field selects the registered RPC handler.");

What the Endpoint Should Not Do

The endpoint should not contain banking, shipment, inventory, or customer logic. It should be a transport adapter. Business logic belongs in handlers. This design keeps the HTTP layer small. New operations do not require new controllers or new routes. They require new handlers registered with the dispatcher.

 

Table of Content Operation-Oriented APIs and AI Tools Previous: JSON-RPC 2.0 Fundamentals Next: Dependency Injection Role

 


Business Process Programming in .Net
© 2004–2026 Laskarzhevsky Software Inc.
Unless otherwise noted, the content of this website is licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).
Code examples are provided under the MIT License.
You are free to share and adapt the material provided that appropriate credit is given and any modifications are clearly indicated.
The information provided on this website is for educational purposes only.
The author and publisher make no warranties regarding the completeness or suitability of the information and are not responsible for any damages resulting from its use.