Skip to content

11 Temple Payload

DodaTech 1 min read

title: Temple Payload Pattern in HATEOAS weight: 21 date: 2026-06-28 lastmod: 2026-06-28 description: Learn the Temple Payload pattern combining data, links, embedded resources, and actions into a unified response structure for self-contained hypermedia API interactions. tags: [api-development, hateoas]


The Temple Payload pattern structures hypermedia responses into four sections: data properties, navigation links, embedded related resources, and available actions, providing a complete interaction context in one response.

```python
{
    # 1. Properties (the resource data)
    "id": 42,
    "title": "Order #42",
    "status": "pending",
    "total": 150.00,
    "created_at": "2026-06-28T10:00:00Z",

    # 2. Navigation links (discovery)
    "_links": {
        "self": {"href": "/orders/42", "method": "GET"},
        "customer": {"href": "/users/7", "rel": "related"}
    },

    # 3. Embedded resources (reduces round trips)
    "_embedded": {
        "items": [
            {"id": 1, "name": "Widget", "price": 50.00, "quantity": 3}
        ],
        "shipping_address": {
            "street": "123 Main St", "city": "Portland", "zip": "97201"
        }
    },

    # 4. Actions (state transitions)
    "_actions": {
        "pay": {
            "href": "/orders/42/payment",
            "method": "POST",
            "fields": [{"name": "payment_method", "type": "text"}]
        },
        "cancel": {"href": "/orders/42", "method": "DELETE"}
    }
}

What's Next

Now learn about partial representations in Hypermedia APIs and HATEOAS.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro