> For the complete documentation index, see [llms.txt](https://docs.unitlab.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.unitlab.ai/api-sdk-cli/ja/apis/ontologies-api.md).

# Ontologies API

Unitlab Ontologies API のリファレンスです。ワークスペースのオントロジーを HTTP で一覧表示、取得、作成、置き換えるエンドポイントと、フィルター、structure の形式、必要な権限を説明します。

| メソッドとルート                        | 内容                               | 権限                |
| ------------------------------- | -------------------------------- | ----------------- |
| `GET /api/sdk/ontologies/`      | オントロジーを一覧表示（ページング）               | View ontology     |
| `POST /api/sdk/ontologies/`     | オントロジーを作成                        | Manage ontologies |
| `GET /api/sdk/ontologies/{id}/` | オントロジーを取得                        | View ontology     |
| `PUT /api/sdk/ontologies/{id}/` | タイトル、説明、structure を置き換え、リビジョンを記録 | Manage ontologies |

一覧のフィルター: `title_eq`、`title_like`、`desc_eq`、`desc_like`、`created_before`、`created_after`、`edited_before`、`edited_after`（ISO 8601）。

```bash
curl -s -X POST https://api.unitlab.ai/api/sdk/ontologies/ \
  -H "Authorization: Api-Key $UNITLAB_API_KEY" -H "Content-Type: application/json" \
  -d @ontology.json
```

```json
{
  "title": "Robot cell QA",
  "description": "Grippers and parts",
  "data_type": "image",
  "structure": {"objects": [], "classifications": [], "skeleton_templates": []}
}
```

レスポンスの `ontology_hash` がオントロジー ID です。プロジェクト作成時に指定してください。`structure` は SDK の `OntologyStructure` と `to_dict()` で作成するか、既存のオントロジーからコピーします。[Python でオントロジーを構築する](https://docs.unitlab.ai/api-sdk-cli/ja/sdks/build-ontologies-in-python.md) を参照してください。

## 関連情報 <a href="#related" id="related"></a>

[SDK: オントロジーリソース](https://docs.unitlab.ai/api-sdk-cli/ja/sdks/ontology-resources.md) · [プロジェクト](https://docs.unitlab.ai/api-sdk-cli/ja/apis/projects-api.md)
