05 Actions
DodaTech
1 min read
title: Actions in HATEOAS Hypermedia APIs weight: 15 date: 2026-06-28 lastmod: 2026-06-28 description: Design HATEOAS actions that show available state transitions including conditional actions based on resource state, method hints, and request body schemas for forms. tags: [api-development, hateoas]
HATEOAS actions represent state transitions available on a resource, conditionally included based on current state, with method hints (POST, PUT, PATCH, DELETE) and optional request body schemas for form-like interactions.
```python
{
"order_id": 42,
"status": "pending",
"total": 150.00,
"_links": {
"self": {"href": "/orders/42", "method": "GET"},
"pay": {
"href": "/orders/42/payment",
"method": "POST",
"rel": "action",
"schema": {
"type": "object",
"properties": {
"payment_method": {"type": "string", "enum": ["credit_card", "paypal"]},
"amount": {"type": "number", "minimum": 0.01}
},
"required": ["payment_method", "amount"]
}
},
"cancel": {
"href": "/orders/42",
"method": "DELETE",
"rel": "action"
}
}
}
# After payment, status changes to "paid" and pay link is removed
What's Next
Now learn about link formats in Hypermedia APIs and HATEOAS.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro