-
Notifications
You must be signed in to change notification settings - Fork 503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explain more clearly how to use rest/db/file #817
Open
timabell
wants to merge
9
commits into
syncthing:main
Choose a base branch
from
timabell:rest-file-example
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ba778fd
Explain more clearly how to use rest/db/file
timabell f395522
Update rest/db-file-get.rst
timabell 09acbbd
Update rest/db-file-get.rst
timabell 2a2a472
Update rest/db-file-get.rst
timabell 9e7f80d
Update rest/db-file-get.rst
timabell bad8f05
Update rest/db-file-get.rst
timabell 8e0308f
Fix typo in patch
timabell 89ee8d1
Avoid confusing use of "full path" for file path
timabell 383dfc2
Re-wrap text flow and add code syntax blocks.
acolomb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,31 @@ | ||
GET /rest/db/file | ||
================= | ||
|
||
Returns most data available about a given file, including version and | ||
availability. Takes ``folder`` and ``file`` parameters. ``local`` and | ||
``global`` refer to the current file on disk and the globally newest file, | ||
respectively. | ||
Returns data about a given file, including version and availability. | ||
|
||
.. code-block:: | ||
Request | ||
------- | ||
|
||
The call requires parameters for `folder` and `file` in the query string: | ||
|
||
- `folder` is the folder ID which you can find in the Syncthing Web GUI, | ||
e.g. `5camp-slpa8`. | ||
|
||
- `file` is the relative path of the file starting from the folder root to the | ||
file you are interested in. The path and filename must be correctly | ||
URL-encoded. | ||
|
||
Example Request | ||
^^^^^^^^^^^^^^^ | ||
|
||
.. code-block:: bash | ||
|
||
curl --silent --get --header "X-API-KEY: YOUR_API_TOKEN" "http://localhost:8384/rest/db/file?folder=YOUR_FOLDER_ID" --data-urlencode "file=path/to/file.pdf" | ||
|
||
Response | ||
-------- | ||
|
||
.. code-block:: json | ||
|
||
{ | ||
"availability": [ | ||
|
@@ -19,7 +38,10 @@ respectively. | |
"local": { /* a file entry */ } | ||
} | ||
|
||
A file entry looks like this:: | ||
``local`` and ``global`` refer to the current file on the local device and the | ||
globally newest file, respectively. A file entry looks like this: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a factual error here. The |
||
|
||
.. code-block:: json | ||
|
||
{ | ||
{ | ||
|
@@ -53,9 +75,11 @@ A file entry looks like this:: | |
} | ||
|
||
Platform specific data may be ownership, extended attributes, etc. and is | ||
divided into entries per operating system / platform. An example platform | ||
entry containing ownership information for Unix systems and an extended | ||
attribute for macOS ("darwin") looks as follows:: | ||
divided into entries per operating system / platform. An example platform entry | ||
containing ownership information for Unix systems and an extended attribute for | ||
macOS ("darwin") looks as follows: | ||
|
||
.. code-block:: json | ||
|
||
{ | ||
"darwin": { | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are already numerous examples involving
curl
in the docs. I'd find it convenient to adopt the same CLI options used there, e.g.-H
instead of--header
and omit the--get
.