API: Metadata key information

00001012070540 · Ref · Info · (manual) · #api #manual #zettelstore (all) · Context

To retrieve information about metadata keys, send an HTTP GET request to the endpoint /x with the query parameter data=meta-type. If authentication is enabled, the caller must be authenticated and must have at least read access.

Without the query parameter key, information about all predefined metadata keys is returned. The order of the entries is not specified and may differ between requests.

If the query parameter key is given (possibly more than once), the result contains one entry for each occurrence of key, in the given order. If the same key is given more than once, the result contains the entry for that key more than once. An empty value for key is rejected with status code 400. The type of a key that is not predefined is derived from the suffix of its name, see Supported Key Types. For example, the key data-url has the type URL; a key with a suffix not listed there has the type EString.

# curl 'http://127.0.0.1:23123/x?data=meta-type&key=data-url&key=forward&key=unknown'
(("data-url" "URL" () () ()) ("forward" "IdentifierSet" T () T) ("unknown" "EString" () () ()))

The result is a list of entries. Each entry is a list of five elements, in this order:

  1. The name of the key, i.e. its string representation (string).
  2. The name of the type of the key (string), as used in Supported Key Types, e.g. "IdentifierSet".
  3. T, if the type is a set type, i.e. the value is a set of elements, otherwise ().
  4. T, if the key is managed, i.e. the value is set and maintained by Zettelstore and stored in the zettel, otherwise ().
  5. T, if the key is a property, i.e. the value is always calculated and never stored, otherwise (). The elements 4 and 5 are never both T. If both are (), the key belongs to the category “user”: the value is set by the user.

See Supported Metadata Keys for details and for the category of each predefined key.

HTTP Status codes

200

Retrieval was successful, the body contains the list.

400

The value of the query parameter key is empty.

403

Authentication is enabled, and the caller is not authenticated or does not have read access.