(BLOCK (PARA (TEXT "The ") (LINK-ZETTEL () "00001012920000" (TEXT "endpoint")) (TEXT " ") (LITERAL-INPUT () "/z") (TEXT " also allows you to determine a ") (FORMAT-QUOTE () (TEXT "tag zettel")) (TEXT ", i.e. a zettel that documents a given tag.")) (PARA (TEXT "The query parameter ") (FORMAT-QUOTE () (LITERAL-INPUT () "tag")) (TEXT " allows you to specify a value that is interpreted as the name of a tag.") (SOFT) (TEXT "Zettelstore tries to determine the corresponding tag zettel.")) (PARA (TEXT "A tag zettel is a zettel with the ") (LINK-ZETTEL () "00001006020100" (LITERAL-INPUT () "role")) (TEXT " value ") (FORMAT-QUOTE () (TEXT "tag")) (TEXT " and a title that names the tag.") (SOFT) (TEXT "If there is more than one zettel that qualifies, the zettel with the highest zettel identifier is used.")) (PARA (TEXT "For example, if you want to determine the tag zettel for the tag ") (FORMAT-QUOTE () (TEXT "#api")) (TEXT ", your request will be:")) (VERBATIM-CODE (("" . "sh")) "# curl -i 'http://127.0.0.1:23123/z?tag=%23api'\nHTTP/1.1 302 Found\nContent-Type: text/plain; charset=utf-8\nLocation: /z/00001019990010\nContent-Length: 14\n\n00001019990010") (PARA (TEXT "Alternatively, you can omit the ") (LITERAL-INPUT () "#") (TEXT " character at the beginning of the tag:")) (VERBATIM-CODE (("" . "sh")) "# curl -i 'http://127.0.0.1:23123/z?tag=api'\nHTTP/1.1 302 Found\nContent-Type: text/plain; charset=utf-8\nLocation: /z/00001019990010\nContent-Length: 14\n\n00001019990010") (PARA (TEXT "If there is a corresponding tag zettel, the response will use the HTTP status code 302 (") (FORMAT-QUOTE () (TEXT "Found")) (TEXT "), the HTTP response header ") (LITERAL-INPUT () "Location") (TEXT " will contain the URL of the tag zettel.") (SOFT) (TEXT "Its zettel identifier will be returned in the HTTP response body.")) (PARA (TEXT "If you specified some more query parameter, these will be part of the URL in the response header ") (LITERAL-INPUT () "Location") (TEXT ":")) (VERBATIM-CODE (("" . "sh")) "# curl -i 'http://127.0.0.1:23123/z?tag=%23api&part=zettel'\nHTTP/1.1 302 Found\nContent-Type: text/plain; charset=utf-8\nLocation: /z/00001019990010?part=zettel\nContent-Length: 14\n\n00001019990010") (PARA (TEXT "Otherwise, if no tag zettel was found, the response will use the HTTP status code 404 (") (FORMAT-QUOTE () (TEXT "Not found")) (TEXT ").")) (VERBATIM-CODE (("" . "sh")) "# curl -i 'http://127.0.0.1:23123/z?tag=notag'\nHTTP/1.1 404 Not Found\nContent-Type: text/plain; charset=utf-8\nContent-Length: 29\n\nTag zettel not found: #notag") (PARA (TEXT "To fulfill this service, Zettelstore will evaluate internally the query ") (LITERAL-INPUT () "role:tag title=TAG") (TEXT ", there ") (LITERAL-INPUT () "TAG") (TEXT " is the actual tag.")) (PARA (TEXT "Of course, if you are interested in the URL of the tag zettel, you can make use of the HTTP ") (LITERAL-INPUT () "HEAD") (TEXT " method:")) (VERBATIM-CODE (("" . "sh")) "# curl -I 'http://127.0.0.1:23123/z?tag=%23api'\nHTTP/1.1 302 Found\nContent-Type: text/plain; charset=utf-8\nLocation: /z/00001019990010\nContent-Length: 14") (HEADING 1 () "http-status-codes" "http-status-codes" (TEXT "HTTP Status codes")) (DESCRIPTION ((LITERAL-INPUT () "302")) (BLOCK (BLOCK (PARA (TEXT "Tag zettel was found.") (SOFT) (TEXT "The HTTP header ") (LITERAL-INPUT () "Location") (TEXT " contains its URL, the body of the response contains its zettel identifier.")))) ((LITERAL-INPUT () "404")) (BLOCK (BLOCK (PARA (TEXT "No zettel for the given tag was found."))))))