"self" as rel of collection resourse in _embedded hal+json

27 views Asked by At

I'm new to HAL. In all samples and examples and even spec, for a collection resource it uses "_embedded" and a rel key same as resource name, but it's make no sense to me for this key to change for each resource and makes it hard to consume.

Then I thought to use "self" rel key for this thing and it makes much more sense because it's actually recourses of that URL's self. Is it OK? example:

{
  "_links": {
    "self": {
      "href": "/todos/"
    }
  },
  "_embedded": {
    "self": [
      {
        "Title": "task 1",
        "Done": true
      },
      {
        "Title": "task 2",
        "Done": false
      }
    ]
  }
}

0

There are 0 answers