按用户名获取用户
根据用户名查询用户详情。
GET https://petstore3.swagger.io/api/v3/user/{username}
示例
- API Key
- OAuth 2.0
cURL
GET "https://petstore3.swagger.io/api/v3/user/user1" \
-H "accept: application/json" \
-H "api_key: <YOUR_API_KEY>"
cURL
GET "https://petstore3.swagger.io/api/v3/user/user1" \
-H "accept: application/json" \
-H "Authorization: Bearer <YOUR_OAUTH_TOKEN>"
响应
| 状态码 | 描述 |
|---|---|
| 200 | 操作成功 |
| 400 | 提供的用户名无效 |
| 404 | 未找到该用户 |
| default | 意外错误 |
响应示例
200: 操作成功
Response
{
"id": 0,
"username": "字符串",
"firstName": "字符串",
"lastName": "字符串",
"email": "字符串",
"password": "字符串",
"phone": "字符串",
"userStatus": 0
}
参数
路径参数
| 参数名 | 类型 | 描述 |
|---|---|---|
username | 字符串 | 要查询的用户的用户名。测试时请使用 "user"。 |