getSlot
Read the edge's highest observed slot with getSlot; params and commitment do not affect the result.
x-api-key<token>Send the SWQoS API key in this header. See the authentication reference for compatibility forms and precedence.
One JSON object using the shared request conventions. The method takes no params. The local agent reports its own state.
application/json- body
jsonrpc*"2.0""2.0"id?||Optional request id, echoed exactly in the response. Null when absent or refused before the id could be read.
method*"getSlot""getSlot"params?unknownIgnored when present, so a commitment has no effect.
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:
invalid_request: invalid JSON-RPC body.
application/json- response
jsonrpc*"2.0""2.0"result*integerThe highest slot the edge has observed. It may not be committed yet.
0 <= valueid*||Optional request id, echoed exactly in the response. Null when absent or refused before the id could be read.
// 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(())
}{
"jsonrpc": "2.0",
"result": 123456789,
"id": 1
}