View Categories

Create a pet

< 1 min read

POST/pets

Code Samples #

  • 💻 cURL
  • 📄 JavaScript
  • 🐍 Python
  • 🐘 PHP
  • 🔷 C#
  • Java
Copy
curl --request POST \
  --url 'https://petstore.example.com/v1/pets' \
  --header 'Content-Type: application/json' \
  --data '{
    "name": "Mochi",
    "tag": "cat"
}'

Request Body #

Content type: application/jsonrequired

FieldTypeRequiredDescription
namestringRequired
tagstringOptional
📋
Example request
Copy
{
    "name": "Mochi",
    "tag": "cat"
}

Responses #

201 — Pet created #

FieldTypeRequiredDescription
namestringRequired
tagstringOptional
idinteger (int64)Required
📋
Example 201 response
Copy
{
    "name": "Mochi",
    "tag": "cat",
    "id": 1
}

422 — Validation failed #

FieldTypeRequiredDescription
codeintegerRequired
messagestringRequired
fieldsarray of stringOptional
📋
Example 422 response
Copy
{
    "code": 1,
    "message": "string",
    "fields": [
        "string"
    ]
}

Response #

201
{
    "name": "Mochi",
    "tag": "cat",
    "id": 1
}
422
{
    "code": 1,
    "message": "string",
    "fields": [
        "string"
    ]
}

Powered by BetterDocs

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is registered on wpml.org as a development site. Switch to a production site key to remove this banner.