Swagger Petstore - OpenAPI 3.0
SSwagger Petstore - OpenAPI 3.0
API Reference
POSTCreate a pet/petPUTReplace a pet/petGETGet a pet by ID/pet/{petId}POSTUpdate a pet with form data/pet/{petId}DELETEDelete a pet/pet/{petId}GETFinds Pets by status./pet/findByStatusGETFinds Pets by tags./pet/findByTags
POSTUpload a pet image/pet/{petId}/uploadImage
GETList pet inventory by status/store/inventoryPOSTCreate a pet order/store/order
GETFind purchase order by ID./store/order/{orderId}DELETEDelete purchase order by identifier./store/order/{orderId}
POSTCreate a user/userGETGet a user by username/user/{username}PUTReplace a user resource/user/{username}DELETEDelete a user resource/user/{username}POSTCreate users from a list/user/createWithListGETLog in a user/user/loginGETLog out a user/user/logout
llms.txtPowered by Octri
GET/user/{username}

Get a user by username

Retrieves a user account by username. Use the username path parameter to identify the user whose details you want to retrieve.

1 parameter
usernamestringrequired

The username of the user to retrieve. Use user1 for testing.

4 status codes
200Returns the user object, including its identifier, username, name, email, password, phone, and status.
idintegeroptional
usernamestringoptional
firstNamestringoptional
lastNamestringoptional
emailstringoptional
passwordstringoptional
phonestringoptional
userStatusintegeroptional

User Status

400Returned when the supplied username is invalid.
404Returned when no user is found for the supplied username.
defaultUnexpected error

Error handling

A 400 is returned when the supplied username is invalid. A 404 is returned when no user is found for the supplied username.

import { SwaggerPetstoreOpenAPI30 } from "swagger-petstore---openapi-3-0-sdk";

const client = new SwaggerPetstoreOpenAPI30({
  baseUrl: "/api/v3",
  auth: { bearer: process.env.SWAGGER_PETSTORE_TOKEN! },
});

const result = await client.user.getByName({ username: "octocat" });
Response
{
  "id": 10,
  "username": "theUser",
  "firstName": "John",
  "lastName": "James",
  "email": "john@email.com",
  "password": "12345",
  "phone": "12345",
  "userStatus": 1
}
PreviousCreate a userNextReplace a user resource