Skip to main content

Swagger Petstore Sample

This is an example of a Petstore server.

Learn about Swagger or join the IRC channel #swagger on irc.freenode.net.

For this sample, you can use the api key special-key to test the authorization filters.

Access

  1. APIKey KeyParamName:api_key KeyInQuery:false KeyInHeader:true
  2. OAuth AuthorizationUrl:http://petstore.swagger.io/api/oauth/dialogTokenUrl:

Methods

[ Jump to Models ]

Pet

Up
post /pets
Add a new pet to the store ( addPet)

Consumes

This API call consumes the following media types via the Content-Type request header:
  • application/json
  • application/xml

Request body

body body_1 (optional)
Body Parameter — Pet object that needs to be added to the store

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.
  • application/json
  • application/xml

Responses

405

Invalid input

Up
delete /pets/petId
Deletes a pet ( deletePet)

Path parameters

petId (required)
Path Parameter — Pet id to delete format: int64

Request headers

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.
  • application/json
  • application/xml

Responses

400

Invalid pet value

Up
get /pets/findByStatus
Finds Pets by status ( findPetsByStatus)
Multiple status values can be provided with comma seperated strings

Query parameters

status (optional)
Query Parameter — Status values that need to be considered for filter

Example data

Content-Type: application/xml

123456789

doggie

aeiou

aeiou

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.
  • application/json
  • application/xml

Responses

200

successful operation

400

Invalid status value

Up
get /pets/findByTags
Finds Pets by tags ( findPetsByTags)
Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.

Query parameters

tags (optional)
Query Parameter — Tags to filter by

Return type

Example data

Content-Type: application/json

"photoUrls" : [ "aeiou" ],

"name" : "doggie",

"id" : 0,

"name" : "aeiou",

"id" : 6

},

"tags" : [ "" ],

"status" : "aeiou"

} ]

Example data

Content-Type: application/xml

123456789

doggie

aeiou

aeiou

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.
  • application/json
  • application/xml

Responses

200

successful operation

400

Invalid tag value

Find pet by ID ( getPetById)
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions

Path parameters

petId (required)
Path Parameter — ID of pet that needs to be fetched format: int64

Return type

Example data

Content-Type: application/json

"photoUrls" : [ "aeiou" ],

"name" : "doggie",

"id" : 0,

"name" : "aeiou",

"id" : 6

},

"tags" : [ "" ],

"status" : "aeiou"

}

Example data

Content-Type: application/xml

123456789

doggie

aeiou

aeiou

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.
  • application/json
  • application/xml

Responses

200

successful operation inline_response_200

400

Invalid ID supplied

404

Pet not found

Up
put /pets
Update an existing pet ( updatePet)

Consumes

This API call consumes the following media types via the Content-Type request header:
  • application/json
  • application/xml

Request body

body body (optional)
Body Parameter — Pet object that needs to be added to the store

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.
  • application/json
  • application/xml

Responses

400

Invalid ID supplied

404

Pet not found

405

Validation exception

Up
post /pets/petId
Updates a pet in the store with form data ( updatePetWithForm)

Path parameters

petId (required)
Path Parameter — ID of pet that needs to be updated

Consumes

This API call consumes the following media types via the Content-Type request header:
  • application/x-www-form-urlencoded

Form parameters

name (required)
Form Parameter — Updated name of the pet
status (required)
Form Parameter — Updated status of the pet

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.
  • application/json
  • application/xml

Responses

405

Invalid input

Store

Up
delete /stores/order/orderId
Delete purchase order by ID ( deleteOrder)
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors

Path parameters

orderId (required)
Path Parameter — ID of the order that needs to be deleted

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.
  • application/json
  • application/xml

Responses

400

Invalid ID supplied

404

Order not found

Up
get /stores/order/orderId
Find purchase order by ID ( getOrderById)
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions

Path parameters

orderId (required)
Path Parameter — ID of pet that needs to be fetched

Return type

Example data

Content-Type: application/json

"petId" : 6,

"quantity" : 1,

"id" : 0,

"shipDate" : "2000-01-23T04:56:07.000+00:00",

"complete" : true,

"status" : "aeiou"

}

Example data

Content-Type: application/xml

123456789

123456789

123

2000-01-23T04:56:07.000Z

aeiou

true

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.
  • application/json
  • application/xml

Responses

200

successful operation inline_response_200_1

400

Invalid ID supplied

404

Order not found

Up
post /stores/order
Place an order for a pet ( placeOrder)

Request body

body body_2 (optional)
Body Parameter — order placed for purchasing the pet

Return type

Example data

Content-Type: application/json

"petId" : 6,

"quantity" : 1,

"id" : 0,

"shipDate" : "2000-01-23T04:56:07.000+00:00",

"complete" : true,

"status" : "aeiou"

}

Example data

Content-Type: application/xml

123456789

123456789

123

2000-01-23T04:56:07.000Z

aeiou

true

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.
  • application/json
  • application/xml

Responses

200

successful operation inline_response_200_1

400

Invalid Order

User

Up
post /users
Create user ( createUser)
This can only be done by the logged in user.

Request body

body body_3 (optional)
Body Parameter — Created user object

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.
  • application/json
  • application/xml

Responses

default

successful operation

Up
post /users/createWithArray
Creates list of users with given input array ( createUsersWithArrayInput)

Request body

body body_4 (optional)
Body Parameter — List of user object

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.
  • application/json
  • application/xml

Responses

default

successful operation

Up
post /users/createWithList
Creates list of users with given input array ( createUsersWithListInput)

Request body

body body_4 (optional)
Body Parameter — List of user object

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.
  • application/json
  • application/xml

Responses

default

successful operation
Up
delete /users/username
Delete user ( deleteUser)
This can only be done by the logged in user.

Path parameters

username (required)
Path Parameter — The name that needs to be deleted

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.
  • application/json
  • application/xml

Responses

400

Invalid username supplied

404

User not found

Up
get /users/username
Get user by user name ( getUserByName)

Path parameters

username (required)
Path Parameter — The name that needs to be fetched. Use user1 for testing.

Return type

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.
  • application/json
  • application/xml

Responses

200

successful operation body_4

400

Invalid username supplied

404

User not found

Up
get /users/login
Logs user into the system ( loginUser)

Query parameters

username (optional)
Query Parameter — The user name for login
password (optional)
Query Parameter — The password for login in clear text

Return type

String

Example data

Content-Type: application/json

"aeiou"

Example data

Content-Type: application/xml

aeiou

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.
  • application/json
  • application/xml

Responses

200

successful operation String

400

Invalid username/password supplied

Up
get /users/logout
Logs out current logged in user session ( logoutUser)

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.
  • application/json
  • application/xml

Responses

default

successful operation

Up
put /users/username
Updated user ( updateUser)
This can only be done by the logged in user.

Path parameters

username (required)
Path Parameter — name that need to be deleted

Request body

body body_5 (optional)
Body Parameter — Updated user object

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.
  • application/json
  • application/xml

Responses

400

Invalid user supplied

404

User not found