(((meta (@ (content . "API: Update a zettel") (name . "title"))) (meta (@ (content . "manual") (name . "role"))) (meta (@ (content . "#api #manual #zettelstore") (name . "tags"))) (meta (@ (content . "zmk") (name . "syntax"))) (meta (@ (content . "00001012000000") (name . "back"))) (meta (@ (content . "00001012000000 00001012920000") (name . "backward"))) (meta (@ (content . "1") (name . "box-number"))) (meta (@ (content . "(c) 2020-present by Detlef Stern ") (name . "copyright"))) (meta (@ (content . "20210713150005") (name . "created"))) (meta (@ (content . "00001006000000 00001006010000 00001006020000 00001006050000 00001012053200 00001012053300 00001012920000 00001012921200 00001012930500") (name . "forward"))) (meta (@ (content . "en") (name . "lang"))) (meta (@ (content . "EUPL-1.2-or-later") (name . "license"))) (meta (@ (content . "20231116110417") (name . "modified"))) (meta (@ (content . "20231116110417") (name . "published"))) (meta (@ (content . "public") (name . "visibility")))) (p "Updating metadata and content of a zettel is technically quite similar to " (a (@ (href . "00001012053200")) "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.") (p "One difference is the endpoint." " " "The " (a (@ (href . "00001012920000")) "endpoint") " to update a zettel is " (kbd "/z/{ID}") ", where " (kbd "{ID}") " is a placeholder for the " (a (@ (href . "00001006050000")) "zettel identifier") "." " " "You must send a HTTP PUT request to that endpoint.") (p "The zettel must be encoded in a " (a (@ (href . "00001006000000")) "plain") " format: first comes the " (a (@ (href . "00001006010000")) "metadata") " and the following content is separated by an empty line." " " "This is the same format as used by storing zettel within a " (a (@ (href . "00001006010000")) "directory box") ".") (pre (code "# curl -X PUT --data $'title: Updated Note\\n\\nUpdated content.' http://127.0.0.1:23123/z/00001012054200")) (h2 (@ (id . "data-input")) "Data input") (p "Alternatively, you may encode the zettel as a parseable object / a " (a (@ (href . "00001012930500")) "symbolic expression") " by providing the query parameter " (kbd "enc=data") "." " " "The encoding is the same as the data output encoding when you " (a (@ (href . "00001012053300#data-output")) "retrieve a zettel") ".") (p "The encoding for " (a (@ (href . "00001012921200")) "access rights") " must be given, but is ignored." " " "You may encode computed or property " (a (@ (href . "00001006020000")) "metadata keys") ", but these are also ignored.") (h2 (@ (id . "http-status-codes")) "HTTP Status codes") (dl (dt (kbd "204")) (dd (p "Update was successful, there is no body in the response.")) (dt (kbd "400")) (dd (p "Request was not valid." " " "For example, the request body was not valid.")) (dt (kbd "403")) (dd (p "You are not allowed to delete the given zettel.")) (dt (kbd "404")) (dd (p "Zettel not found." " " "You probably used a zettel identifier that is not used in the Zettelstore."))))