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)
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
Updated•10 years ago
|
Component: General → BrowserCompat
Comment 1•10 years ago
|
||
I guess you haven't created appropriate HTTP responses. You could send a 204 which expects no response body at all, and send a
Comment 2•10 years ago
|
||
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)
| Reporter | ||
Comment 3•10 years ago
|
||
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)
Updated•10 years ago
|
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]
| Reporter | ||
Updated•10 years ago
|
Mentor: jwhitlock
Comment 4•10 years ago
|
||
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)
| Reporter | ||
Comment 5•10 years ago
|
||
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]
| Reporter | ||
Updated•10 years ago
|
Flags: needinfo?(jwhitlock)
| Reporter | ||
Updated•9 years ago
|
Mentor: jwhitlock
| Reporter | ||
Comment 6•9 years ago
|
||
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
Updated•6 years ago
|
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•