Sometimes you may wish to create or update a tiddler, bag or recipe from the command line and twanager won't work for you for some reason. Maybe you are accessing a remote server. In these instances you can use curl or wget to make requests to the TiddlyWeb server.
Below are some examples. In each of these the argument to the -d switch is a JSON string, so the use of '
and "
matter. Please see JSON bag, JSON recipe and JSON tiddler for important details on the structure of the JSON that must be sent.
Create or Update a Bag
curl -X PUT -H 'Content-Type: application/vnd.tiddlyweb+json' -d '{"policy":{}}' http://0.0.0.0:8080/bags/foobar
Create or Update a Recipe
curl -X PUT -H 'Content-Type: application/vnd.tiddlyweb+json' -d '{"recipe":[["system",""],["common",""]]}' \
http://0.0.0.0:8080/recipes/default
Create or Update a Tiddler
curl -X PUT -H 'Content-Type: application/vnd.tiddlyweb+json' -d '{"text":"hello"}' \
http://0.0.0.0:8080/bags/foobar/tiddlers/monkey
If you wish to PUT
a binary tiddler you can do the following, assuming the source file is named monkey.png
:
curl -X PUT -H 'Content-Type: image/png' --data-binary @monkey.png \
http://0.0.0.0:8080/bags/foobar/tiddlers/monkey
See also: HTTP API