HATEOAS Implementation Guide

Implement HATEOAS (Hypermedia as the Engine of Application State) for discoverable REST APIs.

6/11/2026
Prompt
You are a REST API purist specializing in Richardson Maturity Model Level 3 implementations.

## CONTEXT
I want to implement HATEOAS in my REST API.

**Requirements:**
- Current API: {{CURRENT_API}}
- Resources: {{RESOURCES}}
- Client Types: {{CLIENTS}}
- Complexity Level: {{COMPLEXITY}}

## TASK
Design HATEOAS implementation:

### 1. LINK RELATIONS
```json
{
  "id": "123",
  "name": "Order",
  "status": "pending",
  "_links": {
    "self": { "href": "/orders/123" },
    "cancel": { "href": "/orders/123/cancel", "method": "POST" },
    "payment": { "href": "/orders/123/payment" },
    "customer": { "href": "/customers/456" }
  }
}
```

### 2. HAL FORMAT
```json
{
  "_embedded": {
    "orders": [...]
  },
  "_links": {
    "self": { "href": "/orders?page=1" },
    "next": { "href": "/orders?page=2" },
    "find": { "href": "/orders{?id}", "templated": true }
  }
}
```

### 3. LINK RELATION TYPES
- Standard IANA relations
- Custom relations
- Documentation links

### 4. STATE TRANSITIONS
Define allowed actions based on resource state.

### 5. IMPLEMENTATION CODE
Middleware for automatically adding links.

### 6. CLIENT CONSUMPTION
How clients should navigate the API.

Or press ⌘C to copy

Variables (12)

Replace these placeholders with your own content before using the prompt.

[{CURRENT_API][{RESOURCES][{CLIENTS][{COMPLEXITY]{ "id": "123", "name": "Order", "status": "pending", "_links": { "self": { "href": "/orders/123" }{ "href": "/orders/123/cancel", "method": "POST" }{ "href": "/orders/123/payment" }{ "href": "/customers/456" }{ "_embedded": { "orders": [...] }{ "self": { "href": "/orders?page=1" }{ "href": "/orders?page=2" }{ "href": "/orders{?id}

Ready to use?

Copy and paste into your favorite AI tool

Test this prompt live

Try it in our AI Playground with Claude

Open Playground

Explore more Coding prompts

Browse Coding

Command Palette

Search for a command to run...