Delete

A delete endpoint is a write that removes a record from one collection, found by its id. It is the simplest endpoint: a collection and a permission. It is the datahoster-endpoint-delete.json file in an endpoint folder; its presence makes that endpoint answer a DELETE that removes a record.

{
  "datahoster-endpoint-delete-collection": "messages",
  "datahoster-endpoint-delete-public": false,
  "datahoster-endpoint-delete-users": ["you"]
}
A remove endpoint: only you may delete a message by id.

Contents

The file is one JSON object; its keys are fixed names starting with datahoster-endpoint-delete-. The example above, in a remove/ endpoint, lets you remove a message.

NameTypeDescription
datahoster-endpoint-delete-collectiontextThe collection a record is removed from. Required.
datahoster-endpoint-delete-publicbooleanWhether anyone may call it, with no token. Defaults to false.
datahoster-endpoint-delete-usersarrayThe users who may call it, each proving a token. Defaults to [].

HTTP request

DELETE the endpoint's path, at <domain>/<endpoint>, with the record's id as a query parameter. If the endpoint is not public, send the user's token as a bearer token. A request that is not allowed — no token where one is needed, a wrong token, or a user this endpoint does not list — gets the same 404 as a path with no endpoint.

DELETE https://api.example.com/remove?id=9f86d081884c7d659a2feaa0c55ad015
Authorization: Bearer k7Qw2f9xJ4mB6pR8tZ1nD3sV5hL0aYc
Removing a message by its id.
StatusMeaning
204The record was removed. The response has no body.
400The id is missing or malformed.
404No delete endpoint answers on this path, no record has that id, or the caller is not allowed it — a missing token, an invalid one, or a user the endpoint does not list. These are indistinguishable, so a probe cannot tell the endpoint is there.