winery icon indicating copy to clipboard operation
winery copied to clipboard

[FR] Winery Responses should contain links

Open nyuuyn opened this issue 6 years ago • 2 comments

Every response of the REST API should(/must) return links to subresources etc.

For example:

A GET on http://localhost:8089/winery/servicetemplates/ returns the following JSON:

[
  {
    "id": "MyTinyToDo-MySql_OpenStack-w1-wip1",
    "name": "MyTinyToDo-MySql_OpenStack-w1-wip1",
    "namespace": "http://opentosca.org/servicetemplates",
    "qName": "{http://opentosca.org/servicetemplates}MyTinyToDo-MySql_OpenStack-w1-wip1"
  }
]

So now to get to the example Service Template the user must somehow magically guess how to get there, which is basically a GET to the URL:

http://localhost:8089/winery/servicetemplates/http%3A%2F%2Fopentosca.org%2Fservicetemplates/MyTinyToDo-MySql_OpenStack-w1-wip1

That this is a bit weird from a design perspective, it would be quite nice if the response would look something like this:

[
  {
    "id": "MyTinyToDo-MySql_OpenStack-w1-wip1",
    "name": "MyTinyToDo-MySql_OpenStack-w1-wip1",
    "namespace": "http://opentosca.org/servicetemplates",
    "qName": "{http://opentosca.org/servicetemplates}MyTinyToDo-MySql_OpenStack-w1-wip1",
    "_link" : {
             "href" : "http://localhost:8089/winery/servicetemplates/http%3A%2F%2Fopentosca.org%2Fservicetemplates/MyTinyToDo-MySql_OpenStack-w1-wip1",
             "type" : "self"
          }
  }
]

Atleast with the _link object in the response people could navigate the API based on the responses, which would make the API a bit RESTy.

P.S.: Just whoever may have time to do this, don't forget the application/xml support :)

nyuuyn avatar Jan 28 '19 17:01 nyuuyn