1
0
silverbullet/website/API.md
2023-07-07 20:21:50 +02:00

1.4 KiB
Raw Blame History

The server API is relatively small. The client primarily communicates with the server for file “CRUD” (Create, Read, Update, Delete) style operations.

Heres an attempt to document this API:

  • GET /index.json (when sent with an Accept: application/json request header): will return a full listing of all files in your space including metadata like when the file was last modified, as well as permissions. This is primarily for sync purposes with the client. A request sent without the mentioned Accept header will redirect to / (to better support authentication layers like Authelia).
  • GET /*.*: Reads and returns the content of the file at the given path. This means that if you GET /index.md you will receive the content of your index page. The GET response will have a few additional SB-specific headers:
    • X-Last-Modified as a UNIX timestamp in ms (as coming from Data.now())
    • X-Permission: either rw or ro which will change whether the editor opens in read-only or regular mode.
  • PUT /*.*: The same as GET except that it takes the body of the request and writes it to a file.
  • DELETE /*.*: Again the same, except this will delete the given file.
  • GET /.client/*: Retrieve files implementing the client
  • GET /* and GET /: Anything else (any path without a file extension) will serve the SilverBullet UI HTML.