# GET /api/item_categories/{id}

カテゴリ取得

指定したカテゴリを取得します。

カテゴリの ID、ショップ内の番号、表示名、上位カテゴリを返します。
最上位カテゴリの `parent` は `null` です。

## 要求スコープ

- `items.read`

## パラメータ

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | `string` | 必須 | カテゴリ ID（1 以上の整数を文字列で表したもの） |

## レスポンスボディ（200）

`application/json`

- `id` integer（必須 / ≥ 0）: カテゴリ ID
- `number` integer（必須 / ≥ 0）: ショップ内で各カテゴリに割り振られる番号
- `name` string（必須）: カテゴリの表示名
- `parent` ItemCategory（必須）: 上位カテゴリ。最上位カテゴリでは null です。
  - `id` integer（必須 / ≥ 0）: カテゴリ ID
  - `number` integer（必須 / ≥ 0）: ショップ内で各カテゴリに割り振られる番号
  - `name` string（必須）: カテゴリの表示名
  - `parent` ItemCategory（必須）: 上位カテゴリ。最上位カテゴリでは null です。
    - ↻ ItemCategory を再帰参照
- `_links` object（必須）: このリソースに関連する操作へのリンク集合。リソースの状態やトークンのスコープによってリンクの有無は変わりません。
  - `update_item_category` Link（必須）: [カテゴリ編集](post-api-item-categories-id.md)
    - `href` string (uri)（必須）: エンドポイントの絶対 URL
    - `method` "GET" | "POST" | "PUT" | "DELETE"（必須）: エンドポイントを呼び出す際に使う HTTP メソッド
    - `document_href` string (uri)（必須）: ドキュメントサイト上でこのエンドポイントを説明するページの URL
  - `delete_item_category` Link（必須）: [カテゴリ削除](delete-api-item-categories-id.md)
    - `href` string (uri)（必須）: エンドポイントの絶対 URL
    - `method` "GET" | "POST" | "PUT" | "DELETE"（必須）: エンドポイントを呼び出す際に使う HTTP メソッド
    - `document_href` string (uri)（必須）: ドキュメントサイト上でこのエンドポイントを説明するページの URL
  - `update_item_category_list_order` Link（必須）: [カテゴリの並び順を変更する](put-api-item-categories-id-list-order.md)
    - `href` string (uri)（必須）: エンドポイントの絶対 URL
    - `method` "GET" | "POST" | "PUT" | "DELETE"（必須）: エンドポイントを呼び出す際に使う HTTP メソッド
    - `document_href` string (uri)（必須）: ドキュメントサイト上でこのエンドポイントを説明するページの URL

## リクエスト例

```sh
curl -X GET "https://apiv2.thebase.com/api/item_categories/123" \
  -H "Authorization: Bearer <your-token>"
```

## レスポンス

| Status | Description |
| --- | --- |
| `200` | 取得成功。 |

## エラー

エラーは `application/problem+json` の Problem 形式で返します。認証・スコープ・予期しない内部エラーなど、すべてのエンドポイントに共通のエラーと構造・判別方法は [エラーレスポンス](/docs/errors.md) を参照してください。

このエンドポイントが返すその他のエラーは次のとおりです。

| Status | Type | Description |
| --- | --- | --- |
| `400` | `/errors/request/invalid-params` | 1 つ以上のパスパラメータがエンドポイントのスキーマを満たさない場合に返します。 |
| `404` | `/errors/item_categories/not-found` | 指定したカテゴリが存在しない、または呼び出し元から参照できない場合に返します。 |

