(((meta (@ (content . "API: Determine a role zettel") (name . "title"))) (meta (@ (content . "manual") (name . "role"))) (meta (@ (content . "#api #manual #zettelstore") (name . "tags"))) (meta (@ (content . "zmk") (name . "syntax"))) (meta (@ (content . "00001005090000 00001012000000") (name . "back"))) (meta (@ (content . "00001005090000 00001012000000") (name . "backward"))) (meta (@ (content . "1") (name . "box-number"))) (meta (@ (content . "(c) 2020-present by Detlef Stern ") (name . "copyright"))) (meta (@ (content . "20231128183917") (name . "created"))) (meta (@ (content . "00001006020100 00001012920000") (name . "forward"))) (meta (@ (content . "en") (name . "lang"))) (meta (@ (content . "EUPL-1.2-or-later") (name . "license"))) (meta (@ (content . "20231128184701") (name . "modified"))) (meta (@ (content . "20231128184701") (name . "published"))) (meta (@ (content . "public") (name . "visibility")))) (p "The" " " (a (@ (href . "00001012920000")) "endpoint") " " (kbd "/z") " " "also" " " "allows" " " "you" " " "to" " " "determine" " " "a" " " (@L (@H "“") "role" " " "zettel" (@H "”")) "," " " "i.e." " " "a" " " "zettel" " " "that" " " "documents" " " "a" " " "given" " " "role.") (p "The" " " "query" " " "parameter" " " (@L (@H "“") (kbd "role") (@H "”")) " " "allows" " " "you" " " "to" " " "specify" " " "a" " " "value" " " "that" " " "is" " " "interpreted" " " "as" " " "the" " " "name" " " "of" " " "a" " " "role." " " "Zettelstore" " " "tries" " " "to" " " "determine" " " "the" " " "corresponding" " " "role" " " "zettel.") (p "A" " " "role" " " "zettel" " " "is" " " "a" " " "zettel" " " "with" " " "the" " " (a (@ (href . "00001006020100")) (kbd "role")) " " "value" " " (@L (@H "“") "role" (@H "”")) " " "and" " " "a" " " "title" " " "that" " " "names" " " "the" " " "role." " " "If" " " "there" " " "is" " " "more" " " "than" " " "one" " " "zettel" " " "that" " " "qualifies," " " "the" " " "zettel" " " "with" " " "the" " " "highest" " " "zettel" " " "identifier" " " "is" " " "used.") (p "For" " " "example," " " "if" " " "you" " " "want" " " "to" " " "determine" " " "the" " " "role" " " "zettel" " " "for" " " "the" " " "role" " " (@L (@H "“") "manual" (@H "”")) "," " " "your" " " "request" " " "will" " " "be:") (pre (code (@ (class . "language-sh")) "# curl -i 'http://127.0.0.1:23123/z?role=manual'\nHTTP/1.1 302 Found\nContent-Type: text/plain; charset=utf-8\nLocation: /z/20231128184200\nContent-Length: 14\n\n20231128184200")) (p "If" " " "there" " " "is" " " "a" " " "corresponding" " " "role" " " "zettel," " " "the" " " "response" " " "will" " " "use" " " "the" " " "HTTP" " " "status" " " "code" " " "302" " " "(" (@L (@H "“") "Found" (@H "”")) ")," " " "the" " " "HTTP" " " "response" " " "header" " " (kbd "Location") " " "will" " " "contain" " " "the" " " "URL" " " "of" " " "the" " " "role" " " "zettel." " " "Its" " " "zettel" " " "identifier" " " "will" " " "be" " " "returned" " " "in" " " "the" " " "HTTP" " " "response" " " "body.") (p "If" " " "you" " " "specified" " " "some" " " "more" " " "query" " " "parameter," " " "these" " " "will" " " "be" " " "part" " " "of" " " "the" " " "URL" " " "in" " " "the" " " "response" " " "header" " " (kbd "Location") ":") (pre (code (@ (class . "language-sh")) "# curl -i 'http://127.0.0.1:23123/z?role=manual&part=zettel'\nHTTP/1.1 302 Found\nContent-Type: text/plain; charset=utf-8\nLocation: /z/20231128184200?part=zettel\nContent-Length: 14\n\n20231128184200")) (p "Otherwise," " " "if" " " "no" " " "role" " " "zettel" " " "was" " " "found," " " "the" " " "response" " " "will" " " "use" " " "the" " " "HTTP" " " "status" " " "code" " " "404" " " "(" (@L (@H "“") "Not" " " "found" (@H "”")) ").") (pre (code (@ (class . "language-sh")) "# curl -i 'http://127.0.0.1:23123/z?role=norole'\nHTTP/1.1 404 Not Found\nContent-Type: text/plain; charset=utf-8\nContent-Length: 30\n\nRole zettel not found: norole")) (p "To" " " "fulfill" " " "this" " " "service," " " "Zettelstore" " " "will" " " "evaluate" " " "internally" " " "the" " " "query" " " (kbd "role:role title=ROLE") "," " " "there" " " (kbd "ROLE") " " "is" " " "the" " " "actual" " " "role.") (p "Of" " " "course," " " "if" " " "you" " " "are" " " "only" " " "interested" " " "in" " " "the" " " "URL" " " "of" " " "the" " " "role" " " "zettel," " " "you" " " "can" " " "make" " " "use" " " "of" " " "the" " " "HTTP" " " (kbd "HEAD") " " "method:") (pre (code (@ (class . "language-sh")) "# curl -I 'http://127.0.0.1:23123/z?role=manual'\nHTTP/1.1 302 Found\nContent-Type: text/plain; charset=utf-8\nLocation: /z/20231128184200\nContent-Length: 14")) (h2 (@ (id . "http-status-codes")) "HTTP" " " "Status" " " "codes") (dl (dt (kbd "302")) (dd (p "Role" " " "zettel" " " "was" " " "found." " " "The" " " "HTTP" " " "header" " " (kbd "Location") " " "contains" " " "its" " " "URL," " " "the" " " "body" " " "of" " " "the" " " "response" " " "contains" " " "its" " " "zettel" " " "identifier.")) (dt (kbd "404")) (dd (p "No" " " "zettel" " " "for" " " "the" " " "given" " " "role" " " "was" " " "found."))))