メインコンテンツまでスキップ

Store API 関数

これらの API 関数を使用すると、ペットショップの在庫や注文を管理できます。

ペット在庫の取得

ステータス別にペットの在庫を返します。

エンドポイント: https://petstore3.swagger.io/api/v3/store/inventory

操作: GET

GET "https://petstore3.swagger.io/api/v3/store/inventory" \
-H "accept: application/json" \
-H "api_key: <YOUR_API_KEY>"

レスポンス

コード説明
200操作成功
default予期しないエラー
レスポンス例

200: 操作成功

{
"sold": 0,
"available": 0,
"pending": 0
}

パラメータ

なし

注文を行う

ペットの注文を行います。

エンドポイント: https://petstore3.swagger.io/api/v3/store/order

操作: POST

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
}'

レスポンス

コード説明
200操作成功
400無効な注文
default予期しないエラー
レスポンス例

200: 操作成功

{
"id": 0,
"petId": 0,
"quantity": 0,
"shipDate": "2025-08-11T15:13:06.939Z",
"status": "placed",
"complete": false
}

パラメータ

リクエスト本文
名前タイプ説明
bodyOrder オブジェクト(必須) ペットの Order オブジェクト。

注文の検索

ID に基づいて注文を検索します。

エンドポイント: https://petstore3.swagger.io/api/v3/store/order/{orderId}

操作: GET

GET "https://petstore3.swagger.io/api/v3/store/order/1" \
-H "accept: application/json" \
-H "api_key: <YOUR_API_KEY>"

レスポンス

コード説明
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

DELETE "https://petstore3.swagger.io/api/v3/store/order/1" \
-H "accept: application/json" \
-H "api_key: <YOUR_API_KEY>"

レスポンス

コード説明
200注文が削除されました
400指定された ID が無効
404注文が見つかりません
default予期しないエラー

(削除が成功した場合、レスポンスボディなしで 200 コードが返されます。)

パラメータ

パスパラメータ
名前タイプ説明
orderId整数削除する注文の ID