ZeroCopyZeroCopy
ReferenceJSON-RPC

getHealth

POST
/

Check whether an SWQoS edge can currently reach upcoming leaders; readiness does not guarantee that a transaction will land. A send can still be refused, for example with not_ready.

Authorization

headerx-api-key<token>

Send the SWQoS API key in this header. See the authentication reference for compatibility forms and precedence.

Request Body

One JSON object using the shared request conventions. The method takes no params. The local agent reports its own state.

application/json
  1. body
jsonrpc*"2.0"
Value in"2.0"
id?||

Optional request id, echoed exactly in the response. Null when absent or refused before the id could be read.

method*"getHealth"
Value in"getHealth"
params?unknown

Ignored when present.

Response Body

Returns ok when an SWQoS edge can currently reach upcoming leaders; readiness does not guarantee that a transaction will land. A send can still be refused, for example with not_ready.

Refusals with HTTP 200, by error.data.reason:

  • invalid_request: invalid JSON-RPC body, unreadable body or request body timeout.
  • too_large: request body exceeds 65,536 bytes.
application/json
  1. response
jsonrpc*"2.0"
Value in"2.0"
result*"ok"
Value in"ok"
id*||

Optional request id, echoed exactly in the response. Null when absent or refused before the id could be read.

Example request
// Builds on the example project (/reference/json-rpc#example-project).
use swqos_examples::swqos::{Result, SwqosError, call};

#[tokio::main]
async fn main() -> Result<()> {
    match call::<String>("getHealth", None).await {
        Ok(health) => println!("health {health}"),
        Err(error) => {
            if error
                .downcast_ref::<SwqosError>()
                .is_some_and(|error| error.code == -32005)
            {
                println!("edge not ready");
            } else {
                return Err(error);
            }
        }
    }
    let slot: u64 = call("getSlot", None).await?;
    println!("slot {slot}");
    Ok(())
}
Example response
{
  "jsonrpc": "2.0",
  "result": "ok",
  "id": 1
}