((p "To list all zettel just send an HTTP GET request to the " (a ((href . "00001012920000")) "endpoint") " " (kbd "/z") (sup ((id . "fnref:1")) (a ((class . "zs-noteref") (href . "#fn:1") (role . "doc-noteref")) "1")) "." " " "Always use the endpoint " (kbd "/z") " to work with a list of zettel.") (p "Without further specifications, a plain text document is returned, with one line per zettel." " " "Each line contains in the first 14 characters the " (a ((href . "00001006050000")) "zettel identifier") "." " " "Separated by a space character, the title of the zettel follows:") (pre (code ((class . "language-sh")) "# curl http://127.0.0.1:23123/z\n...\n00001012051200 API: List all zettel\n00001012050600 API: Provide an access token\n00001012050400 API: Renew an access token\n00001012050200 API: Authenticate a client\n...")) (p "The list is " (strong "not") " sorted, even in these examples where it appears to be sorted." " " "If you want to have it ordered, you must specify it with the help of a " (a ((href . "00001007700000")) "query expression") " / " (a ((href . "00001007702000")) "search term") "." " " "See " (a ((href . "00001012051400")) "Query the list of all zettel") " how to do it.") (h2 ((id . "data-output")) "Data output") (p "Alternatively, you may retrieve the zettel list 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?enc=data'\n(meta-list (query \"\") (human \"\") (zettel (id \"00001012921200\") (meta (title \"API: Encoding of Zettel Access Rights\") (role \"manual\") (tags \"#api #manual #reference #zettelstore\") (syntax \"zmk\") (back \"00001012051200 00001012051400 00001012053300 00001012053400 00001012053900 00001012054000\") (backward \"00001012051200 00001012051400 00001012053300 00001012053400 00001012053900 00001012054000\") (box-number \"1\") (created \"00010101000000\") (forward \"00001003000000 00001006020400 00001010000000 00001010040100 00001010040200 00001010070200 00001010070300\") (modified \"20220201171959\") (published \"20220201171959\")) (rights 62)) (zettel (id \"00001007030100\") ...")) (p "Pretty-printed, this results in:") (pre (code "(meta-list (query \"\")\n (human \"\")\n (zettel (id \"00001012921200\")\n (meta (title \"API: Encoding of Zettel Access Rights\")\n (role \"manual\")\n (tags \"#api #manual #reference #zettelstore\")\n (syntax \"zmk\")\n (back \"00001012051200 00001012051400 00001012053300 00001012053400 00001012053900 00001012054000\")\n (backward \"00001012051200 00001012051400 00001012053300 00001012053400 00001012053900 00001012054000\")\n (box-number \"1\")\n (created \"00010101000000\")\n (forward \"00001003000000 00001006020400 00001010000000 00001010040100 00001010040200 00001010070200 00001010070300\")\n (modified \"20220201171959\")\n (published \"20220201171959\"))\n (rights 62))\n (zettel (id \"00001007030100\")\n ...")) (ul (li "The result is a list, starting with the symbol " (kbd "meta-list") ".") (li "Then, some key/value pairs are following, also nested.") (li "Keys " (kbd "query") " and " (kbd "human") " will be explained " (a ((href . "00001012051400")) "later in this manual") ".") (li "Then comes the list of zettel.") (li (kbd "zettel") " itself start, well, a zettel.") (li (kbd "id") " denotes the zettel identifier, encoded as a string.") (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.")) (h2 ((id . "note")) "Note") (p "This request (and similar others) will always return a list of metadata, provided the request was syntactically correct." " " "There will never be an HTTP status code 403 (Forbidden), even if " (a ((href . "00001010040100")) "authentication was enabled") " and you did not provide a valid access token." " " "In this case, the resulting list might be quite short (some zettel will have " (a ((href . "00001010070200")) "public visibility") ") or the list might be empty.") (p "With this call, you cannot differentiate between an empty result list (e.g because your search did not find a zettel with the specified term) and an empty list because of missing authorization (e.g. an invalid access token).") (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 "400")) (dd (p "Request was not valid." " " "There are several reasons for this." " " "Maybe the access bearer token was not valid."))))