Implementing a Receiver
This guide lists what an inbox does with each request. It adds no rules: each step links to the one it comes from. This order works, but the specification does not require it.
- Check the headers. Answer a wrong
Content-Typewith415 Unsupported Media Type. - Verify the signature. Verify it against the raw body, answer a failure with
401 Unauthorized, and answer a repeated signature with a2xxstatus code without processing it. - Validate the body. Answer a body that is not JSON with
400 Bad Requestand an invalid entity with422 Unprocessable Entity, and handle an unknown type by what kind of type it is. - Check the author. An entity’s
authormust belong to the signing instance. - Apply the entity. Processing must be idempotent, a new version replaces the copy you hold, and an entity with nothing to apply to is ignored.
- Send the response. The inbox should answer with
202 Acceptedand no body.
Checks can run after the response has been sent, but they can then no longer report a problem, so the entity is dropped instead.