Obsidian Vault REST API icon

Obsidian Vault REST API

Interact with Obsidian Vault via REST API

Overview

This node interacts with an Obsidian Vault via its REST API, specifically allowing users to query the frontmatter metadata of notes managed by the vault. The "Query Frontmatter" operation under the "Agent" resource enables filtering, sorting, and limiting the results based on specified criteria.

Typical use cases include:

  • Retrieving specific metadata fields from notes for further processing or automation.
  • Filtering notes based on conditions defined in the frontmatter.
  • Sorting notes by a particular field in ascending or descending order.
  • Limiting the number of returned notes to manage data volume.
  • Ensuring distinct results when querying metadata.

For example, a user might want to fetch all notes where the frontmatter contains a tag "project" and sort them by creation date descending, retrieving only the first 10 entries.

Properties

Name Meaning
Fields JSON array specifying which frontmatter fields to retrieve. Example: ["title", "date"]
Where JSON object defining filter conditions to select notes based on frontmatter values.
Sort By String indicating the frontmatter field name to sort the results by.
Sort Direction Direction of sorting: either "asc" (ascending) or "desc" (descending).
Limit Number specifying the maximum number of results to return. Zero means no limit.
Distinct Boolean indicating whether to return only distinct results (true) or allow duplicates (false).

Output

The node outputs JSON data representing the queried frontmatter entries matching the specified criteria. Each item in the output corresponds to a note's frontmatter fields as requested in the "Fields" property.

If binary data were involved, it would typically represent file contents or attachments, but this operation focuses solely on JSON metadata.

Dependencies

  • Requires access to an Obsidian Vault REST API endpoint.
  • Needs configuration of the API host URL and an API authentication token or key credential to authorize requests.
  • The node uses standard HTTP headers to communicate with the API, expecting JSON responses.

Troubleshooting

  • Empty Results: If no data is returned, verify that the "Where" filter matches existing frontmatter fields and values correctly.
  • Invalid JSON in Fields or Where: Ensure that the JSON input for "Fields" and "Where" properties is well-formed; otherwise, parsing errors may occur.
  • API Connection Errors: Check that the API host URL is correct and that the authentication credentials are valid and have sufficient permissions.
  • Sorting Issues: If sorting does not behave as expected, confirm that the "Sort By" field exists in the frontmatter and that the "Sort Direction" is set properly.
  • Limit Not Working: A limit of zero means no limit; if fewer results than expected appear, check the filter criteria.

Links and References

Discussion