Add a new pet to the store
1 min
POST
//petstore.swagger.io/v2/pet
Header Parameters
- Accept-LanguagestringExampleDescriptionDefaulten-AU
Body Parameters
- bodyPetrequiredDescription
- categoryCategoryDescription
- idIdDescription
- namestringDescription
- subobjectDescription
- prop1stringDescription
- namestringrequiredExampleDescriptionDefaultFluffyIsDefault
- photoUrlsstring,integer,nullrequiredDescription
- friendPet
- Circular-Reference
- tagsTag[]Description
- idIdDescription
- namestringDescription
- statusstring<available | pending | sold>DescriptionDefaultpending
- petTypestringExampleDescription
- huntingSkillinteger
Responses
405
curl
curl --request POST \
--url //petstore.swagger.io/v2/pet \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'accept-language: en-AU' \
--data '{
"name": "FluffyIsDefault",
"photoUrls": "",
"status": "pending"
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
myHeaders.append("accept-language", "en-AU");
var raw = JSON.stringify({
"name": "FluffyIsDefault",
"photoUrls": "",
"status": "pending"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("//petstore.swagger.io/v2/pet", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("//petstore.swagger.io/v2/pet")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
request["accept-language"] = "en-AU"
request.body = JSON.dump({
"name": "FluffyIsDefault",
"photoUrls": "",
"status": "pending"
})
response = http.request(request)
puts response.read_body
python
import requests
import json
url = "//petstore.swagger.io/v2/pet"
payload = json.dumps({
"name": "FluffyIsDefault",
"photoUrls": "",
"status": "pending"
})
headers = {
'accept': 'application/json',
'content-type': 'application/json',
'accept-language': 'en-AU'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
405
// Invalid input
Super Awesome Spren User
{"user": "SuperAwesomeSprenUser", "readingData": "spren_finger_camera_sdk_reading_data"}Super Awesome Spren User2
{"user": "SuperAwesomeSprenUser", "readingData": "spren_finger_camera_sdk_reading_data"}Add new pet to the store inventory.