(zettel (meta (back "00001012000000") (backward "00001012000000 00001012920000") (box-number "1") (created "20250415154139") (forward "00001006000000 00001006030000 00001006035000 00001006050000 00001007031100 00001007040310 00001007040320 00001008010500 00001010040100 00001012050200 00001012920000 00001012930500") (modified "20250416181257") (published "20250416181257") (role "manual") (syntax "zmk") (tags "#api #manual #zettelstore") (title "API: Retrieve references of an existing zettel")) (rights 4) (encoding "") (content "The [[endpoint|00001012920000]] to retrieve references of a specific zettel is ''/r/{ID}'', where ''{ID}'' is a placeholder for the [[zettel identifier|00001006050000]].\n\nA zettel may contain references to external material, in the form of an URI.\nExternal material may be referenced via Zettelmarkup [[links|00001007040310]], [[inline embedding|00001007040320]], or a [[block transclusion|00001007031100]].\nIt may also be referenced within the [[metadata|00001006000000]] of a zettel, when a key of [[type|00001006030000]] [[URL|00001006035000]] is given.\n\nTo calculate the references of a zettel, its [[parsed|00001006000000]] form is used.\n\nFor example, to retrieve references of the zettel about [[CommonMark|00001008010500]], just send a HTTP GET request to the endpoint ''/r/00001008010500''[^If [[authentication is enabled|00001010040100]], you must include a valid [[access token|00001012050200]] in the ''Authorization'' header]:\n```sh\n# 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\n```\n\nIf you just want metadata external references, add a query parameter ''part=meta'':\n```sh\n# curl 'http://127.0.0.1:23123/r/00001008010500?part=meta'\nhttps://commonmark.org/\n```\n\nSimilarly, to retrieve only references of the zettel content, use the query parameter ''part=content'':\n```sh\n# 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\n```\n\nThese examples should make clean, that no duplicates are removed and no sorting takes place.\nThe client must handle this, e.g.:\n```sh\n# 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/\n```\n\nIf you add the query parameter ''enc=data'', the result will be encoded as a [[symbolic expression|00001012930500]]:\n```sh\n# 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\")\n```\n\nOf course, you can combine the different query parameters, e.g. to retrieve an Sx list of all metadata URIs.\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 zettel identifier did not consist of exactly 14 digits or ''enc'' / ''part'' contained illegal values.\n; ''403''\n: You are not allowed to retrieve data of the given zettel.\n; ''404''\n: Zettel not found.\n You probably used a zettel identifier that is not used in the Zettelstore."))