跳到主要内容

使用表单数据更新宠物

更新宠物名称和状态。Pet Store API 从查询字符串读取这两个值,因此不发送表单正文。

POST https://petstore3.swagger.io/api/v3/pet/{petId}

示例​

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>"

响应​

状态码描述
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字符串要更新的宠物的状态