What is the Waterbutler API
Waterbutler is a file storage abstraction layer developed by the Center for Open Science (COS). It is used in OSF (Open Science Framework) and GakuNin RDM, providing a unified API for file operations across various storage providers (OSF Storage, Amazon S3, Google Drive, Dropbox, etc.).
Main Features
- File upload and download
- File/folder creation, deletion, move, and copy
- Metadata retrieval
Endpoints
- GakuNin RDM:
https://files.rdm.nii.ac.jp/v1 - OSF:
https://files.osf.io/v1
Reference Links
Problem
After uploading a file using the GakuNin RDM Waterbutler API, there are cases where you want to navigate directly to the file’s detail page.
However, since RDM displays shortened project URLs (e.g., https://rdm.nii.ac.jp/qv3xf/), it was unclear how to construct the detail page URL for uploaded files.
Waterbutler API Response
Example Waterbutler API response when uploading a file:
Solution: Constructing the File Detail URL
The file detail page URL is constructed in the following format:
| Parameter | Description | How to Obtain |
|---|---|---|
nodeId | Project ID | The value specified during upload (e.g., wzv9g) |
provider | Storage provider | The value specified during upload (e.g., osfstorage) |
fileId | File ID | Extracted from data.id in the response (the part after osfstorage/) |
Implementation Example (TypeScript)
Summary
- Shortened URL (
https://rdm.nii.ac.jp/qv3xf/) is the project top page - File detail URL is constructed in the format
/{nodeId}/files/{provider}/{fileId} fileIdis the part of the Waterbutler API response’sdata.idafter removingprovider/