按 ID 查找宠物
通过唯一 ID 查找指定的宠物。
GET https://petstore3.swagger.io/api/v3/pet/{petId}
示例
- API Key
- OAuth 2.0
cURL
GET "https://petstore3.swagger.io/api/v3/pet/210" \
-H "accept: application/json" \
-H "api_key: <YOUR_API_KEY>"
cURL
GET "https://petstore3.swagger.io/api/v3/pet/210" \
-H "accept: application/json" \
-H "Authorization: Bearer <YOUR_OAUTH_TOKEN>"
响应
| 状态码 | 描述 |
|---|---|
| 200 | 操作成功 |
| 400 | 提供的 ID 无效 |
| 404 | 未找到宠物 |
| default | 意外错误 |
响应示例
200: 操作成功
Response
{
"id": 210,
"name": "Krypto",
"category": {
"id": 1,
"name": "Dogs"
},
"photoUrls": [
"字符串"
],
"tags": [
{
"id": 0,
"name": "字符串"
}
],
"status": "available"
}
参数
路径参数
| 参数名 | 类型 | 描述 |
|---|---|---|
petId | 整数 | 待返回宠物的 ID |