Create a pet
POST
/pets
const url = 'http://petstore.swagger.io/v1/pets';const options = {method: 'POST'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://petstore.swagger.io/v1/petsResponses
Section titled “Responses”Null response
default
Section titled “default”Unexpected error
Media typeapplication/json
object
code
required
integer format: int32
message
required
string
Examplegenerated
{ "code": 1, "message": "example"}