API

注釈

API機能はベータ版であり、予告なく機能が変更・停止される場合があります。 API is under development (beta), and its functionality may change or be suspended without notice.

一覧 Contents catalog

以下のURLによって、JSON形式で登録されたデータを一覧することができます。 The list of all works can be accessed as a JSON file using the following URL:

クエリ Query

q:

検索文字列を指定します。検索対象の項目を指定して検索する場合、

検索対象の項目名:検索文字列 と指定します。

キーワードはスペースで区切ることでAND検索が行えます。キーワードがスペースを含む場合は、ダブルクォーテーションマークで囲ってください。 例えば、"XAFS" をキーワードに含み、"Tantalum nitride" を試料とするデータ一覧を取得するURLは以下の通りです。

For example, these URLs will allow you to obtain list of works containing "XAFS" as one of their keywords and have "Tantalum nitride" as the specimen.

https://mdrs.nims.go.jp/api/v1/datasets?q=XAFS%20specimen:%22Tantalum%20nitride%22

検索対象の項目名は以下のとおりです。

instrument:
装置名
specimen:
試料名
matvoc:
MatVoc のURI 例: matvoc:"https://matvoc.nims.go.jp/entity/Q686"

レスポンス Response

JSONのレスポンスには、最上位に data という要素、その下位に id, type, attributes という3つの要素があります。 JSON is the format with the richest response. You will find data at the highest level, and elements id, type, and attributes will be nested in there.

data:
検索条件に合致する結果の配列(デフォルトでは10件ずつ)。

An array containing the works that match the current search conditions, with 10 results being shown per page by default.

id:
MDR上でのwork/collectionのID。このIDを用いて、各workに関する情報を個別に取得 できます。
The MDR identifier for the work/collection. You can use this ID to obtain metadata about individual works.
type:
常に Dataset を返します。
Always returns Dataset .
attributes:
MDR Schema のメタデータを返します。
Returns MDR Schema metadata.

ページ操作 Pagination

以下のURLパラメーターを足すことにより、結果一覧のページ操作が可能です。 By adding the following URL parameter, you can obtain different pages of the results and control how many works to be returned in a page.

page:

結果一覧のページ番号。整数。 Page number. Integer.

Example

例えば下記のようにすると2ページ目を取得できます。 For example, the following will return page 2.

https://mdr.nims.go.jp/api/v1/datasets?q=Tantalum+nitride&page=2

個別 Individual works

Metadata

各 Work の URL は https://mdr.nims.go.jp/datasets/abcdefghi のような形ですが、 https://mdr.nims.go.jp/api/v1/datasets/abcdefghi のような URL で Dataset のメタデータを取得できます。

The URL for each work is in the form that looks like this: https://mdr.nims.go.jp/concern/publications/abcdefghi By using the URL https://mdr.nims.go.jp/api/v1/datasets/abcdefghi , you can obtain the work's metadata.

Download

IDが例えば abcdefghi の Work に対し https://mdr.nims.go.jp/datasets/abcdefghi.zip の形式のリソースを要求することにより、Work に属する Item(ファイル)全件をまとめた ZIP アーカイブを取得することができます。

By requesting, for example, a URL in the form of https://mdr.nims.go.jp/datasets/abcdefghi.zip for a work ID abcdefghi, you can obtain a ZIP archive containing all the item files for the work.

メタデータ一括取得 Bulk metadata download

MDRは OAI-PMH をサポートしており、メタデータの全件をダウンロードできます。以下はPythonのOAI-PMHクライアントである Sickle を使用した例です。

MDR supports OAI-PMH to download all metadata. The following is an example using Python OAI-PMH client Sickle .

リスト 1 mdr_oai_pmh_example.py
1# pip install sickle
2from sickle import Sickle
3    sickle = Sickle('https://mdr.nims.go.jp/oai')
4    records = sickle.ListRecords(metadataPrefix='oai_dc')
5    for record in records:
6        print(record)