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

GET /ooxml

GET /ooxml alias: /ooxml

Returns a well-formed Office Open XML package (DOCX, XLSX, or PPTX) where [Content_Types].xml, every relationship, and every referenced part are present and self-consistent. Counterpart to the chaos /ooxml endpoint, which deliberately ships packages where one structural field lies.

format docx (default), xlsx, or pptx. Same hello-world content rendered in the appropriate document structure for each format.
build a request:

expect: 200 OK with the OOXML MIME type for the chosen format. The package opens cleanly in python-docx / openpyxl / python-pptx (and by extension Word / Excel / PowerPoint, LibreOffice, etc.).

bash
# Save the archive, then inspect the OOXML package structure.
curl -sD - 'https://not.catastrophic.io/ooxml?format=docx' -o /tmp/chaos.docx | grep -i 'content-type\|x-chaos-ooxml'
unzip -p /tmp/chaos.docx '[Content_Types].xml' | head -20
unzip -l /tmp/chaos.docx
# python-docx / openpyxl / python-pptx are strict; chaos modes hard-fail.
import urllib.request, io, zipfile
resp = urllib.request.urlopen("https://not.catastrophic.io/ooxml?format=docx")
raw = resp.read()
print("Content-Type:", resp.headers.get("Content-Type"))
print("X-Chaos-Ooxml-Mode:", resp.headers.get("X-Chaos-Ooxml-Mode"))
print("X-Chaos-Ooxml-Note:", resp.headers.get("X-Chaos-Ooxml-Note"))
zf = zipfile.ZipFile(io.BytesIO(raw))
print("Parts:", zf.namelist())
print("Content_Types.xml:")
print(zf.read("[Content_Types].xml").decode())
// Inspect headers; the body is binary, leave parsing to a library.
const res = await fetch("https://not.catastrophic.io/ooxml?format=docx");
const bytes = new Uint8Array(await res.arrayBuffer());
console.log("Content-Type:", res.headers.get("content-type"));
console.log("X-Chaos-Ooxml-Format:", res.headers.get("x-chaos-ooxml-format"));
console.log("X-Chaos-Ooxml-Mode:", res.headers.get("x-chaos-ooxml-mode"));
console.log("X-Chaos-Ooxml-Note:", res.headers.get("x-chaos-ooxml-note"));
console.log("Bytes:", bytes.length);
package main

import (
    "archive/zip"
    "bytes"
    "fmt"
    "io"
    "net/http"
)

func main() {
    resp, _ := http.Get("https://not.catastrophic.io/ooxml?format=docx")
    defer resp.Body.Close()
    body, _ := io.ReadAll(resp.Body)
    fmt.Println("Content-Type:", resp.Header.Get("Content-Type"))
    fmt.Println("X-Chaos-Ooxml-Note:", resp.Header.Get("X-Chaos-Ooxml-Note"))
    r, err := zip.NewReader(bytes.NewReader(body), int64(len(body)))
    if err != nil {
        fmt.Println("zip.NewReader error:", err)
        return
    }
    for _, f := range r.File {
        fmt.Printf("  %s\n", f.Name)
    }
}
// Cargo.toml: reqwest = { version = "0.12", features = ["blocking"] }
//              zip = "2"
use std::io::Cursor;
fn main() -> Result<(), Box> {
    let resp = reqwest::blocking::get("https://not.catastrophic.io/ooxml?format=docx")?;
    println!("Content-Type: {:?}", resp.headers().get("content-type"));
    println!("X-Chaos-Ooxml-Note: {:?}", resp.headers().get("x-chaos-ooxml-note"));
    let bytes = resp.bytes()?;
    let mut zf = zip::ZipArchive::new(Cursor::new(bytes.to_vec()))?;
    for i in 0..zf.len() {
        println!("  {}", zf.by_index(i)?.name());
    }
    Ok(())
}
// Java 11+ HttpClient.
import java.net.URI;
import java.net.http.*;
import java.util.zip.*;
import java.io.*;

public class OoxmlChaos {
    public static void main(String[] args) throws Exception {
        var client = HttpClient.newHttpClient();
        var req = HttpRequest.newBuilder(URI.create("https://not.catastrophic.io/ooxml?format=docx")).build();
        var resp = client.send(req, HttpResponse.BodyHandlers.ofByteArray());
        System.out.println("Content-Type: " +
            resp.headers().firstValue("Content-Type").orElse(""));
        System.out.println("X-Chaos-Ooxml-Note: " +
            resp.headers().firstValue("X-Chaos-Ooxml-Note").orElse(""));
        try (var zis = new ZipInputStream(new ByteArrayInputStream(resp.body()))) {
            ZipEntry e;
            while ((e = zis.getNextEntry()) != null) {
                System.out.println("  " + e.getName());
            }
        }
    }
}
using System.IO.Compression;
using var client = new HttpClient();
var resp = await client.GetAsync("https://not.catastrophic.io/ooxml?format=docx");
Console.WriteLine($"Content-Type: {resp.Content.Headers.ContentType}");
Console.WriteLine($"X-Chaos-Ooxml-Note: {resp.Headers.GetValues("X-Chaos-Ooxml-Note").FirstOrDefault()}");
var bytes = await resp.Content.ReadAsByteArrayAsync();
using var zf = new ZipArchive(new MemoryStream(bytes), ZipArchiveMode.Read);
foreach (var e in zf.Entries) {
    Console.WriteLine($"  {e.FullName}");
}
require "net/http"
require "tempfile"
uri = URI("https://not.catastrophic.io/ooxml?format=docx")
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-Ooxml-Note: #{res['X-Chaos-Ooxml-Note']}"
    Tempfile.create(["chaos", ".docx"]) do |f|
        f.binmode; f.write(res.body); f.flush
        puts `unzip -l #{f.path}`
    end
end
# Save the OOXML package, then inspect [Content_Types].xml.
$tmp = Join-Path $env:TEMP 'chaos.docx'
$r = Invoke-WebRequest -Uri 'https://not.catastrophic.io/ooxml?format=docx' -OutFile $tmp -PassThru
"Content-Type: $($r.Headers['Content-Type'])"
"X-Chaos-Ooxml-Mode: $($r.Headers['X-Chaos-Ooxml-Mode'])"
"X-Chaos-Ooxml-Note: $($r.Headers['X-Chaos-Ooxml-Note'])"
Add-Type -AssemblyName System.IO.Compression.FileSystem
$zip = [System.IO.Compression.ZipFile]::OpenRead($tmp)
$zip.Entries | Select-Object FullName, Length | Format-Table
$zip.Dispose()