Skip to content

Commit

Permalink
dev/rest: Document /rest/system/browse (fixes syncthing#112)
Browse files Browse the repository at this point in the history
GitHub-Pull-Request: syncthing#300
  • Loading branch information
imsodin authored and calmh committed Jul 19, 2017
1 parent 62523e1 commit 79aaf6a
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions rest/system-browse-get.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
GET /rest/system/browse
=======================

Returns a list of directories matching the path given by the optional parameter
``current``. The path can use `patterns as described in Go's filepath package
<https://golang.org/pkg/path/filepath/#Match>`_. A '*' will always be appended
to the given path (e.g. ``/tmp/`` matches all its subdirectories). If the option
``current`` is not given, filesystem root paths are returned.

.. code-block:: bash
$ curl -H "X-API-Key: yourkey" localhost:8384/rest/system/browse | json_pp
[
"/"
]
$ curl -H "X-API-Key: yourkey" localhost:8384/rest/system/browse?current=/var/ | json_pp
[
"/var/backups/",
"/var/cache/",
"/var/lib/",
"/var/local/",
"/var/lock/",
"/var/log/",
"/var/mail/",
"/var/opt/",
"/var/run/",
"/var/spool/",
"/var/tmp/"
]
$ curl -H "X-API-Key: yourkey" localhost:8384/rest/system/browse?current=/var/*o | json_pp
[
"/var/local/",
"/var/lock/",
"/var/log/",
"/var/opt/",
"/var/spool/"
]

0 comments on commit 79aaf6a

Please sign in to comment.