Introduction

GakuNin RDM is a research data management platform provided by the National Institute of Informatics (NII). It is built on the Open Science Framework (OSF) and allows automation of project operations through its API.

In this article, I introduce how to perform the following operations using the GakuNin RDM API from Node.js.

  • Project creation and configuration
  • Wiki creation and updating
  • Adding members
  • GitHub integration + automatic deployment with Vercel

Prerequisites

Obtaining a Personal Access Token

  1. Log in to GakuNin RDM
  2. Navigate to Settings > Personal Access Tokens
  3. Create a new token (scopes: osf.full_read, osf.full_write)

Project Initialization

mnnkppdmmiriinnrisdttma-l&yl&dcodterndvm

Save the token in a .env file.

GRDM_TOKEN=your_personal_access_token_here

Also create a .gitignore.

.neondve_modules/

Creating the API Client

The GakuNin RDM API adopts the JSON:API format. First, create a generic client as lib/client.js.

rcci}c}a}meoofo;soqnntnA"ycci}ci}irduss(hsuCnoofoffeuitt!rttocnnoncttlrTohnss(ps(oh(ueeBTOwhotfttbtt!nrrr.(AOKereuoirsoene"SKEnainnuodoretwsxdEENedztcrpynes.rpo_N)wea-tlt)ss.tnseotUrtTii.oeetsreR={Esiyo=o{b=kxwa.tnLropnno)ttjsvpr=ne`sdaEus"=ro:"r$yw{=rso=)or{:e{=arn."c(`qB=iao=({che"B"uA{twr=)otsGeaeSJa(=;rntsRapsEmSfi`efp.Drpt_eOet$2qiseMel(UtNt{0ug:n_rimRh.crm4e(/TceLoshee)s)/.O$at}dt(stt;aGK{th$,ru.hr,pRETio{irtoeiDNOodphnledth.MKn,aeg,x}uer_iE/taitradTsNvphdfo($ndmO}na}eyp){e.Kn`dt`r(t;pnrnEo,.h;sbiausiNta,ootl,i;p}dnhl.sib;ys};Bae+o))Actjd;;fS.syaEjio)i_pnnlU/"{eRv.,dL2e"n(};v$;"{)r;es.status}):${text}`);

Key points:

  • Authentication: Authenticates with the Authorization: Bearer {token} header
  • Content-Type: application/vnd.api+json (JSON:API specification)
  • Uses Node.js 18+ built-in fetch (no additional packages required)

Creating a Project

cc}cccoo)oonnd};nnnsCsa,sss==trttta}too>>eayt,ll{ad:pttcneePUtaeriao..rRret{:ittdlloLeableeooj:qp"uegIggeur=nt:od((cheooer""ttsjads"y=PUttewe:M:rRIpcasydoLDs}ti"{"aj:::t,Rpte"/=erac,a/rso.tbrreejddcdeqaeaIa1mqurctDt2.uecta:anish".".irt,i,die(Pda.("r;nta"Pooac.Ojd../SeeljlTcIipi"tdn/b,")ka/,;sbc".cl/h1int2eom/ndlte)"s;)/;",{

Updating Project Information (Description and License)

A newly created project has no description or license set. Update with PATCH.

a}w)ad};ia,tttia}r}aydt,e,r:p:tdn}ll}eereo,ai,q{:nisdcytcduobceoeieae"dur_paontsnetilyrnsatoIepir:se:(ddstcih:"e,:ieg"i{Psonh2p{A"{nst0stT,:e_2:yC:h6pH"o"{e"W{l,:,rdie"`trl/esin:cotedh[nee"ssYe/pos$ru"{or,njoeOidcrdetg:Iaddn"}ei5/szf`ca8,rt9ii3{po5tnei"4o]bn,8bh8e2r7e0.0"0,7b1efaa"},

The list of available licenses can be obtained with GET /v2/licenses/. The main IDs are as follows.

LicenseID
CC-By Attribution 4.05f8935e4b8b8270007b1efaa
CC0 1.0 Universal5f8935e4b8b8270007b1efac
MIT License5f8935e5b8b8270007b1efb4

Wiki Creation and Updating

Creating a Wiki Page

Create a Wiki page with POST /nodes/{node_id}/wikis/. Specify the initial content in Markdown using the content attribute.

c}cco)oond};nnsa,ssttta}toayt,lw:ptncweieraoi.k{:imnklibetio"u:eIg=wtnd(ie"t"aksh:=Wwi:oiasm"wki"{e#iit,"k,MiIry.Ded:qRa"uet,esase.wtaii(rdk"c;iPhIOdSP)Tr;"o,je`c/tn\ond\ensP/r$o{jneocdteIdv}e/rwviikeiws./"`,,{

Updating Wiki Content

Wiki content updates work by creating a new version via POST. Direct updates via PATCH are not supported.

a}w)ad};ia,ttta}ayt,r:ptceeroq{:inubte"ueswtntiet(ks:"i:P-"Ov{#SeTrM"sy,ioR`ne/ssw"ei,akricsh/$P{rwoijkeicItd\}n/\vneUrpsdiaotnesd/`c,on{tent.",

!

Note: The home page cannot be deleted or renamed. Content changes are made by adding versions.

Retrieving Wiki Content

c)co;on`{nshstthtterpacesdos:en/rt=/sea:naptwi{a.=irAtduamtwf.haenoitirtciih.zr(aaects.i.jotpne/:xvt2`(/B)we;iakriesr/R$$e{{twTuiOrkKniEsINd}M}`a/rc}kodn}otwenntt/e`x,t

Adding Members

Adding by User ID

a}w)ad};ia,ttta}r}ayt,e,r:ptpblueereiasq{:irbteubmlire"uiiossctson:toesgs(nsirh{"t:oaiPrnppdOi{:hsaSbi:tTu"ca"tw:{:,orrit{`str/"eutn,"eyo,,pdee:s/"$u{"snreoerdased"I",d}|i/dc":ownr"tiurtsieeb"ru-t|iodr""sa/d}`m,i}n,{"

Inviting by Email

Users who do not have a GakuNin RDM account can also be invited by email.

GRDM_TOKEN=your_personal_access_token_here

0

GitHub Integration + Vercel Auto-Deploy

From here, we build a system where uploading files to RDM automatically deploys to Vercel by utilizing GakuNin RDM’s GitHub Add-on.

Overall Flow

GRDM_TOKEN=your_personal_access_token_here

1

1. Creating a GitHub Repository

First, create a GitHub repository for the integration.

GRDM_TOKEN=your_personal_access_token_here

2

2. Configuring GakuNin RDM’s GitHub Add-on

GitHub Add-on configuration cannot be done via the API, so it must be configured from the Web UI.

  1. Open the project page (e.g., https://rdm.nii.ac.jp/{node_id}/)
  2. Navigate to Settings -> Add-ons
  3. Enable GitHub and authenticate your GitHub account
  4. Select the repository and branch to integrate

!

Since Add-on configuration requires an OAuth authentication flow, it cannot currently be operated via the API.

Once configured, the contents of the GitHub repository will be displayed in GakuNin RDM’s file storage. When files are added or updated on RDM, the changes are also reflected in the GitHub repository.

3. Connecting Vercel with the GitHub Repository

Configure from the Vercel dashboard.

  1. Log in to Vercel -> Add New Project
  2. Import the GitHub repository created earlier
  3. Configure build settings (auto-detected based on framework)
  4. Deploy

With just this, Vercel performs automatic builds and deployments triggered by pushes to the GitHub repository.

4. Verification

You can verify the auto-deploy with the following flow.

  1. Upload files to GitHub storage on the GakuNin RDM project page
  2. A commit is automatically created in the GitHub repository
  3. Vercel detects the push and automatically builds and deploys
  4. After a few tens of seconds to a few minutes, it is reflected on the published site
GRDM_TOKEN=your_personal_access_token_here

3

Use Cases

For example, in a project that manages research data (XML or JSON) and a web frontend in the same repository, researchers can simply update data on RDM and the website is automatically updated without requiring technical knowledge.

API Operations Summary

Here is a list of operations supported by the Node.js client created in this article.

OperationMethodEndpoint
Create projectPOST/v2/nodes/
Update projectPATCH/v2/nodes/{id}/
Delete projectDELETE/v2/nodes/{id}/
Create WikiPOST/v2/nodes/{id}/wikis/
Update WikiPOST/v2/wikis/{id}/versions/
Get Wiki contentGET/v2/wikis/{id}/content/
Add memberPOST/v2/nodes/{id}/contributors/
Remove memberDELETE/v2/nodes/{id}/contributors/{user_id}/
List licensesGET/v2/licenses/
List filesGET/v2/nodes/{id}/files/{provider}/
!

Add-on management (such as GitHub integration) cannot be operated with PAT (403). Please configure from the Web UI.

Conclusion

The GakuNin RDM API conforms to OSF APIv2 and supports a wide range of operations from project creation to various settings in JSON:API format. By combining the GitHub Add-on with Vercel, you can build a pipeline from research data management to website publication.

The code from this article is available at:

https://github.com/nakamura196/grdm-api-client

References