Skip to content

Support for the Link-Template HTTP Header Field (RFC 9652) #6924

Open
@Spomky

Description

@Spomky

Hello,

I recently came across RFC 9652, which introduces the Link-Template HTTP header field. This header allows describing the structure of a link between resources using URI templates, making it possible to generate new links dynamically.

While exploring this idea, I noticed that API Platform already supports the itemUriTemplate property for the PHP Post attribute. This property could serve as an excellent starting point for implementing Link-Template, and perhaps the concept of URI templates could be generalized to all operations. Additionally, the inclusion of parameters as defined in the RFC could make this feature even more powerful.

Example:
For a resource /books/{book_id}, API Platform could emit a header like this:

Link-Template: "/books/{book_id}/author"; rel="author"; anchor="#{book_id}"

This would indicate to clients how to construct links to an author resource dynamically based on a book's ID.

❓ Question: Would this feature align with the project's long-term goals?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions