Swagger Petstore (1.0.0)
Download OpenAPI specification:Download
This is a sample server Petstore server.
You can find out more about Swagger at
http://swagger.io or on irc.freenode.net, #swagger.
For this sample, you can use the api key special-key
to test the authorization filters.
This API is documented in OpenAPI format and is based on Petstore sample provided by swagger.io team. It was extended to illustrate features of generator-openapi-repo tool and ReDoc documentation. In addition to standard OpenAPI syntax we use a few vendor extensions.
This API is documented in OpenAPI format and is based on Petstore sample provided by swagger.io team. It was extended to illustrate features of generator-openapi-repo tool and ReDoc documentation. In addition to standard OpenAPI syntax we use a few vendor extensions.
This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with W3C spec. And that allows cross-domain communication from the browser. All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site.
Petstore offers two forms of authentication:
- API Key
- OAuth2 OAuth2 - an open protocol to allow secure authorization in a simple and standard method from web, mobile and desktop applications.
petstore_auth
Get access to data while protecting your account credentials. OAuth2 is also a safer and more secure way to give you access.
Security Scheme Type | OAuth2 |
---|---|
implicit OAuth Flow | Authorization URL: http://petstore.swagger.io/api/oauth/dialog Scopes:
|
New pet Webhook
Information about a new pet in the systems
Request Body schema: application/json
id | |
object Categories this pet belongs to | |
name required | string The name given to a pet |
photoUrls required | Array of strings <url> <= 20 items The list of URL to a cute photos featuring pet |
friend | object Recursive |
Array of objects (Tag) non-empty [ items ] Tags attached to the pet | |
status | string Enum: "available" "pending" "sold" Pet status in the store |
petType | string Type of a pet cat cat dog bee |
huntingSkill required | string Default: "lazy" Enum: "clueless" "lazy" "adventurous" "aggressive" The measured skill for hunting |
Responses
Request samples
- Payload
{- "id": 0,
- "category": {
- "id": 0,
- "name": "string",
- "sub": {
- "prop1": "string"
}
}, - "name": "Guru",
- "photoUrls": [
- "string"
], - "friend": { },
- "tags": [
- {
- "id": 0,
- "name": "string"
}
], - "status": "available",
- "petType": "cat",
- "huntingSkill": "adventurous"
}
Add a new pet to the store
Add new pet to the store inventory.
Authorizations:
write:pets
read:pets
) cookie Parameters
cookieParam required | integer <int64> Some cookie |
header Parameters
Accept-Language | string Default: en-AU Example: en-US The language you prefer for messages. Supported values are en-AU, en-CA, en-GB, en-US |
Request Body schema: application/jsonapplication/jsonapplication/xml
Pet object that needs to be added to the store
object Categories this pet belongs to | |
name required | string The name given to a pet |
photoUrls required | Array of strings <url> <= 20 items The list of URL to a cute photos featuring pet |
friend | object Recursive |
Array of objects (Tag) non-empty [ items ] Tags attached to the pet | |
status | string Enum: "available" "pending" "sold" Pet status in the store |
petType | string Type of a pet cat cat dog bee |
huntingSkill required | string Default: "lazy" Enum: "clueless" "lazy" "adventurous" "aggressive" The measured skill for hunting |
Responses
Request samples
- Payload
- C#
- PHP
{- "category": {
- "name": "string",
- "sub": {
- "prop1": "string"
}
}, - "name": "Guru",
- "photoUrls": [
- "string"
], - "friend": { },
- "tags": [
- {
- "name": "string"
}
], - "status": "available",
- "petType": "cat",
- "huntingSkill": "adventurous"
}
Update an existing pet
Authorizations:
write:pets
read:pets
) cookie Parameters
cookieParam required | integer <int64> Some cookie |
header Parameters
Accept-Language | string Default: en-AU Example: en-US The language you prefer for messages. Supported values are en-AU, en-CA, en-GB, en-US |
Request Body schema: application/jsonapplication/jsonapplication/xml
Pet object that needs to be added to the store
object Categories this pet belongs to | |
name required | string The name given to a pet |
photoUrls required | Array of strings <url> <= 20 items The list of URL to a cute photos featuring pet |
friend | object Recursive |
Array of objects (Tag) non-empty [ items ] Tags attached to the pet | |
status | string Enum: "available" "pending" "sold" Pet status in the store |
petType | string Type of a pet cat cat dog bee |
huntingSkill required | string Default: "lazy" Enum: "clueless" "lazy" "adventurous" "aggressive" The measured skill for hunting |
Responses
Request samples
- Payload
- PHP
{- "category": {
- "name": "string",
- "sub": {
- "prop1": "string"
}
}, - "name": "Guru",
- "photoUrls": [
- "string"
], - "friend": { },
- "tags": [
- {
- "name": "string"
}
], - "status": "available",
- "petType": "cat",
- "huntingSkill": "adventurous"
}
Find pet by ID
Returns a single pet
Authorizations:
path Parameters
petId required | integer <int64> Deprecated ID of pet to return |
Responses
Response samples
- 200
{- "id": 0,
- "category": {
- "id": 0,
- "name": "string",
- "sub": {
- "prop1": "string"
}
}, - "name": "Guru",
- "photoUrls": [
- "string"
], - "friend": { },
- "tags": [
- {
- "id": 0,
- "name": "string"
}
], - "status": "available",
- "petType": "cat",
- "huntingSkill": "adventurous"
}
Updates a pet in the store with form data
Authorizations:
write:pets
read:pets
) path Parameters
petId required | integer <int64> ID of pet that needs to be updated |
Request Body schema: application/x-www-form-urlencoded
name | string Updated name of the pet |
status | string Updated status of the pet |
Responses
Deletes a pet
Authorizations:
write:pets
read:pets
) path Parameters
petId required | integer <int64> Pet id to delete |
header Parameters
api_key | string Example: Bearer <TOKEN> |
Responses
uploads an image
Authorizations:
write:pets
read:pets
) path Parameters
petId required | integer <int64> ID of pet to update |
Request Body schema: application/octet-stream
Responses
Response samples
- 200
{- "code": 0,
- "type": "string",
- "message": "string"
}
Finds Pets by status
Multiple status values can be provided with comma separated strings
Authorizations:
write:pets
read:pets
) query Parameters
status required | Array of strings [ 1 .. 3 ] items Items Enum: "available" "pending" "sold" Status values that need to be considered for filter |
Responses
Response samples
- 200
[- {
- "id": 0,
- "category": {
- "id": 0,
- "name": "string",
- "sub": {
- "prop1": "string"
}
}, - "name": "Guru",
- "photoUrls": [
- "string"
], - "friend": { },
- "tags": [
- {
- "id": 0,
- "name": "string"
}
], - "status": "available",
- "petType": "string"
}
]
Finds Pets by tags Deprecated
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
Authorizations:
write:pets
read:pets
) query Parameters
tags required | Array of strings Tags to filter by |
Responses
Response samples
- 200
[- {
- "id": 0,
- "category": {
- "id": 0,
- "name": "string",
- "sub": {
- "prop1": "string"
}
}, - "name": "Guru",
- "photoUrls": [
- "string"
], - "friend": { },
- "tags": [
- {
- "id": 0,
- "name": "string"
}
], - "status": "available",
- "petType": "string"
}
]
Place an order for a pet
Request Body schema: application/json
order placed for purchasing the pet
quantity | integer <int32> >= 1 Default: 1 |
shipDate | string <date-time> Estimated ship date |
status | string Enum: "placed" "approved" "delivered" Order Status |
requestId | string Unique Request Id |
Responses
Request samples
- Payload
{- "quantity": 1,
- "shipDate": "2019-08-24T14:15:22Z",
- "status": "placed",
- "requestId": "string"
}
Response samples
- 200
- 400
{- "id": 0,
- "petId": 0,
- "quantity": 1,
- "shipDate": "2019-08-24T14:15:22Z",
- "status": "placed",
- "complete": false
}
Find purchase order by ID
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
path Parameters
orderId required | integer <int64> [ 1 .. 5 ] ID of pet that needs to be fetched |
Responses
Response samples
- 200
{- "id": 0,
- "petId": 0,
- "quantity": 1,
- "shipDate": "2019-08-24T14:15:22Z",
- "status": "placed",
- "complete": false
}
Subscribe to the Store events
Add subscription for a store events
Request Body schema: application/json
callbackUrl required | string <uri> This URL will be called by the server when the desired event will occur |
eventName required | string Enum: "orderInProgress" "orderShipped" "orderDelivered" Event name for the subscription |
Responses
Callbacks
Request samples
- Payload
{- "eventName": "orderInProgress"
}
Response samples
- 201
{- "subscriptionId": "AAA-123-BBB-456"
}
Callback payload samples
{- "orderId": "123",
- "timestamp": "2018-10-19T16:46:45Z",
- "status": "inProgress"
}
Create user
This can only be done by the logged in user.
Request Body schema: application/json
Created user object
Pet (object) or Tag (object) | |
username | string >= 4 characters User supplied username |
firstName | string non-empty User first name |
lastName | string non-empty User last name |
string <email> User email address | |
password | string <password> >= 8 characters /(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])/ User password, MUST contain a mix of upper and lower case letters, as well as digits |
phone | string/^\+(?:[0-9]-?){6,14}[0-9]$/ User phone number in international format |
userStatus | integer <int32> User status |
Responses
Request samples
- Payload
{- "pet": {
- "category": {
- "name": "string",
- "sub": {
- "prop1": "string"
}
}, - "name": "Guru",
- "photoUrls": [
- "string"
], - "friend": { },
- "tags": [
- {
- "name": "string"
}
], - "status": "available",
- "petType": "string"
}, - "username": "John78",
- "firstName": "John",
- "lastName": "Smith",
- "email": "john.smith@example.com",
- "password": "drowssaP123",
- "phone": "+1-202-555-0192",
- "userStatus": 0
}
Get user by user name
path Parameters
username required | string The name that needs to be fetched. Use user1 for testing. |
Responses
Response samples
- 200
{- "id": 0,
- "pet": {
- "id": 0,
- "category": {
- "id": 0,
- "name": "string",
- "sub": {
- "prop1": "string"
}
}, - "name": "Guru",
- "photoUrls": [
- "string"
], - "friend": { },
- "tags": [
- {
- "id": 0,
- "name": "string"
}
], - "status": "available",
- "petType": "string"
}, - "username": "John78",
- "firstName": "John",
- "lastName": "Smith",
- "email": "john.smith@example.com",
- "password": "drowssaP123",
- "phone": "+1-202-555-0192",
- "userStatus": 0
}
Updated user
This can only be done by the logged in user.
path Parameters
username required | string name that need to be deleted |
Request Body schema: application/json
Updated user object
Pet (object) or Tag (object) | |
username | string >= 4 characters User supplied username |
firstName | string non-empty User first name |
lastName | string non-empty User last name |
string <email> User email address | |
password | string <password> >= 8 characters /(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])/ User password, MUST contain a mix of upper and lower case letters, as well as digits |
phone | string/^\+(?:[0-9]-?){6,14}[0-9]$/ User phone number in international format |
userStatus | integer <int32> User status |
Responses
Request samples
- Payload
{- "pet": {
- "category": {
- "name": "string",
- "sub": {
- "prop1": "string"
}
}, - "name": "Guru",
- "photoUrls": [
- "string"
], - "friend": { },
- "tags": [
- {
- "name": "string"
}
], - "status": "available",
- "petType": "string"
}, - "username": "John78",
- "firstName": "John",
- "lastName": "Smith",
- "email": "john.smith@example.com",
- "password": "drowssaP123",
- "phone": "+1-202-555-0192",
- "userStatus": 0
}
Creates list of users with given input array
Request Body schema: application/json
List of user object
Pet (object) or Tag (object) | |
username | string >= 4 characters User supplied username |
firstName | string non-empty User first name |
lastName | string non-empty User last name |
string <email> User email address | |
password | string <password> >= 8 characters /(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])/ User password, MUST contain a mix of upper and lower case letters, as well as digits |
phone | string/^\+(?:[0-9]-?){6,14}[0-9]$/ User phone number in international format |
userStatus | integer <int32> User status |
Responses
Request samples
- Payload
[- {
- "pet": {
- "category": {
- "name": "string",
- "sub": {
- "prop1": "string"
}
}, - "name": "Guru",
- "photoUrls": [
- "string"
], - "friend": { },
- "tags": [
- {
- "name": "string"
}
], - "status": "available",
- "petType": "string"
}, - "username": "John78",
- "firstName": "John",
- "lastName": "Smith",
- "email": "john.smith@example.com",
- "password": "drowssaP123",
- "phone": "+1-202-555-0192",
- "userStatus": 0
}
]
Creates list of users with given input array
Request Body schema: application/json
List of user object
Pet (object) or Tag (object) | |
username | string >= 4 characters User supplied username |
firstName | string non-empty User first name |
lastName | string non-empty User last name |
string <email> User email address | |
password | string <password> >= 8 characters /(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])/ User password, MUST contain a mix of upper and lower case letters, as well as digits |
phone | string/^\+(?:[0-9]-?){6,14}[0-9]$/ User phone number in international format |
userStatus | integer <int32> User status |
Responses
Request samples
- Payload
[- {
- "pet": {
- "category": {
- "name": "string",
- "sub": {
- "prop1": "string"
}
}, - "name": "Guru",
- "photoUrls": [
- "string"
], - "friend": { },
- "tags": [
- {
- "name": "string"
}
], - "status": "available",
- "petType": "string"
}, - "username": "John78",
- "firstName": "John",
- "lastName": "Smith",
- "email": "john.smith@example.com",
- "password": "drowssaP123",
- "phone": "+1-202-555-0192",
- "userStatus": 0
}
]
id | |
object Categories this pet belongs to | |
name required | string The name given to a pet |
photoUrls required | Array of strings <url> <= 20 items The list of URL to a cute photos featuring pet |
friend | object Recursive |
Array of objects (Tag) non-empty [ items ] Tags attached to the pet | |
status | string Enum: "available" "pending" "sold" Pet status in the store |
petType | string Type of a pet cat cat dog bee |
huntingSkill required | string Default: "lazy" Enum: "clueless" "lazy" "adventurous" "aggressive" The measured skill for hunting |
{- "id": 0,
- "category": {
- "id": 0,
- "name": "string",
- "sub": {
- "prop1": "string"
}
}, - "name": "Guru",
- "photoUrls": [
- "string"
], - "friend": { },
- "tags": [
- {
- "id": 0,
- "name": "string"
}
], - "status": "available",
- "petType": "cat",
- "huntingSkill": "adventurous"
}
id | integer <int64> Order ID |
petId | integer <int64> Pet ID |
quantity | integer <int32> >= 1 Default: 1 |
shipDate | string <date-time> Estimated ship date |
status | string Enum: "placed" "approved" "delivered" Order Status |
complete | boolean Default: false Indicates whenever order was completed or not |
requestId | string Unique Request Id |
{- "quantity": 1,
- "shipDate": "2018-10-19T16:46:45Z",
- "status": "placed",
- "complete": false
}