OpenRPC

SelfDocHub documents JSON-RPC services described with OpenRPC. This page explains how methods are shown, how identical method names are handled and how Try-It works for them.

Publishing#

Publish the OpenRPC document like any other specification (see Publishing a Specification). The root openrpc field makes SelfDocHub treat the service as OpenRPC, and the format stays locked for that service.

Methods in the interface#

An OpenRPC method has no HTTP verb or path, so its left-menu entry shows only its title (the summary, falling back to the method name) with a method icon. The page address is /docs/{service}/rpc/{method-name}, for example /docs/orders-rpc/rpc/listOrders.

  • Parameters lists the method's params as content descriptors (name, description, required, schema). OpenRPC has no query/header/path distinction.
  • Responses shows the single result schema.
  • Example Parameters and Example Responses appear only when the method documents examples. They are grouped under the example pairing name, so you can match a call to its result.
  • Errors appears when the method has an errors list: a table of code, message and, if any error has one, data.

Overlays, versions, search, favorites and exports work for methods in the same way as for REST endpoints. See Markdown Overlays.

Methods with the same name#

One document can contain several methods with the same name when they work on different servers, for example two actions methods under /json-rpc/event-action and /json-rpc/user-action-log. SelfDocHub treats them as separate methods everywhere.

A unique name stays as it is. Methods that share a name get a short token derived from their servers, such as actions@event-action and actions@user-action-log. The token comes from the servers, not from the order in the document. Try-It and exports still call the method by the name as written in the document.

Servers#

The method page shows its servers (its own, which replace the document's, otherwise the document's) with their variables. Try-It has a Server list. With one server it is chosen automatically. With several, pick one; the Path field is left alone until you do. A chosen server replaces the path in the Path field and keeps only the scheme and host of a URL already there. Variables take their defaults.

Try-It for OpenRPC#

Try-It uses the same Request, Headers and Response tabs as REST, shaped for JSON-RPC:

  • Body is prefilled with a JSON-RPC envelope: {"jsonrpc": "2.0", "method": "<method name>", "params": {}, "id": 1}.
  • Query is hidden. Path stays editable.
  • Send always issues POST with Content-Type: application/json.
  • Generate fills only the params key with example values and leaves jsonrpc, method and id alone.
  • Saved requests work as for REST. See Saved Requests.

Next steps#

Last updated: