| src | ||
| .editorconfig | ||
| .eslintignore | ||
| .eslintrc | ||
| .gitignore | ||
| .npmrc | ||
| CHANGELOG.md | ||
| esbuild.config.mjs | ||
| LICENSE | ||
| main.ts | ||
| manifest.json | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| styles.css | ||
| tsconfig.json | ||
| version-bump.mjs | ||
| versions.json | ||
Data Fetcher
Data Fetcher is an Obsidian plugin that runs requests against external data endpoints and renders the result directly in notes.
Supported endpoint types:
- REST APIs
- GraphQL endpoints
- RPC endpoints
- gRPC-style endpoints via HTTP proxy
Highlights
data-querycode block processor for live request execution- Endpoint alias configuration in plugin settings
- Compact endpoint list with modal editor (v1.1.1)
- Endpoint import/export for moving aliases between devices (v1.1.2)
- Endpoint filtering in settings and safer header-free exports by default (v1.1.5)
- Cache with configurable expiration
- Cache browser modal (list, preview, delete individual entries)
- Optional ribbon icon shortcut for cache browser
- Per-block refresh button
- Command to refresh all queries in current note
- Copy result and Save to Note actions
- Custom headers for authenticated requests
Installation
Community Plugins
- Open
Settings -> Community Plugins. - Search for
Data Fetcher. - Install and enable.
Manual
- Download release assets from GitHub releases.
- Copy
manifest.json,main.js, andstyles.cssinto:.obsidian/plugins/data-fetcher - Reload Obsidian and enable the plugin.
How It Works
Create a code block with language data-query.
The plugin parses the block, executes the query, caches the response, and renders output below the block.
Query Syntax
Direct JSON Query (all endpoint types)
{
"type": "rest",
"url": "https://api.example.com/data",
"method": "GET",
"headers": {
"Authorization": "Bearer your-token"
}
}
Alias Query
Configure alias in plugin settings, then reference it:
@my-api-alias
body: {"id": 123}
Alias With Inline Variables (Issue #5, v1.0.7)
@github-api({"first": 5, "after": null})
query: query($first: Int, $after: String) { viewer { repositories(first: $first, after: $after) { nodes { name } } } }
Equivalent variant:
=@github-api({"first": 5})
query: query($first: Int) { viewer { repositories(first: $first) { nodes { name } } } }
Notes:
- Inline variables must be a valid JSON object.
- Explicit
variables:entry later in the block overrides inline variables.
Output Shaping (Issue #6, v1.0.8)
You can control rendered output with:
path: selects nested data using dot notationformat:json(default) ortable
Example:
@bitsong
query: query MyQuery { nftTokens { edges { node { id minter } } } }
path: nftTokens.edges
format: table
Notes:
tableworks on arrays of objects.- If
format: tableis used on unsupported data, plugin falls back to JSON output. - Paths can include array indexes, for example
data.items.0.
Frontmatter Output (Issue #2, in progress for v1.0.9)
You can write fetched output into note properties/frontmatter:
@bitsong
query: query MyQuery { nftTokens { edges { node { id minter } } } }
path: nftTokens.edges.0.node.id
output: frontmatter
property: external.firstTokenId
Notes:
output: frontmatterwrites selected data to the current note frontmatter.propertyis required and supports dot-path notation (for nested properties).- This mode updates current note metadata; it does not create new notes.
Endpoint Type Reference
REST
Common fields:
type:resturl: endpoint URLmethod:GET|POST|PUT|DELETEheaders: objectbody: object or string
GraphQL
Common fields:
type:graphqlurl: GraphQL endpoint URLquery: GraphQL query stringvariables: JSON objectpath: optional dot-path selector for rendered dataformat:json|tablefor rendered outputheaders: object
Example:
{
"type": "graphql",
"url": "https://indexer-bs721-base.bitsong.io/",
"query": "query MyQuery { nftTokens { edges { node { id minter } } } }",
"variables": {}
}
RPC
Common fields:
type:rpcurl: RPC endpoint URLmethod: alwaysPOSTquery: method namebody: params objectheaders: object
gRPC via proxy
Common fields:
type:grpcurl: proxy endpoint URLbody: payload objectheaders: object
Settings
Open Settings -> Data Fetcher.
Available options:
- Cache duration (minutes)
- Endpoint aliases (compact list with Name/Type/URL + actions)
- Endpoint import/export (JSON)
- Endpoint filter by alias, type, or URL
- Per-alias headers
- Cache clearing
- Cache browser shortcut
- Cache browser ribbon icon toggle
- Cache info preview (item count/size)
Commands
Refresh data query: refreshes alldata-queryblocks in the active note and updates cache.Open cache browser: opens cache browser modal for cache inspection and management.
Actions in Rendered Block
Refresh: reruns that query and updates cached value.Copy: copies rendered response to clipboard.Save to Note: replaces/inserts static result in current markdown file.
Caching Behavior
- Cache location:
.data-fetcher-cachein vault root. - Keying: deterministic hash of query parameters.
- Expiration: controlled by
Cache durationsetting. - Manual refresh bypasses stale content by re-executing query and writing fresh cache.
Cache Browser
Use command Open cache browser (or settings button) to:
- list cache entries with size/date
- filter entries by alias, key, type, or URL
- preview cached payloads
- delete individual entries
- clear all cache
Troubleshooting
Endpoint alias "..." not found: add or fix alias in settings.Variables must be valid JSON: ensure valid JSON syntax ({"x": 1}not{x: 1}).Path "..." not found: check nested field names/indexes in response data.Table format requires an array of objects: updatepathto point at an object array, or useformat: json.property is required when output: frontmatter is used: add a property path.Response too large for this device: reduce payload size, add filters/limits, or use a proxy endpoint.- No result refresh from command: ensure active pane is a markdown file.
- Build fails on PowerShell script policy: run via
cmd /c npm run build.
Development
Build:
cmd /c npm install
cmd /c npm run build
Watch mode:
cmd /c npm run dev
Test in vault by linking/copying plugin files to:
.obsidian/plugins/data-fetcher
Data Disclosure
This plugin communicates with external services and stores response data:
- Network usage: Sends HTTP(S) requests to endpoints configured in notes/settings.
- External dependencies: Uses Obsidian built-in
requestUrlAPI. - Data sent: URL, method, headers, and optional body/query/variables you configure.
- Data stored locally: plugin settings and cached responses in
.data-fetcher-cache. - Data shared externally: only with endpoints you configure.
Support
- Issues and feature requests: GitHub Issues
License
MIT