0

I know that you can indicate a "type" with a HAL link, like so:

{
    _links: {
        self: {
            href: "http://example.site/api/orders/1",
            hreflang: "en_US",
            type: "application/hal+json"
        }
    }
}

But I'd like to explain the different types that are available at that href. For example, I want to state that both "application/hal+json" and "application/pdf" are valid representations Accept-ed by the resource URI.

Maybe something like:

{
    _links: {
        self: {
            href: "http://example.site/api/orders/1",
            hreflang: "en_US",
            type: [
                "application/hal+json",
                "application/pdf"
            ]
        }
    }
}

or... ?

Is this possible? If so, how?

Mr Mikkél
  • 2,577
  • 4
  • 34
  • 52

1 Answers1

0

HAL uses the Link spec: https://datatracker.ietf.org/doc/html/rfc5988

This spec list only a single type per Link:

The "type" parameter, when present, is a hint indicating what the media type of the result of dereferencing the link should be. Note that this is only a hint; for example, it does not override the Content-Type header of a HTTP response obtained by actually following the link. There MUST NOT be more than one type parameter in a link- value.

Ickbinet
  • 277
  • 3
  • 12