使用表单数据更新宠物
更新宠物名称和状态。Pet Store API 从查询字符串读取这两个值,因此不发送表单正文。
POST https://petstore3.swagger.io/api/v3/pet/{petId}
示例
- API Key
- OAuth 2.0
cURL
curl -X POST "https://petstore3.swagger.io/api/v3/pet/210?name=Krypto&status=available" \
-H "accept: application/json" \
-H "api_key: <YOUR_API_KEY>"
cURL
curl -X POST "https://petstore3.swagger.io/api/v3/pet/210?name=Krypto&status=available" \
-H "accept: application/json" \
-H "Authorization: Bearer <YOUR_OAUTH_TOKEN>"
响应
| 状态码 | 描述 |
|---|---|
| 200 | 操作成功 |
| 400 | 输入无效 |
| default | 意外错误 |
响应示例
200: Successful operation
响应
{
"id": 210,
"name": "Krypto",
"category": {
"id": 1,
"name": "Dogs"
},
"photoUrls": [
"string"
],
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "available"
}
参数
路径参数
| 参数名 | 类型 | 描述 |
|---|---|---|
petId | 整数 | 要更新的宠物的 ID |
查询参数
| 参数名 | 类型 | 描述 |
|---|---|---|
name | 字符串 | 要更新的宠物的名称 |
status | 字符串 | 要更新的宠物的状态 |