Skip to content
rsvato edited this page Jan 21, 2013 · 31 revisions

Links formats

New domain object Link is intoduced. Link must include following attributes:

  • href - Absolute (may be relative to base) uri to resource.
  • method - HTTP verb to use
  • rel - Link relation. May contain values:
    • self - for self-pointing (GET) resources
    • update - for update (PUT and, possibly, PATCH requests) requests
    • delete - for delete requests (DELETE)
    • create - for create requests (POST)
    • collection - to point to collection urls

Link may include:

  • type - Domain type and media. This is possibly valid only for GET links.

Example protocol

Parts of entities are omitted for the sake of brevity.

  • User starts with a root of application.

GET /

[
    {"href" : "/projects", "method": "get", "type": "application/vnd.genesis.Project+json", "rel": "collection"}
    {"href" : "/settings", "method" : "get", "type": "application/vnd.genesis.Link+json", "rel": "collection"}
]

Setting has a type genesis.Link, because it's anything but links collection.

For non-admin user no /settings url will be present at this stage.

  • User choose to continue with /projects link

GET /projects

{    "items" : [
        {
            "name" : "project",
            "id" : "id",
            "links" : [
                {"href" : "/projects/1", "method" : "get", "rel" : "self"},
                {"href" : "/projects/1", "method" : "put", "rel" : "update"},
                {"href" : "/projects/1", "method" : "delete", "rel" : "delete"}
                {"href" : "/projects/1/settings", "method": "get", "type": "application/vnd.genesis.Link+json", "rel": "collection"}
                {"href" : "/projects/1/envs", "method" : "get", "type": "application/vnd.genesis.Environment+json", "rel": "collection"}
                
            ]
        },
    ],
    "links": [
       {"href":"/projects", "method": "post", "rel":"create"} 
    ]
}

For non-admin user no links array will be present, as user can't create projects. In items element no links with rels update and delete and no link with url /projects/1/settings

  • User goes to /projects/1/settings
Clone this wiki locally