Accessing Tiddlyhost data as JSON - tiddlyhost/tiddlyhost-com GitHub Wiki
It's possible to access Tiddler data in a Tiddlyhost site in JSON format.
Here are some example urls to show how it works. To use these with your site, replace "simon" with your real site name.
- https://simon.tiddlyhost.com/tiddlers.jsonAll non-system tiddlers as JSON.
- https://simon.tiddlyhost.com/tiddlers.json?pretty=1The
pretty
param add line breaks and indentation for readability. - https://simon.tiddlyhost.com/tiddlers.json?pretty=1&skinny=1The
skinny
param means exclude the tiddlers' text, which is useful if you just want a list of the tiddlers and don't need the full content. - https://simon.tiddlyhost.com/tiddlers.json?pretty=1&skinny=1&include_system=1Add the
include_system
param if you do want system tiddlers to be included. Beware that$:/core
will show up in this list and it is extremely large. - https://simon.tiddlyhost.com/tiddlers.json?title=Hello&pretty=1The
title
param lets you specify one single tiddler - https://simon.tiddlyhost.com/tiddlers.json?title[]=Hello&title[]=About%20Tiddlyhost&pretty=1It's possible to specify more than one title using this specially formatted
title
param.
The url params can be combined as required to pick out the data you want.
You can also access tiddlers by their name in ".tid" format, which is a text format sometimes used to represent Tiddlers. For example:
- https://simon.tiddlyhost.com/text/Hello.tid
- https://simon.tiddlyhost.com/text/About%20Tiddlyhost.tid
Using curl
and jq
you can extract just the fields you want, for example this lists the titles of all tiddlers tagged with (just) "Hello":
$ curl -s https://simon.tiddlyhost.com/tiddlers.json | jq '.[] | select(.tags=="Hello") | .title'
"About Tiddlyhost"
"Experiments & demos"
"The original site #1"