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

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:

{}"}da"""}"}tita,ladyt"""i""""ptnkpndm::eraiakoo"imntswv{":bedh"neou""":l"s"t:::o:ffe{asis"""d"tl"nf/"hoe:fi6:trstl7ta"{-ed"pg,4"ahse3,ct:/-at/6pap/7r8sfdo1:iav6/lce0/ean0fsaa0i.8n9lr1c0ed6e0sm0-1..020rn009di92emi051..0-dna11aic023i.9-".je2ap19cdT.va1j133p"-r,0ve81s-/o4ru7er.sczoeiuspr/"cw,ezs/9wgz/p9rgvpirdoevrisd/eorssf/sotsofrsatgoer/a6g7ed/a6c7adaa8c1a6a080106900000190090e110d9ae31"da3",

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}
ParameterDescriptionHow to Obtain
nodeIdProject IDThe value specified during upload (e.g., wzv9g)
providerStorage providerThe value specified during upload (e.g., osfstorage)
fileIdFile IDExtracted from data.id in the response (the part after osfstorage/)

Implementation Example (TypeScript)

cli}coefntci}nWsd(ofsatfadnfttitas(i:edlattilfrae.adeihbtIi.iPIltuaddddadUett:aPrRDpl=tat=Lesesarst:rat?t.ia/wr.sldi/AaiiePlrPind=naUdItg)grrm:dttl.r|{ahsne"t[=isuoa>iipns.d`.odfd1Phanesa)atcsfttrt.eioa{tpj.nr.sspjeai.:sdgdlwIo;e.e/zDn/snrv(6pgd9)7ltmg;dih./atnfc(-iia"ila/1.e8"]as1);c6;.o0js0pf0/s9$t0{o0nr1oa0dg9eeeI/1d6d}7a/d3fa"iclaeas8/1$6{0p0r0o9v0i0d1e0r9}e/1$d{af3ileId}`;

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}
  • fileId is the part of the Waterbutler API response’s data.id after removing provider/