((p "The " (a (@ (href . "00001012920000")) "endpoint") " to work with metadata and content of a specific zettel is " (kbd "/z/{ID}") ", where " (kbd "{ID}") " is a placeholder for the " (a (@ (href . "00001006050000")) "zettel identifier") ".") (p "For example, to retrieve some data about this zettel you are currently viewing, just send a HTTP GET request to the endpoint " (kbd "/z/00001012053300") (sup (@ (id . "fnref:1")) (a (@ (class . "zs-noteref") (href . "#fn:1") (role . "doc-noteref")) "1")) ".") (pre (code (@ (class . "language-sh")) "# curl 'http://127.0.0.1:23123/z/00001012053300'\nThe [[endpoint|00001012920000]] to work with metadata and content of a specific zettel is ''/z/{ID}'', where ''{ID}'' is a placeholder for the [[zettel identifier|00001006050000]].\n\nFor example, to retrieve some data about this zettel you are currently viewing, just send a HTTP GET request to the endpoint ''/z/00001012053300''[^If [[authentication is enabled|00001010040100]], you must include the a valid [[access token|00001012050200]] in the ''Authorization'' header].\n\n```sh\n...")) (p "Optionally, you may provide which parts of the zettel you are requesting." " " "In this case, add an additional query parameter " (kbd "part=PART") "." " " "Valid values for " (a (@ (href . "00001012920800")) (kbd "PART")) " are " (@L (@H "“") "zettel" (@H "”")) ", " (@L (@H "“") (a (@ (href . "00001012053400")) "meta") (@H "”")) ", and " (@L (@H "“") "content" (@H "”")) " (the default value).") (pre (code (@ (class . "language-sh")) "# curl 'http://127.0.0.1:23123/z/00001012053300?part=zettel'\ntitle: API: Retrieve metadata and content of an existing zettel\nrole: manual\ntags: #api #manual #zettelstore\nsyntax: zmk\n\nThe [[endpoint|00001012920000]] to work with metadata and content of a specific zettel is ''/z/{ID}'', where ''{ID}'' is a placeholder for the [[zettel identifier|00001006050000]].\n\nFor example, to retrieve some data about this zettel you are currently viewing, just send a HTTP GET request to the endpoint\n...")) (h2 (@ (id . "data-output")) "Data output") (p "Alternatively, you may retrieve the zettel as a parseable object / a " (a (@ (href . "00001012930500")) "symbolic expression") " by providing the query parameter " (kbd "enc=data") ":") (pre (code (@ (class . "language-sh")) "# curl 'http://127.0.0.1:23123/z/00001012053300?enc=data&part=zettel'\n(zettel (meta (back \"00001006000000 00001012000000 00001012053200 00001012054400\") (backward \"00001006000000 00001012000000 00001012053200 00001012054400 00001012920000\") (box-number \"1\") (created \"20211004093206\") (forward \"00001006020000 00001006050000 00001010040100 00001012050200 00001012053400 00001012920000 00001012920800 00001012921200 00001012930500\") (modified \"20230703174152\") (published \"20230703174152\") (role \"manual\") (syntax \"zmk\") (tags \"#api #manual #zettelstore\") (title \"API: Retrieve metadata and content of an existing zettel\")) (rights 62) (encoding \"\") (content \"The [[endpoint|00001012920000]] to work with metadata and content of a specific zettel is ''/z/{ID}'', where ''{ID}'' is a placeholder for the [[zettel identifier|00001006050000]].\\n\\nFor example, ...")) (p "If you print the result a little bit nicer, you will see its structure:") (pre (code "(zettel (meta (back \"00001006000000 00001012000000 00001012053200 00001012054400\")\n (backward \"00001006000000 00001012000000 00001012053200 00001012054400 00001012920000\")\n (box-number \"1\")\n (created \"20211004093206\")\n (forward \"00001006020000 00001006050000 00001010040100 00001012050200 00001012053400 00001012920000 00001012920800 00001012921200 00001012930500\")\n (modified \"20230703174152\")\n (published \"20230703174152\")\n (role \"manual\")\n (syntax \"zmk\")\n (tags \"#api #manual #zettelstore\")\n (title \"API: Retrieve metadata and content of an existing zettel\"))\n (rights 62)\n (encoding \"\")\n (content \"The [[endpoint|00001012920000]] to work with metadata and content of a specific zettel is ''/z/{ID}'', where ''{ID}'' is a placeholder for the [[zettel identifier|00001006050000]].\\n\\nFor example, ...")) (ul (li "The result is a list, starting with the symbol " (kbd "zettel") ".") (li "Then, some key/value pairs are following, also nested.") (li "Nested in " (kbd "meta") " are the metadata, each as a key/value pair.") (li (kbd "rights") " specifies the " (a (@ (href . "00001012921200")) "access rights") " the user has for this zettel.") (li (kbd "\"encoding\"") " states how the content is encoded." " " "Currently, only two values are allowed: the empty string (" (kbd "\"\"") ") that specifies an empty encoding, and the string " (kbd "\"base64\"") " that specifies the " (a (@ (href . "https://www.rfc-editor.org/rfc/rfc4648.txt") (rel . "external")) "standard Base64 encoding") ".") (li "The zettel contents is stored as a value of the key " (kbd "content") "." " " "Typically, text content is not encoded, and binary content is encoded via Base64.")) (h2 (@ (id . "http-status-codes")) "HTTP Status codes") (dl (dt (kbd "200")) (dd (p "Retrieval was successful, the body contains an appropriate data value.")) (dt (kbd "204")) (dd (p "Request was valid, but there is no data to be returned." " " "Most likely, you specified the query parameter " (kbd "part=content") ", but the zettel does not contain any content.")) (dt (kbd "400")) (dd (p "Request was not valid." (br) "There are several reasons for this." " " "Maybe the " (a (@ (href . "00001006050000")) "zettel identifier") " did not consists of exactly 14 digits.")) (dt (kbd "403")) (dd (p "You are not allowed to retrieve data of the given zettel.")) (dt (kbd "404")) (dd (p "Zettel not found." " " "You probably used a zettel identifier that is not used in the Zettelstore."))))