Closed Bug 1159363 Opened 11 years ago Closed 9 years ago

Add Location header to resource-creating POST responses

Categories

(developer.mozilla.org Graveyard :: BrowserCompat, enhancement)

All
Other
enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: jwhitlock, Unassigned)

References

Details

(Whiteboard: [bc:infra][bc:milestone=spaceship])

What problem would this feature solve? ====================================== An API client creating a resource via POST to the list view has to construct the URL of the created resource from the response data. Who has this problem? ===================== API Client writers How do you know that the users identified above have this problem? ================================================================== I do not. The API is being built, and there are currently no client writers. How are the users identified above solving this problem now? ============================================================ The API response JSON includes the data needed to determine the URL, but requires more code than reading a header. Do you have any suggestions for solving the problem? Please explain in detail. ============================================================================== Add the Location header in POST responses, to the URL of the newly created resource. Is there anything else we should know? ====================================== Django REST Framework has hooks for adding a Location header for other JSON formats: https://github.com/tomchristie/django-rest-framework/blob/master/rest_framework/mixins.py#L27
Blocks: 996570
Component: General → BrowserCompat
I guess you haven't created appropriate HTTP responses. You could send a 204 which expects no response body at all, and send a
Sorry for previous comment, I didn't expect Bugzilla would send the comment from "save changes" on top. Is this task because the API has no 2xx HTTP response such as Created done yet?
Flags: needinfo?(jwhitlock)
The response is a 201 Created, without a Location header, and the resource JSON as the body: http://browsercompat.readthedocs.org/en/latest/draft/resources.html#create The bug is to add a Location header, so that the client doesn't have to construct it from the resource JSON.
Flags: needinfo?(jwhitlock)
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: [Compat Data] Add Location header to resource-creating POST responses → Add Location header to resource-creating POST responses
Whiteboard: [specification][type:feature] → [bc:infra]
Mentor: jwhitlock
John, is this needed for the C&M GUI work Stephanie is doing? Or is it something more like a nice to have?
Flags: needinfo?(jwhitlock)
It's a nice to have for now, and can be assigned to a late milestone (added it to spaceship). If the C&M GUI requires it, we can reprioritize. The JSON API v1.0 spec refers to it as a SHOULD: http://jsonapi.org/format/#crud-creating-responses-201 "The response SHOULD include a Location header identifying the location of the newly created resource."
Whiteboard: [bc:infra] → [bc:infra][bc:milestone=spaceship]
Flags: needinfo?(jwhitlock)
Mentor: jwhitlock
The BrowserCompat project is canceled. See https://github.com/mdn/browsercompat for current effort. Bulk status change includes the random word TEMPOTHRONE.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WONTFIX
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.