(zettel (meta (back "00001012000000") (backward "00001012000000 00001012920000") (box-number "1") (created "20210126175322") (folge "00001012051400") (forward "00001006050000 00001007700000 00001007702000 00001010040100 00001010070200 00001012050200 00001012051400 00001012920000 00001012921200 00001012930500") (modified "20230807170810") (published "20230807170810") (role "manual") (syntax "zmk") (tags "#api #manual #zettelstore") (title "API: List all zettel")) (rights 4) (encoding "") (content "To list all zettel just send a HTTP GET request to the [[endpoint|00001012920000]] ''/z''[^If [[authentication is enabled|00001010040100]], you must include the a valid [[access token|00001012050200]] in the ''Authorization'' header].\nAlways use the endpoint ''/z'' to work with a list of zettel.\n\nWithout further specifications, a plain text document is returned, with one line per zettel.\nEach line contains in the first 14 characters the [[zettel identifier|00001006050000]].\nSeparated by a space character, the title of the zettel follows:\n\n```sh\n# 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...\n```\n\nThe list is **not** sorted, even in the these examples where it appears to be sorted.\nIf you want to have it ordered, you must specify it with the help of a [[query expression|00001007700000]] / [[search term|00001007702000]].\nSee [[Query the list of all zettel|00001012051400]] how to do it.\n\n=== Data output\n\nAlternatively, you may retrieve the zettel list as a parseable object / a [[symbolic expression|00001012930500]] by providing the query parameter ''enc=data'':\n\n```sh\n# curl 'http://127.0.0.1:23123/z?enc=data'\n(meta-list (query \"\") (human \"\") (list (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\") ...\n```\n\nPretty-printed, this results in:\n```\n(meta-list (query \"\")\n (human \"\")\n (list (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```\n\n* The result is a list, starting with the symbol ''meta-list''.\n* Then, some key/value pairs are following, also nested.\n* Keys ''query'' and ''human'' will be explained [[later in this manual|00001012051400]].\n* ''list'' starts a list of zettel.\n* ''zettel'' itself start, well, a zettel.\n* ''id'' denotes the zettel identifier, encoded as a string.\n* Nested in ''meta'' are the metadata, each as a key/value pair.\n* ''rights'' specifies the [[access rights|00001012921200]] the user has for this zettel.\n\n=== Note\nThis request (and similar others) will always return a list of metadata, provided the request was syntactically correct.\nThere will never be a HTTP status code 403 (Forbidden), even if [[authentication was enabled|00001010040100]] and you did not provide a valid access token.\nIn this case, the resulting list might be quite short (some zettel will have [[public visibility|00001010070200]]) or the list might be empty.\n\nWith this call, you cannot differentiate between an empty result list (e.g because your search did not found a zettel with the specified term) and an empty list because of missing authorization (e.g. an invalid access token).\n\n=== HTTP Status codes\n; ''200''\n: Retrieval was successful, the body contains an appropriate data value.\n; ''400''\n: Request was not valid. \n There are several reasons for this.\n Maybe the access bearer token was not valid."))