(zettel (meta (back "00001012000000") (backward "00001012000000 00001012920000") (box-number "1") (created "20210713150005") (forward "00001006000000 00001006010000 00001006020000 00001006050000 00001012053200 00001012053300 00001012920000 00001012921200 00001012930500") (modified "20231116110417") (published "20231116110417") (role "manual") (syntax "zmk") (tags "#api #manual #zettelstore") (title "API: Update a zettel")) (rights 4) (encoding "") (content "Updating metadata and content of a zettel is technically quite similar to [[creating a new zettel|00001012053200]].\nIn both cases you must provide the data for the new or updated zettel in the body of the HTTP request.\n\nOne difference is the endpoint.\nThe [[endpoint|00001012920000]] to update a zettel is ''/z/{ID}'', where ''{ID}'' is a placeholder for the [[zettel identifier|00001006050000]].\nYou must send a HTTP PUT request to that endpoint.\n\nThe zettel must be encoded in a [[plain|00001006000000]] format: first comes the [[metadata|00001006010000]] and the following content is separated by an empty line.\nThis is the same format as used by storing zettel within a [[directory box|00001006010000]].\n\n```\n# curl -X PUT --data $'title: Updated Note\\n\\nUpdated content.' http://127.0.0.1:23123/z/00001012054200\n```\n\n=== Data input\nAlternatively, you may encode the zettel as a parseable object / a [[symbolic expression|00001012930500]] by providing the query parameter ''enc=data''.\nThe encoding is the same as the data output encoding when you [[retrieve a zettel|00001012053300#data-output]].\n\nThe encoding for [[access rights|00001012921200]] must be given, but is ignored.\nYou may encode computed or property [[metadata keys|00001006020000]], but these are also ignored.\n\n=== HTTP Status codes\n; ''204''\n: Update was successful, there is no body in the response.\n; ''400''\n: Request was not valid.\n For example, the request body was not valid.\n; ''403''\n: You are not allowed to delete the given zettel.\n; ''404''\n: Zettel not found.\n You probably used a zettel identifier that is not used in the Zettelstore."))