ZeroCopyZeroCopy
ReferenceJSON-RPC

getSlot

POST
/

Read the edge's highest observed slot with getSlot; params and commitment do not affect the result.

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*"getSlot"
Value in"getSlot"
params?unknown

Ignored when present, so a commitment has no effect.

Response Body

Returns the highest slot the edge has observed, as an integer. It may not be committed yet. Use your Solana RPC provider for confirmation and block heights.

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

application/json
  1. response
jsonrpc*"2.0"
Value in"2.0"
result*integer

The highest slot the edge has observed. It may not be committed yet.

Range0 <= value
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": 123456789,
  "id": 1
}