1

Following the HAL specification should the self link contain the query parameter or is it ok to link to the first page? Thanks

Follows an example:

Request:

my-service/movies/123/subtitles?page=3

Actual JSON response:

{
  "count": 20,
  "pagingSize": 5,
  "_links": {
    "next": {
      "href": "/my-service/movies/123/subtitles?page=4"
    },
    "previous": {
      "href": "/my-service/movies/123/subtitles?page=2"
    },
    "self": {
      "href": "/my-service/movies/123/subtitles"
    },
    "movie": {
      "href": "/my-service/movies/123"
    }
  },
  "_embedded": {
    "subtitles": [
      {
        "id": "111",
        "_links": {
          "self": {
            "href": "/my-service/subtitles/111"
          }
        }
      },
      ...    
      {
        "id": "222",
        "_links": {
          "self": {
            "href": "/my-service/subtitles/222"
          }
        }
      }
    ]
  }
}
Community
  • 1
  • 1
Gabe
  • 5,997
  • 5
  • 46
  • 92

1 Answers1

2

The Hypertext Application Language (HAL) proposed draft specification enforces the "href" in conformity with the "Target IRI" defined in Web Linking specification (RFC 5988).

Applications that don't wish to register a relation type can use an extension relation type, which is a URI [RFC3986] that uniquely identifies the relation type.

So I'd say that the self value must be unique, and thus include any (unspecified optional) query parameters.

Community
  • 1
  • 1
Alexandru Marculescu
  • 5,569
  • 6
  • 34
  • 50