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:
{
"data": {
"id": "osfstorage/67dacaa816000900109e1da3",
"type": "files",
"attributes": {
"name": "nft-43-provenance-2025-12-29T13-08-47.zip",
"kind": "file",
"path": "/67dacaa816000900109e1da3"
},
"links": {
"download": "https://files.rdm.nii.ac.jp/v1/resources/wzv9g/providers/osfstorage/67dacaa816000900109e1da3",
"move": "https://files.rdm.nii.ac.jp/v1/resources/wzv9g/providers/osfstorage/67dacaa816000900109e1da3"
}
}
}
Solution: Constructing the File Detail URL
The file detail page URL is constructed in the following format:
https://rdm.nii.ac.jp/{nodeId}/files/{provider}/{fileId}
| 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)
// Waterbutler API レスポンスからファイルIDを抽出
const data = await response.json();
let fileId: string | undefined;
// data.id から抽出(形式: "osfstorage/67dacaa816000900109e1da3")
if (data.data?.id) {
const idParts = data.data.id.split("/");
if (idParts.length > 1) {
fileId = idParts[idParts.length - 1];
}
}
// ファイル詳細URLを構成
const fileDetailUrl = `https://rdm.nii.ac.jp/${nodeId}/files/${provider}/${fileId}`;
// 結果: https://rdm.nii.ac.jp/wzv9g/files/osfstorage/67dacaa816000900109e1da3
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/