online / endpoints 62 / categories 10 / rate 60/min/ip /

GET /jsonrpc

GET /jsonrpc alias: /jsonrpc

Returns a well-formed JSON-RPC 2.0 response: `jsonrpc` version present, `id` matching the implied request, `result` present without `error`. Counterpart to the chaos /jsonrpc endpoint.

expect: 200 OK with Content-Type: application/json. Valid JSON-RPC 2.0 envelope with jsonrpc, id, and result fields. Build clients against this, then flip hostname to chaos.catastrophic.io to test adversity.

bash
curl -si 'https://not.catastrophic.io/jsonrpc' | grep -E '^(HTTP|content-type|x-chaos)'
import urllib.request, json
resp = urllib.request.urlopen("https://not.catastrophic.io/jsonrpc")
print("X-Chaos-Jsonrpc-Mode:", resp.headers.get("X-Chaos-Jsonrpc-Mode"))
body = json.loads(resp.read())
print("jsonrpc present:", "jsonrpc" in body)
print("result present:", "result" in body)
print("error present:", "error" in body)
print("note:", body.get("note"))
const res = await fetch("https://not.catastrophic.io/jsonrpc");
const body = await res.json();
console.log("X-Chaos-Jsonrpc-Mode:", res.headers.get("x-chaos-jsonrpc-mode"));
console.log("jsonrpc present:", "jsonrpc" in body);
console.log("result present:", "result" in body);
console.log("error present:", "error" in body);
console.log("note:", body.note);
package main

import (
    "encoding/json"
    "fmt"
    "io"
    "net/http"
)

func main() {
    resp, _ := http.Get("https://not.catastrophic.io/jsonrpc")
    defer resp.Body.Close()
    raw, _ := io.ReadAll(resp.Body)
    var body map[string]any
    json.Unmarshal(raw, &body)
    fmt.Println("X-Chaos-Jsonrpc-Mode:", resp.Header.Get("X-Chaos-Jsonrpc-Mode"))
    _, hasVersion := body["jsonrpc"]
    _, hasResult := body["result"]
    _, hasError := body["error"]
    fmt.Println("jsonrpc present:", hasVersion)
    fmt.Println("result present:", hasResult)
    fmt.Println("error present:", hasError)
}
// Cargo.toml: reqwest = { version = "0.12", features = ["blocking", "json"] }
fn main() -> Result<(), Box> {
    let resp = reqwest::blocking::get("https://not.catastrophic.io/jsonrpc")?;
    println!("X-Chaos-Jsonrpc-Mode: {:?}", resp.headers().get("x-chaos-jsonrpc-mode"));
    let body: serde_json::Value = resp.json()?;
    println!("jsonrpc present: {}", body.get("jsonrpc").is_some());
    println!("result present: {}", body.get("result").is_some());
    println!("error present: {}", body.get("error").is_some());
    Ok(())
}
import java.net.URI;
import java.net.http.*;

public class JsonRpcChaos {
    public static void main(String[] args) throws Exception {
        var client = HttpClient.newHttpClient();
        var req = HttpRequest.newBuilder(URI.create("https://not.catastrophic.io/jsonrpc")).build();
        var resp = client.send(req, HttpResponse.BodyHandlers.ofString());
        System.out.println("X-Chaos-Jsonrpc-Mode: " +
            resp.headers().firstValue("X-Chaos-Jsonrpc-Mode").orElse(""));
        System.out.println("Body: " + resp.body());
    }
}
using var client = new HttpClient();
var resp = await client.GetAsync("https://not.catastrophic.io/jsonrpc");
Console.WriteLine($"X-Chaos-Jsonrpc-Mode: " +
    $"{resp.Headers.GetValues("X-Chaos-Jsonrpc-Mode").FirstOrDefault()}");
var body = await resp.Content.ReadAsStringAsync();
Console.WriteLine($"Body: {body}");
require "net/http"
require "json"
uri = URI("https://not.catastrophic.io/jsonrpc")
Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
    res = http.get(uri.request_uri)
    puts "X-Chaos-Jsonrpc-Mode: #{res['X-Chaos-Jsonrpc-Mode']}"
    body = JSON.parse(res.body)
    puts "jsonrpc present: #{body.key?('jsonrpc')}"
    puts "result present: #{body.key?('result')}"
    puts "error present: #{body.key?('error')}"
end
$r = Invoke-RestMethod -Uri 'https://not.catastrophic.io/jsonrpc' -ResponseHeadersVariable h
"X-Chaos-Jsonrpc-Mode: $($h['X-Chaos-Jsonrpc-Mode'])"
"jsonrpc present: $($r.PSObject.Properties['jsonrpc'] -ne $null)"
"result present: $($r.PSObject.Properties['result'] -ne $null)"
"error present: $($r.PSObject.Properties['error'] -ne $null)"