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
prettyparam add line breaks and indentation for readability. - https://simon.tiddlyhost.com/tiddlers.json?pretty=1&skinny=1The
skinnyparam 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_systemparam if you do want system tiddlers to be included. Beware that$:/corewill show up in this list and it is extremely large. - https://simon.tiddlyhost.com/tiddlers.json?title=Hello&pretty=1The
titleparam 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
titleparam.
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"