Skip to content

Instantly share code, notes, and snippets.

@djames-bloom
Last active December 14, 2022 22:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djames-bloom/2131d021a8f6d3d09c5a808626575a58 to your computer and use it in GitHub Desktop.
Save djames-bloom/2131d021a8f6d3d09c5a808626575a58 to your computer and use it in GitHub Desktop.
Example HATEOS blog hierarchical structure
{
    "organization": "Acme Corportation",
    "department": "Engineering",
    "links": [
        {
            "rel": "blog",
            "href": "https://acme.co/blogs/engineering",
            "type": "GET"
        },
        {
            "rel": "organization",
            "href": "https://acme.co",
            "type": "GET"
        },
        {
            "rel": "whitepapers",
            "href": "https://acme.co/whitepapers/engineering",
            "type": "GET"
        },
        {
            "rel": "self",
            "href": "https://acme.co/engineering",
            "type": "GET"

        }
    ]
}
{
    "content_type": "blogs",
    "path": "index",
    "links": [
        {
            "rel": "company",
            "href": "https://acme.co/blogs/company",
            "type": "GET"
        },
        {
            "rel": "engineering",
            "href": "https://acme.co/blogs/engineering",
            "type": "GET"
        },
        {
            "rel": "finance",
            "href": "https://acme.co/blogs/finance",
            "type": "GET"
        },
        {
            "rel": "marketing",
            "href": "https://acme.co/blogs/marketing",
            "type": "GET"
        },
        {
            "rel": "self",
            "href": "https://acme.co/blogs",
            "type": "GET"
        }
    ]
}
{
    "organization": "Acme Corportation",
    "content_type": "blogs",
    "path": "engineering",
    "owning_department": "engineering",
    "articles": [
        {
            "rel": "00-foo",
            "href": "https://acme.co/blogs/engineering/00-foo",
            "type": "GET"
        },
        {
            "rel": "01-bar",
            "href": "https://acme.co/blogs/engineering/01-bar",
            "type": "GET"
        },
        {
            "rel": "02-baz",
            "href": "https://acme.co/blogs/engineering/02-baz",
            "type": "GET"
        }

    ],
    "links": [
        {
            "rel": "department",
            "href": "https://acme.co/engineering",
            "type": "GET"
        },
        {
            "rel": "parent",
            "href": "https://acme.co/blogs",
            "type": "GET"
        },
        {
            "rel": "self",
            "href": "https://acme.co/blogs/engineering",
            "type": "GET"
        }        
    ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment