-
-
Notifications
You must be signed in to change notification settings - Fork 23
Accessing Tiddlyhost data as JSON
Simon Baird edited this page Oct 26, 2022
·
2 revisions
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.json
All non-system tiddlers as JSON. -
https://simon.tiddlyhost.com/tiddlers.json?pretty=1
Theprettyparam add line breaks and indentation for readability. -
https://simon.tiddlyhost.com/tiddlers.json?pretty=1&skinny=1
Theskinnyparam 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=1
Add theinclude_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=1
Thetitleparam lets you specify one single tiddler -
https://simon.tiddlyhost.com/tiddlers.json?title[]=Hello&title[]=About%20Tiddlyhost&pretty=1
It's possible to specify more than one title using this specially formattedtitleparam.
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"