更新用户信息
更新指定用户账户的信息。
PUT https://petstore3.swagger.io/api/v3/user/{username}
示例
- API Key
- OAuth 2.0
cURL
PUT "https://petstore3.swagger.io/api/v3/user/user1" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-H "api_key: <YOUR_API_KEY>" \
-d '{
"id": 0,
"username": "user1",
"firstName": "字符串",
"lastName": "字符串",
"email": "字符串",
"password": "字符串",
"phone": "字符串",
"userStatus": 0
}'
cURL
PUT "https://petstore3.swagger.io/api/v3/user/user1" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <YOUR_OAUTH_TOKEN>" \
-d '{
"id": 0,
"username": "user1",
"firstName": "字符串",
"lastName": "字符串",
"email": "字符串",
"password": "字符串",
"phone": "字符串",
"userStatus": 0
}'
响应
| 状态码 | 描述 |
|---|---|
| 200 | 操作成功 |
| 400 | 提供的用户无效 |
| 404 | 未找到该用户 |
| default | 意外错误 |
更新成功时,将返回状态码 200,且不包含响应正文。
参数
路径参数
| 参数名 | 类型 | 描述 |
|---|---|---|
username | 字符串 | 要更新的用户的用户名 |
请求正文
| 参数名 | 类型 | 描述 |
|---|---|---|
body | User 对象 | 必填。 包含更新后信息的 User 对象。 |