microsoft / microsoft/api-guidelines
When creating a resource that returns an empty body, should 201 or 204 win?
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 23.3k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
It feels like to me that a 201 should win as a client can always look at the content-length to know there is no body.
However, in the section on managing webhook subscriptions, the guidelines say:
The service MUST return an empty body and 204 No Content to indicate a successful patch
If we apply this rigidly, it means that if the subscription API supported "upserts" then we wouldn't be able to return a 201 to indicate creation.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the webhook subscriptions section and compare its requirement for an empty body with the issue's 201-versus-204 upsert question. Review the six existing comments for a settled interpretation; done means the guidelines explicitly resolve which status applies when creation returns no body.
Written by the indexing model from the issue text.
Assessment
- Domain
- api, documentation
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100