API: Update a zettel

00001012054200 · Info · (manual) · #api #manual #zettelstore (all)

Updating metadata and content of a zettel is technically quite similar to creating a new zettel. In both cases you must provide the data for the new or updated zettel in the body of the HTTP request.

One difference is the endpoint. The endpoint to update a zettel is /z/{ID}, where {ID} is a placeholder for the zettel identifier. You must send a HTTP PUT request to that endpoint.

The zettel must be encoded in a plain format: first comes the metadata and the following content is separated by an empty line. This is the same format as used by storing zettel within a directory box.

# curl -X PUT --data $'title: Updated Note\n\nUpdated content.' http://127.0.0.1:23123/z/00001012054200

Data input

Alternatively, you may encode the zettel as a parseable object / a symbolic expression by providing the query parameter enc=data. The encoding is the same as the data output encoding when you retrieve a zettel.

The encoding for access rights must be given, but is ignored. You may encode computed or property metadata keys, but these are also ignored.

HTTP Status codes

204

Update was successful, there is no body in the response.

400

Request was not valid. For example, the request body was not valid.

403

You are not allowed to delete the given zettel.

404

Zettel not found. You probably used a zettel identifier that is not used in the Zettelstore.