API: Retrieve metadata of an existing zettel

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

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

For example, to retrieve some data about this zettel you are currently viewing, just send a HTTP GET request to the endpoint /j/000010120534001. If successful, the output is a JSON object:

# curl http://127.0.0.1:23123/m/00001012053400
{"meta":{"back":"00001012000000 00001012053300","backward":"00001012000000 00001012053300 00001012920000","box-number":"1","forward":"00001010040100 00001012050200 00001012920000 00001012920800","modified":"20211004111240","published":"20211004111240","role":"manual","syntax":"zmk","tags":"#api #manual #zettelstore","title":"API: Retrieve metadata of an existing zettel"},"rights":62}

Pretty-printed, this results in:

{
  "meta": {
    "back": "00001012000000 00001012053300",
    "backward": "00001012000000 00001012053300 00001012920000",
    "box-number": "1",
    "forward": "00001010040100 00001012050200 00001012920000 00001012920800",
    "modified": "20211004111240",
    "published": "20211004111240",
    "role": "manual",
    "syntax": "zmk",
    "tags": "#api #manual #zettelstore",
    "title": "API: Retrieve metadata of an existing zettel"
  },
  "rights": 62
}

The following keys of the JSON object are used:

"meta"
References an embedded JSON object with only string values. The name/value pairs of this objects are interpreted as the metadata of the new zettel. Please consider the list of supported metadata keys (and their value types).
"rights"
An integer number that describes the access rights for the zettel.

Additionally, you can retrieve the plain metadata of a zettel, without using JSON. Just change the endpoint to /z/{ID}?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

HTTP Status codes

200
Retrieval was successful, the body contains an appropriate JSON object.
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 ↩︎