Skip to main content

Add a new pet to the store

POST 

https://petstore.swagger.io/v2/pet

Add new pet to the store inventory.

Request

Header Parameters

    Accept-Language string

    The language you prefer for messages. Supported values are en-AU, en-CA, en-GB, en-US

    Default value: en-AU
    Example: en-US

Cookie Parameters

    cookieParam int64required

    Some cookie

Bodyrequired

Pet object that needs to be added to the store

    category Category

    Categories this pet belongs to

    namestring

    Category name

    Possible values: non-empty

    sub object

    Test Sub Category

    prop1string

    Dumb Property

    namestringrequired

    The name given to a pet

    Example: Guru
    photoUrlsurl[]required

    The list of URL to a cute photos featuring pet

    Possible values: <= 20

    friend
    tags Tag[]required

    Tags attached to the pet

    Possible values: >= 1

  • Array [
  • namestring

    Tag name

    Possible values: non-empty

  • ]
  • statusstring

    Pet status in the store

    Enum ValueDescription
    availableWhen the pet is available
    pendingWhen the pet is being sold
    soldWhen the pet has been sold.

    These descriptions can contain line

    breaks and also links

    Possible values: [available, pending, sold]

    petType object

    Type of a pet

    Possible values: [cat, dog, bee]

    huntingSkillstringrequired

    The measured skill for hunting

    Possible values: [clueless, lazy, adventurous, aggressive]

    Default value: lazy
    Example: adventurous

Responses

All good, here's some MDX:

note

Some content but no markdown is supported :(

note
A TIP with no leading or trailing spaces between delimiters.
info

Some content with Markdown syntax. Check this api.

MonthSavings
January$250
February$80
March$420

Hmm.....

warning

Some content with Markdown syntax. Check this api which is not supported :( yet

danger

Some plain text

Some more plain text

And more

A code snippet!

print("hello")

And a table!

MonthSavings
January$250
February$80
March$420
Schema
    data object
    oneOf
    string

Authorization: oauth2

name: petstore_authtype: oauth2scopes: write:pets,read:petsdescription: Get access to data while protecting your account credentials.
OAuth2 is also a safer and more secure way to give you access.
flows: {
  "implicit": {
    "authorizationUrl": "http://petstore.swagger.io/api/oauth/dialog",
    "scopes": {
      "write:pets": "modify pets in your account",
      "read:pets": "read your pets"
    }
  }
}
import http.client
import json

conn = http.client.HTTPSConnection("petstore.swagger.io")
payload = json.dumps({
"category": {
"name": "string",
"sub": {
"prop1": "string"
}
},
"name": "Guru",
"photoUrls": [
"string"
],
"friend": {},
"tags": [
{
"name": "string"
}
],
"status": "available",
"petType": {
"huntingSkill": "adventurous"
}
})
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer <token>'
}
conn.request("POST", "/v2/pet", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Request Collapse all
Base URL
https://petstore.swagger.io/v2
Auth
Parameters
— cookierequired
— header
Body required
{
  "category": {
    "name": "string",
    "sub": {
      "prop1": "string"
    }
  },
  "name": "Guru",
  "photoUrls": [
    "string"
  ],
  "friend": {},
  "tags": [
    {
      "name": "string"
    }
  ],
  "status": "available",
  "petType": {
    "huntingSkill": "adventurous"
  }
}
ResponseClear

Click the Send API Request button above and see the response here!