Skip to content

Hypermedia

Graham Cox edited this page Dec 30, 2016 · 3 revisions

Based upon JSON API, but with some tweaks to allow data on relationships and easier linking to included resources.

Single element example

{
    "data": {
        "type": "characters",
        "id": "bob",
        "attributes": {
            "name": "Bob Robertson"
        },
        "links": {
            "self": "/ump/characters/bob"
        },
        "relationships": {
            "skills": [
                {
                    "data": {
                        "type": "skills", 
                        "id": "swords",
                        "attributes": {
                            "level": 5
                        }
                    },
                    "links": {
                        "related": "/ump/skills/swords"
                    }
                }
            ]
        }
    },
    "included": {
        "/ump/skills/swords": {
            "type": "skills",
            "id": "swords",
            "attributes": {
                "name": "Swordfighting"
            },
            "links": {
                "self": "/ump/skills/swords"
            }
        }
    }
}
Clone this wiki locally