Skip to content

Media Type for Action Responses #88

@dominicbarnes

Description

@dominicbarnes

In my siren client, I've been setting Accept: application/vnd.siren+json for all requests. Since I was generally just navigating an API from entity to entity, this was a very straightforward thing to do in early versions. However, links and embedded entities can specify the media type for the resource that will be found at the given URL. Because of this, I'm changing my client logic to set the Accept header more intelligently in these cases.

I'm finding actions to be different in regards to content-negotiation. They can specify a media type for the request body, but not for the response body. The spec doesn't make any mention of what media type an action should be met with, and it seems like another siren entity is a pretty common use-case. (though I'm sure not the only use-case) In lieu of nothing being specified, I will probably use Accept: application/vnd.siren+json for my API actions, but I wonder if this is something the siren spec should at least mention?

As for my ultimate question/proposal: should actions be able to specify a media type for the response body? (this would be an addition to the spec, of course) Or should a siren-based client submit actions with the expectation that the response will be another siren entity?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions