API: Retrieve references of an existing zettel
The endpoint to retrieve references of a specific zettel is /r/{ID}, where {ID} is a placeholder for the zettel identifier.
A zettel may contain references to external material, in the form of an URI. External material may be referenced via Zettelmarkup links, inline embedding, or a block transclusion. It may also be referenced within the metadata of a zettel, when a key of type URL is given.
To calculate the references of a zettel, its parsed form is used.
For example, to retrieve references of the zettel about CommonMark, just send a HTTP GET request to the endpoint /r/000010080105001:
# curl 'http://127.0.0.1:23123/r/00001008010500'
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
If you just want metadata external references, add a query parameter part=meta:
# curl 'http://127.0.0.1:23123/r/00001008010500?part=meta'
https://commonmark.org/
Similarly, to retrieve only references of the zettel content, use the query parameter part=content:
# curl 'http://127.0.0.1:23123/r/00001008010500?part=content'
https://commonmark.org/
https://xkcd.com/927/
https://github.github.com/gfm/
https://spec.commonmark.org/0.31.2/
https://github.com/yuin/goldmark
These examples should make clean, that no duplicates are removed and no sorting takes place. The client must handle this, e.g.:
# curl 'http://127.0.0.1:23123/r/00001008010500' | sort -u
https://commonmark.org/
https://github.com/yuin/goldmark
https://github.github.com/gfm/
https://spec.commonmark.org/0.31.2/
https://xkcd.com/927/
If you add the query parameter enc=data, the result will be encoded as a symbolic expression:
# curl 'http://127.0.0.1:23123/r/00001008010500?enc=data'
("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")
Of course, you can combine the different query parameters, e.g. to retrieve an Sx list of all metadata URIs.
HTTP Status codes
- 200
Retrieval was successful, the body contains an appropriate data value.
- 400
Request was not valid.
There are several reasons for this. Maybe the zettel identifier did not consist of exactly 14 digits or enc / part contained illegal values.- 403
You are not allowed to retrieve data of the given zettel.
- 404
Zettel not found. You probably used a zettel identifier that is not used in the Zettelstore.
- If authentication is enabled, you must include a valid access token in the Authorization header ↩︎