From 0c81a49aaccdaa717467f2ed6193e4e323a6d336 Mon Sep 17 00:00:00 2001 From: Diogo Castro <diogo.castro@cern.ch> Date: Fri, 14 Jun 2024 16:27:00 +0200 Subject: [PATCH] Api access: format commands --- docs/for_developers/api_access.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/for_developers/api_access.md b/docs/for_developers/api_access.md index 386ac33..0e32eea 100644 --- a/docs/for_developers/api_access.md +++ b/docs/for_developers/api_access.md @@ -13,11 +13,15 @@ In the following, `wget` and `curl` are used to illustrate how to use the API. Files or folders that have been shared via public links can be anonymously downloaded as follows: -`curl https://cernbox.cern.ch/remote.php/dav/public-files/<public-link-hash>/<relative-path-to-file>` +```bash +curl https://cernbox.cern.ch/remote.php/dav/public-files/<public-link-hash>/<relative-path-to-file> +``` If you have created a public link on a folder with _edit_ or _uploader_ rights, then the following allows you to anonymously upload content to that folder: -`curl -T <some-file> -X PUT https://cernbox.cern.ch/remote.php/dav/public-files/<public-link-hash>/<target-filename>` +```bash +curl -T <some-file> -X PUT https://cernbox.cern.ch/remote.php/dav/public-files/<public-link-hash>/<target-filename> +``` Note that for _uploader_ links, the target file gets an extra hash appended to the name, to prevent collisions as the user does not have rights to list or overwrite existing content (see also [sharing](../web/sharing/public-share.md)). @@ -26,13 +30,17 @@ Note that for _uploader_ links, the target file gets an extra hash appended to t Files or folders under protected shares can be accessed using HTTP Basic authentication at the `api.cernbox.cern.ch` endpoint. This endpoint is accessible withint the CERN network only. For example: -`wget --user <account> --password <password> https://api.cernbox.cern.ch/remote.php/dav/files/<account>/eos/<full-path-to-target>` +```bash +wget --user <account> --password <password> https://api.cernbox.cern.ch/remote.php/dav/files/<account>/eos/<full-path-to-target> +``` Note that such a full path MUST contain `<account>` above the EOS path. Similarly, it is possible to upload content to protected shares: -`curl -T <some-file> -u <account>:<password> -X PUT https://api.cernbox.cern.ch/remote.php/dav/files/<account>/eos/<full-path-to-target>` +```bash +curl -T <some-file> -u <account>:<password> -X PUT https://api.cernbox.cern.ch/remote.php/dav/files/<account>/eos/<full-path-to-target> +``` ## Share API -- GitLab