(((meta (@ (content . "API: Retrieve references of an existing zettel") (name . "title"))) (meta (@ (content . "manual") (name . "role"))) (meta (@ (content . "#api #manual #zettelstore") (name . "tags"))) (meta (@ (content . "zmk") (name . "syntax"))) (meta (@ (content . "00001012000000") (name . "back"))) (meta (@ (content . "00001012000000 00001012920000") (name . "backward"))) (meta (@ (content . "1") (name . "box-number"))) (meta (@ (content . "(c) 2020-present by Detlef Stern ") (name . "copyright"))) (meta (@ (content . "20250415154139") (name . "created"))) (meta (@ (content . "00001006000000 00001006030000 00001006035000 00001006050000 00001007031100 00001007040310 00001007040320 00001008010500 00001010040100 00001012050200 00001012920000 00001012930500") (name . "forward"))) (meta (@ (content . "en") (name . "lang"))) (meta (@ (content . "EUPL-1.2-or-later") (name . "license"))) (meta (@ (content . "20250416181257") (name . "modified"))) (meta (@ (content . "20250416181257") (name . "published"))) (meta (@ (content . "public") (name . "visibility")))) (p "The " (a (@ (href . "00001012920000")) "endpoint") " to retrieve references of a specific zettel is " (kbd "/r/{ID}") ", where " (kbd "{ID}") " is a placeholder for the " (a (@ (href . "00001006050000")) "zettel identifier") ".") (p "A zettel may contain references to external material, in the form of an URI." " " "External material may be referenced via Zettelmarkup " (a (@ (href . "00001007040310")) "links") ", " (a (@ (href . "00001007040320")) "inline embedding") ", or a " (a (@ (href . "00001007031100")) "block transclusion") "." " " "It may also be referenced within the " (a (@ (href . "00001006000000")) "metadata") " of a zettel, when a key of " (a (@ (href . "00001006030000")) "type") " " (a (@ (href . "00001006035000")) "URL") " is given.") (p "To calculate the references of a zettel, its " (a (@ (href . "00001006000000")) "parsed") " form is used.") (p "For example, to retrieve references of the zettel about " (a (@ (href . "00001008010500")) "CommonMark") ", just send a HTTP GET request to the endpoint " (kbd "/r/00001008010500") (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/r/00001008010500'\nhttps://commonmark.org/\nhttps://commonmark.org/\nhttps://xkcd.com/927/\nhttps://github.github.com/gfm/\nhttps://spec.commonmark.org/0.31.2/\nhttps://github.com/yuin/goldmark")) (p "If you just want metadata external references, add a query parameter " (kbd "part=meta") ":") (pre (code (@ (class . "language-sh")) "# curl 'http://127.0.0.1:23123/r/00001008010500?part=meta'\nhttps://commonmark.org/")) (p "Similarly, to retrieve only references of the zettel content, use the query parameter " (kbd "part=content") ":") (pre (code (@ (class . "language-sh")) "# curl 'http://127.0.0.1:23123/r/00001008010500?part=content'\nhttps://commonmark.org/\nhttps://xkcd.com/927/\nhttps://github.github.com/gfm/\nhttps://spec.commonmark.org/0.31.2/\nhttps://github.com/yuin/goldmark")) (p "These examples should make clean, that no duplicates are removed and no sorting takes place." " " "The client must handle this, e.g.:") (pre (code (@ (class . "language-sh")) "# curl 'http://127.0.0.1:23123/r/00001008010500' | sort -u\nhttps://commonmark.org/\nhttps://github.com/yuin/goldmark\nhttps://github.github.com/gfm/\nhttps://spec.commonmark.org/0.31.2/\nhttps://xkcd.com/927/")) (p "If you add the query parameter " (kbd "enc=data") ", the result will be encoded as a " (a (@ (href . "00001012930500")) "symbolic expression") ":") (pre (code (@ (class . "language-sh")) "# curl 'http://127.0.0.1:23123/r/00001008010500?enc=data'\n(\"https://commonmark.org/\" \"https://commonmark.org/\" \"https://xkcd.com/927/\" \"https://github.github.com/gfm/\" \"https://spec.commonmark.org/0.31.2/\" \"https://github.com/yuin/goldmark\")")) (p "Of course, you can combine the different query parameters, e.g. to retrieve an Sx list of all metadata URIs.") (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." (br) "There are several reasons for this." " " "Maybe the zettel identifier did not consist of exactly 14 digits or " (kbd "enc") " / " (kbd "part") " contained illegal values.")) (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."))))