PetStore API

Introduction

Demo API Example

Here are few links to the content items:

Operations
Pets

Everything about your Pets

GET /pet/findByStatus
GET /pet/findByTags
GET /pet/{petId}
DELETE /pet/{petId}
POST /pet/{petId}/uploadImage
Add a new pet to the store
POST /pet

Request body

application/json
application/xml

Pet object that needs to be added to the store

Responses

201 Created
405 405

Invalid input

Body
application/xml
application/json
Example 1
POST /pet HTTP/1.1 

Content-Type: application/json

{
    "id": 1,
    "category": {
        "id": 1,
        "name": ""
    },
    "name": "doggie",
    "photoUrls": [
        ""
    ],
    "tags": [
        {
            "id": 1,
            "name": ""
        }
    ],
    "status": "available"
}

HTTP/1.1 405 Method Not Allowed 
Update an existing pet
PUT /pet

Request body

application/json
application/xml

Pet object that needs to be added to the store

Responses

200 OK
Body
400 400

Invalid status value

application/xml
application/json
404 404

Pet not found

application/xml
application/json
405 405

Validation exception

application/xml
application/json
Example 1
PUT /pet HTTP/1.1 

Content-Type: application/json

{
    "id": 1,
    "category": {
        "id": 1,
        "name": ""
    },
    "name": "doggie",
    "photoUrls": [
        ""
    ],
    "tags": [
        {
            "id": 1,
            "name": ""
        }
    ],
    "status": "available"
}
Finds Pets by status
GET /pet/findByStatus

Multiple status values can be provided with comma separated strings

Request parameters

status
string required

Status values that need to be considered for filter

Collection format: multi
Enumeration:
available
pending
sold

Responses

200 200

successful operation

Body
application/xml
application/json
Array of Pet
400 400

Invalid status value

application/xml
application/json
Example 1
GET /pet/findByStatus?status=available HTTP/1.1 

HTTP/1.1 200 OK 

Content-Type: application/json

[
    {
        "id": 1,
        "category": {
            "id": 1,
            "name": ""
        },
        "name": "doggie",
        "photoUrls": [
            ""
        ],
        "tags": [
            {
                "id": 1,
                "name": ""
            }
        ],
        "status": "available"
    }
]
Finds Pets by tags
GET /pet/findByTags

Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.

Request parameters

tags
string required

Tags to filter by

Collection format: multi

Responses

200 200

successful operation

Body
application/xml
application/json
Array of Pet
400 400

Invalid status value

application/xml
application/json
Example 1
GET /pet/findByTags?tags=pretty HTTP/1.1 

HTTP/1.1 200 OK 

Content-Type: application/json

[
    {
        "id": 1,
        "category": {
            "id": 1,
            "name": ""
        },
        "name": "doggie",
        "photoUrls": [
            ""
        ],
        "tags": [
            {
                "id": 1,
                "name": "pretty"
            }
        ],
        "status": "available"
    }
]
Find pet by ID
GET /pet/{petId}

Returns a single pet

Path variables

petId
integer int64 required

ID of pet to return

Responses

200 200

successful operation

Body
application/xml
application/json
400 400

Invalid status value

application/xml
application/json
404 404

Pet not found

application/xml
application/json
Updates a pet in the store with form data
POST /pet/{petId}

Path variables

petId
integer int64 required

ID of pet that needs to be updated

Request body

application/x-www-form-urlencoded
Object
name
string

Updated name of the pet

status
string

Updated status of the pet

Responses

405 405

Invalid input

application/xml
application/json
Deletes a pet
DELETE /pet/{petId}

Path variables

petId
integer int64 required

Pet id to delete

Request headers

api_key
string optional

Responses

400 400

Invalid status value

application/xml
application/json
404 404

Pet not found

application/xml
application/json
uploads an image
POST /pet/{petId}/uploadImage

Path variables

petId
integer int64 required

ID of pet to update

Request body

multipart/form-data
Object
additionalMetadata
string

Additional data to pass to server

file
string binary

file to upload

Responses

200 200

successful operation

Body
application/json
Store

Access to Petstore orders

GET /store/inventory
POST /store/order
GET /store/order/{orderId}
DELETE /store/order/{orderId}
Returns pet inventories by status
GET /store/inventory

Returns a map of status codes to quantities

Responses

200 200

successful operation

Body
application/json
Object
Place an order for a pet
POST /store/order

Request body

order placed for purchasing the pet

Responses

200 200

successful operation

Body
application/xml
application/json
400 400

Invalid status value

application/xml
application/json
Find purchase order by ID
GET /store/order/{orderId}

For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions

Path variables

orderId
integer int64 required

ID of pet that needs to be fetched

Min: 1
Max: 10

Responses

200 200

successful operation

Body
application/xml
application/json
400 400

Invalid status value

application/xml
application/json
404 404

Order not found

application/xml
application/json
Delete purchase order by ID
DELETE /store/order/{orderId}

For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors

Path variables

orderId
integer int64 required

ID of the order that needs to be deleted

Min: 1

Responses

204 No Content
400 400

Invalid status value

application/xml
application/json
404 404

Order not found

application/xml
application/json
Users

Operations about user

POST /user
GET /user/login
GET /user/{username}
PUT /user/{username}
DELETE /user/{username}
Create user
POST /user

This can only be done by the logged in user.

Request body

Created user object

Responses

201 Created
Body
500 default

successful operation

application/xml
application/json
Creates list of users with given input array
POST /user/createWithArray

Request body

List of user object

Array of User

Responses

500 default

successful operation

application/xml
application/json
Creates list of users with given input array
POST /user/createWithList

Request body

List of user object

Array of User

Responses

500 default

successful operation

application/xml
application/json
Logs user into the system
GET /user/login

Request parameters

username
string required

The user name for login

password
string required

The password for login in clear text

Responses

200 200

successful operation

Headers
X-Rate-Limit
integer int32 optional

calls per hour allowed by the user

X-Expires-After
string date-time optional

date in UTC when token expires

Body
application/xml
application/json
string
400 400

Invalid status value

application/xml
application/json
Logs out current logged in user session
GET /user/logout

Responses

500 default

successful operation

application/xml
application/json
Get user by user name
GET /user/{username}

Path variables

username
string required

The name that needs to be fetched. Use user1 for testing.

Responses

200 200

successful operation

Body
application/xml
application/json
400 400

Invalid status value

application/xml
application/json
404 404

User not found

application/xml
application/json
Updated user
PUT /user/{username}

This can only be done by the logged in user.

Path variables

username
string required

name that need to be updated

Request body

Updated user object

Responses

400 400

Invalid status value

application/xml
application/json
404 404

User not found

application/xml
application/json
200 OK
Body
string
Example:
OK
Delete user
DELETE /user/{username}

This can only be done by the logged in user.

Path variables

username
string required

The name that needs to be deleted

Responses

400 400

Invalid status value

application/xml
application/json
404 404

User not found

application/xml
application/json
Type Definitions
Order
Object
id
integer int64
petId
integer int64
quantity
integer int32
shipDate
string date-time
status
string

Order Status

Enumeration:
placed
approved
delivered
complete
boolean
Category
Object
id
integer int64
name
string
Types: Pet
User
Object
id
integer int64
username
string
firstName
string
lastName
string
email
string
password
string
phone
string
userStatus
integer int32

User Status

Tag
Object
id
integer int64
name
string
Types: Pet
Pet
Object
id
integer int64
category
name
string
Example:
doggie
photoUrls
Array of string
tags
Array of Tag
status
string

pet status in the store

Enumeration:
available
pending
sold
ApiResponse
Object
code
integer int32
type
string
message
string