Skip to content
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

chore(rest): explain more clearly how to use /rest/db/file #817

Merged
merged 15 commits into from
Jan 6, 2025

Conversation

timabell
Copy link
Contributor

This adds an example curl call and explains the parameters more clearly.

It's not immediately obvious how to use this endpoint from the existing docs. Hopefully this will help others figure it out. Reading the forums I don't think I was the only person confused by this page.

This adds an example curl call and explains the parameters more clearly.

It's not immediately obvious how to use this endpoint from the existing
docs. Hopefully this will help others figure it out. Reading the forums
I don't think I was the only person confused by this page.
@netlify
Copy link

netlify bot commented Aug 20, 2023

👷 Deploy request for syncthing-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 383dfc2

rest/db-file-get.rst Outdated Show resolved Hide resolved
rest/db-file-get.rst Outdated Show resolved Hide resolved
rest/db-file-get.rst Outdated Show resolved Hide resolved
rest/db-file-get.rst Outdated Show resolved Hide resolved
rest/db-file-get.rst Outdated Show resolved Hide resolved
rest/db-file-get.rst Outdated Show resolved Hide resolved
rest/db-file-get.rst Outdated Show resolved Hide resolved
timabell and others added 5 commits August 20, 2023 16:18
rest/db-file-get.rst Outdated Show resolved Hide resolved
@timabell
Copy link
Contributor Author

Thanks for all the suggested improvements to my patch, I've applied them all now

Copy link
Member

@acolomb acolomb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took the liberty to fix some formatting. Could you please fix the factual discrepancies while you're touching this part?


.. 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"
Copy link
Member

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.

@@ -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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a factual error here. The mtime attribute is not part of the respective file entry, but top-level next to availability. When that is fixed, the outer object wrapping can go away in this code sample.

More closely follow the other examples and fix use of --url-query
instead of --data-urlencode.
It lives on the same level as global and local, not inside each of
them.
@acolomb acolomb changed the title Explain more clearly how to use rest/db/file chore(rest): explain more clearly how to use rest/db/file Jan 6, 2025
@acolomb acolomb changed the title chore(rest): explain more clearly how to use rest/db/file chore(rest): explain more clearly how to use /rest/db/file Jan 6, 2025
In contrast to the /rest/debug/file endpoint, this one lacks the
global versions info.  Thus the statement "most data" was correct.
@acolomb acolomb force-pushed the rest-file-example branch from 805a858 to f02400b Compare January 6, 2025 15:51
@acolomb acolomb merged commit acbc51c into syncthing:main Jan 6, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants