API: Retrieve metadata of an existing zettel

00001012053400 · Info · (manual) · #api #manual #zettelstore (all)

The endpoint to work with metadata of a specific zettel is /z/{ID}, where {ID} is a placeholder for the zettel identifier1.

To retrieve the plain metadata of a zettel, use the query parameter part=meta

# curl 'http://127.0.0.1:23123/z/00001012053400?part=meta'
title: API: Retrieve metadata of an existing zettel
role: manual
tags: #api #manual #zettelstore
syntax: zmk

Data output

Alternatively, you may retrieve the zettel as a parseable object / a symbolic expression by providing the query parameter enc=data:

# curl 'http://127.0.0.1:23123/z/00001012053400?part=meta&enc=data'
(list (meta (title "API: Retrieve metadata of an existing zettel") (role "manual") (tags "#api #manual #zettelstore") (syntax "zmk") (back "00001012000000 00001012053300") (backward "00001012000000 00001012053300") (box-number "1") (created "20210726174524") (forward "00001006020000 00001006050000 00001010040100 00001012050200 00001012920000 00001012921200") (modified "20230703174515") (published "20230703174515")) (rights 62))

Pretty-printed, this results in:

(list (meta (title "API: Retrieve metadata of an existing zettel")
            (role "manual")
            (tags "#api #manual #zettelstore")
            (syntax "zmk")
            (back "00001012000000 00001012053300")
            (backward "00001012000000 00001012053300")
            (box-number "1")
            (created "20210726174524")
            (forward "00001006020000 00001006050000 00001010040100 00001012050200 00001012920000 00001012921200")
            (modified "20230703174515")
            (published "20230703174515"))
      (rights 62))

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.

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.

  1. If authentication is enabled, you must include the a valid access token in the Authorization header ↩︎