Store API 関数
これらの API 関数を使用すると、ペットショップの在庫や注文を管理できます。
ペット在庫の取得
ステータス別にペットの在庫を返します。
エンドポイント: https://petstore3.swagger.io/api/v3/store/inventory
操作: GET
例
- API キー
- OAuth 2.0
GET "https://petstore3.swagger.io/api/v3/store/inventory" \
-H "accept: application/json" \
-H "api_key: <YOUR_API_KEY>"
GET "https://petstore3.swagger.io/api/v3/store/inventory" \
-H "accept: application/json" \
-H "Authorization: Bearer <YOUR_OAUTH_TOKEN>"
レスポンス
| コード | 説明 |
|---|---|
| 200 | 操作成功 |
| default | 予期しないエラー |
レスポンス例
200: 操作成功
{
"sold": 0,
"available": 0,
"pending": 0
}
パラメータ
なし
注文を行う
ペットの注文を行います。
エンドポイント: https://petstore3.swagger.io/api/v3/store/order
操作: POST
例
- API キー
- OAuth 2.0
POST "https://petstore3.swagger.io/api/v3/store/order" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-H "api_key: <YOUR_API_KEY>" \
-d '{
"id": 0,
"petId": 0,
"quantity": 0,
"shipDate": "2025-08-11T15:13:06.939Z",
"status": "placed",
"complete": false
}'
POST "https://petstore3.swagger.io/api/v3/store/order" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <YOUR_OAUTH_TOKEN>" \
-d '{
"id": 0,
"petId": 0,
"quantity": 0,
"shipDate": "2025-08-11T15:13:06.939Z",
"status": "placed",
"complete": false
}'
レスポンス
| コード | 説明 |
|---|---|
| 200 | 操作成功 |
| 400 | 無効な注文 |
| default | 予期しないエラー |
レスポンス例
200: 操作成功
{
"id": 0,
"petId": 0,
"quantity": 0,
"shipDate": "2025-08-11T15:13:06.939Z",
"status": "placed",
"complete": false
}
パラメータ
リクエスト本文
| 名前 | タイプ | 説明 |
|---|---|---|
| body | Order オブジェクト | (必須) ペットの Order オブジェクト。 |
注文の検索
ID に基づいて注文を検索します。
エンドポイント: https://petstore3.swagger.io/api/v3/store/order/{orderId}
操作: GET
例
- API キー
- OAuth 2.0
GET "https://petstore3.swagger.io/api/v3/store/order/1" \
-H "accept: application/json" \
-H "api_key: <YOUR_API_KEY>"
GET "https://petstore3.swagger.io/api/v3/store/order/1" \
-H "accept: application/json" \
-H "Authorization: Bearer <YOUR_OAUTH_TOKEN>"
レスポンス
| コード | 説明 |
|---|---|
| 200 | 操作成功 |
| 400 | 指定された ID が無効 |
| 404 | 注文が見つかりません |
| default | 予期しないエラー |
レスポンス例
200: 操作成功
{
"id": 1,
"petId": 0,
"quantity": 0,
"shipDate": "2025-08-11T15:13:06.939Z",
"status": "placed",
"complete": false
}
パラメータ
パスパラメータ
| 名前 | タイプ | 説明 |
|---|---|---|
| orderId | 整数 | 取得する注文書の ID |
注文の削除
ID に基づいて注文を削除します。
エンドポイント: https://petstore3.swagger.io/api/v3/store/order/{orderId}
操作: DELETE
例
- API キー
- OAuth 2.0
DELETE "https://petstore3.swagger.io/api/v3/store/order/1" \
-H "accept: application/json" \
-H "api_key: <YOUR_API_KEY>"
DELETE "https://petstore3.swagger.io/api/v3/store/order/1" \
-H "accept: application/json" \
-H "Authorization: Bearer <YOUR_OAUTH_TOKEN>"
レスポンス
| コード | 説明 |
|---|---|
| 200 | 注文が削除されました |
| 400 | 指定された ID が無効 |
| 404 | 注文が見つかりません |
| default | 予期しないエラー |
(削除が成功した場合、レスポンスボディなしで 200 コードが返されます。)
パラメータ
パスパラメータ
| 名前 | タイプ | 説明 |
|---|---|---|
| orderId | 整数 | 削除する注文の ID |