Overview

GakuNin RDM provides an API at the following link. These are notes on usage examples of this API.

https://api.rdm.nii.ac.jp/v2/

Reference

GakuNin RDM is built on OSF (Open Science Framework), and API documentation can be found at the following link. It conforms to OpenAPI.

https://developer.osf.io/

Obtaining a PAT

Obtain a PAT (Personal Access Token).

After logging in, you can create one from the following URL.

https://rdm.nii.ac.jp/settings/tokens/

Usage

You can also access it programmatically with the following script.

access_token=xxx
import requests
import os
from dotenv import load_dotenv

load_dotenv(verbose=True)
load_dotenv("./env")

access_token = os.environ.get("access_token")

# Add query parameters to the upload URL
url = f'https://api.rdm.nii.ac.jp/v2/nodes/'

# Open the file and upload with a PUT request
# with open(file_path, 'rb') as file:
response = requests.get(
    url,
    headers={
        'Authorization': f'Bearer {access_token}'
    }
)

response.json()

For reference, when the Authorization header was not specified, the following result was returned.

{'data': [],
 'links': {'first': None,
  'last': None,
  'prev': None,
  'next': None,
  'meta': {'total': 0, 'per_page': 10}},
 'meta': {'version': '2.0'}}

Checking in the Browser

API output results can also be checked in the browser.

https://api.rdm.nii.ac.jp/v2/

As shown below, you can see that it was created with Django REST framework.

Also, it appears that “Django REST framework JSON:API” is used, with JSON:API adopted.

Summary

I hope this serves as a useful reference for the GakuNin RDM and OSF (Open Science Framework) APIs.