online / endpoints 59 / categories 14 / rate 60/min/ip /

GET /web-annotation

GET /web-annotation

Returns W3C Web Annotation objects with spec violations. Default omits the required `id` field. Use ?mode= to isolate other violations: wrong body type, invalid motivation vocabulary, or inconsistent target shape.

mode Which violation to send. One of: id-missing (default; required `id` field absent), body-as-string (`body` is a plain string instead of a TextualBody object or URI), motivation-invalid (`motivation` is not in the W3C vocabulary), target-shape-variance (`target` is a Specific Resource object instead of a URI string).

control Compare against the well-formed counterpart: not.catastrophic.io/web-annotation side-by-side

build a request:

expect: A JSON-LD annotation object served as application/ld+json with one of four spec violations. The `note` field in the body explains what is wrong.

bash
curl -si 'https://chaos.catastrophic.io/web-annotation?mode=id-missing' | grep -E '^(HTTP|content-type|x-chaos)'
import urllib.request, json
resp = urllib.request.urlopen("https://chaos.catastrophic.io/web-annotation?mode=id-missing")
print("Content-Type:", resp.headers.get("Content-Type"))
print("X-Chaos-Web-Annotation-Mode:", resp.headers.get("X-Chaos-Web-Annotation-Mode"))
body = json.loads(resp.read())
print("id present:", "id" in body)
print("motivation:", body.get("motivation"))
print("body type:", type(body.get("body")).__name__)
print("target type:", type(body.get("target")).__name__)
print("note:", body.get("note"))
const res = await fetch("https://chaos.catastrophic.io/web-annotation?mode=id-missing");
const body = await res.json();
console.log("Content-Type:", res.headers.get("content-type"));
console.log("X-Chaos-Web-Annotation-Mode:", res.headers.get("x-chaos-web-annotation-mode"));
console.log("id present:", "id" in body);
console.log("motivation:", body.motivation);
console.log("body type:", typeof body.body);
console.log("target type:", typeof body.target);
console.log("note:", body.note);
package main

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

func main() {
    resp, _ := http.Get("https://chaos.catastrophic.io/web-annotation?mode=id-missing")
    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-Web-Annotation-Mode:", resp.Header.Get("X-Chaos-Web-Annotation-Mode"))
    _, hasId := body["id"]
    fmt.Println("id present:", hasId)
    fmt.Printf("motivation: %v\n", body["motivation"])
    fmt.Printf("body type: %T\n", body["body"])
    fmt.Printf("target type: %T\n", body["target"])
}
// Cargo.toml: reqwest = { version = "0.12", features = ["blocking", "json"] }
fn main() -> Result<(), Box> {
    let resp = reqwest::blocking::get("https://chaos.catastrophic.io/web-annotation?mode=id-missing")?;
    println!("Content-Type: {:?}", resp.headers().get("content-type"));
    println!("X-Chaos-Web-Annotation-Mode: {:?}", resp.headers().get("x-chaos-web-annotation-mode"));
    let body: serde_json::Value = resp.json()?;
    println!("id present: {}", body.get("id").is_some());
    println!("motivation: {:?}", body.get("motivation"));
    println!("body: {:?}", body.get("body"));
    println!("target: {:?}", body.get("target"));
    Ok(())
}
import java.net.URI;
import java.net.http.*;

public class WebAnnotationChaos {
    public static void main(String[] args) throws Exception {
        var client = HttpClient.newHttpClient();
        var req = HttpRequest.newBuilder(URI.create("https://chaos.catastrophic.io/web-annotation?mode=id-missing")).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-Web-Annotation-Mode: " +
            resp.headers().firstValue("X-Chaos-Web-Annotation-Mode").orElse(""));
        System.out.println("Body: " + resp.body());
    }
}
using var client = new HttpClient();
var resp = await client.GetAsync("https://chaos.catastrophic.io/web-annotation?mode=id-missing");
Console.WriteLine($"Content-Type: {resp.Content.Headers.ContentType}");
Console.WriteLine($"X-Chaos-Web-Annotation-Mode: " +
    $"{resp.Headers.GetValues("X-Chaos-Web-Annotation-Mode").FirstOrDefault()}");
var body = await resp.Content.ReadAsStringAsync();
Console.WriteLine($"Body: {body}");
require "net/http"
require "json"
uri = URI("https://chaos.catastrophic.io/web-annotation?mode=id-missing")
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-Web-Annotation-Mode: #{res['X-Chaos-Web-Annotation-Mode']}"
    body = JSON.parse(res.body)
    puts "id present: #{body.key?('id')}"
    puts "motivation: #{body['motivation']}"
    puts "body class: #{body['body'].class}"
    puts "target class: #{body['target'].class}"
end
$r = Invoke-RestMethod -Uri 'https://chaos.catastrophic.io/web-annotation?mode=id-missing' -ResponseHeadersVariable h
"Content-Type: $($h['Content-Type'])"
"X-Chaos-Web-Annotation-Mode: $($h['X-Chaos-Web-Annotation-Mode'])"
"id present: $($r.PSObject.Properties['id'] -ne $null)"
"motivation: $($r.motivation)"
"body type: $($r.body.GetType().Name)"
"target type: $($r.target.GetType().Name)"