addPet
POST
/pets
const url = 'https://petstore.swagger.io/v2/pets';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"name":"example","tag":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://petstore.swagger.io/v2/pets \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "tag": "example" }'Creates a new pet in the store. Duplicates are allowed
Request Bodyrequired
Section titled “Request Bodyrequired”Pet to add to the store
Media typeapplication/json
object
name
required
string
tag
string
Examplegenerated
{ "name": "example", "tag": "example"}Responses
Section titled “Responses”Pet response
Media typeapplication/json
object
name
required
string
tag
string
id
required
integer format: int64
Examplegenerated
{ "name": "example", "tag": "example", "id": 1}default
Section titled “default”Unexpected error
Media typeapplication/json
object
code
required
integer format: int32
message
required
string
Examplegenerated
{ "code": 1, "message": "example"}