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

GET /cloudevents

GET /cloudevents alias: /cloudevents

Returns a well-formed CloudEvents 1.0 envelope: `specversion` is "1.0", `type` is a non-empty string, `datacontenttype` matches the `data` shape, only `data` present (no `data_base64`). Served as application/cloudevents+json. Counterpart to the chaos /cloudevents endpoint.

expect: 200 OK with Content-Type: application/cloudevents+json. All required attributes present, specversion 1.0, data and datacontenttype consistent. Build event consumers against this, then flip hostname to chaos.catastrophic.io to test adversity.

bash
curl -si 'https://not.catastrophic.io/cloudevents' | grep -E '^(HTTP|content-type|x-chaos)'
import urllib.request, json
resp = urllib.request.urlopen("https://not.catastrophic.io/cloudevents")
print("Content-Type:", resp.headers.get("Content-Type"))
print("X-Chaos-Cloudevents-Mode:", resp.headers.get("X-Chaos-Cloudevents-Mode"))
body = json.loads(resp.read())
print("specversion:", body.get("specversion"))
print("type type:", type(body.get("type")).__name__)
print("data present:", "data" in body)
print("data_base64 present:", "data_base64" in body)
print("note:", body.get("note"))
const res = await fetch("https://not.catastrophic.io/cloudevents");
const body = await res.json();
console.log("Content-Type:", res.headers.get("content-type"));
console.log("X-Chaos-Cloudevents-Mode:", res.headers.get("x-chaos-cloudevents-mode"));
console.log("specversion:", body.specversion);
console.log("type value:", body.type, "/ typeof:", typeof body.type);
console.log("data present:", "data" in body);
console.log("data_base64 present:", "data_base64" 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/cloudevents")
    defer resp.Body.Close()
    raw, _ := io.ReadAll(resp.Body)
    var body map[string]any
    json.Unmarshal(raw, &body)
    fmt.Println("Content-Type:", resp.Header.Get("Content-Type"))
    fmt.Println("X-Chaos-Cloudevents-Mode:", resp.Header.Get("X-Chaos-Cloudevents-Mode"))
    fmt.Println("specversion:", body["specversion"])
    fmt.Printf("type value: %v (Go type: %T)\n", body["type"], body["type"])
    _, hasData := body["data"]
    _, hasDataB64 := body["data_base64"]
    fmt.Println("data present:", hasData, "/ data_base64 present:", hasDataB64)
}
// Cargo.toml: reqwest = { version = "0.12", features = ["blocking", "json"] }
fn main() -> Result<(), Box> {
    let resp = reqwest::blocking::get("https://not.catastrophic.io/cloudevents")?;
    println!("Content-Type: {:?}", resp.headers().get("content-type"));
    println!("X-Chaos-Cloudevents-Mode: {:?}", resp.headers().get("x-chaos-cloudevents-mode"));
    let body: serde_json::Value = resp.json()?;
    println!("specversion: {:?}", body.get("specversion"));
    println!("type: {:?}", body.get("type"));
    println!("data present: {} / data_base64 present: {}",
        body.get("data").is_some(), body.get("data_base64").is_some());
    Ok(())
}
import java.net.URI;
import java.net.http.*;

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