Simulators
Tags
A tag labels a file or folder by path. Boot the simulator as in the Quickstart, tag a file, read its tags and remove the tag:
H='Authorization: Bearer sl.placeholder'
J='Content-Type: application/json'
curl -s "$RYSTIC_URL/2/files/tags/add" -H "$H" -H "$J" -d '{"path":"/notes.md","tag_text":"draft"}'
# -> null
curl -s "$RYSTIC_URL/2/files/tags/get" -H "$H" -H "$J" -d '{"paths":["/notes.md","/Documents"]}' | jq -c '.paths_to_tags[] | {path, tags: [.tags[].tag_text]}'
# -> {"path":"/notes.md","tags":["draft"]}
# -> {"path":"/Documents","tags":[]}
curl -s "$RYSTIC_URL/2/files/tags/remove" -H "$H" -H "$J" -d '{"path":"/notes.md","tag_text":"draft"}'
# -> null
curl -s "$RYSTIC_URL/2/files/tags/remove" -H "$H" -H "$J" -d '{"path":"/notes.md","tag_text":"draft"}'
# -> {"error":{".tag":"tag_not_present"},"error_summary":"tag_not_present/"}
The simulator stores a tag in lower case (BadTag reads back as badtag), and tags/get returns each path’s tags as user_generated_tag entries. Removing a tag the entry does not carry returns 409 tag_not_present. Adding a tag notifies the webhook as any write does (Webhooks).
Last updated on