Currencies

Creating a new pet

Create pet.

POST https://api.myapi.com/v1/pet

Creates a new pet.

Request Body

NameTypeDescription

name*

string

The name of the pet

owner_id

string

The id of the user who owns the pet

species

string

The species of the pet

breed

string

The breed of the pet

String

{
    "name"="Wilson",
    "owner": {
        "id": "sha7891bikojbkreuy",
        "name": "Samuel Passet",
    "species": "Dog",}
    "breed": "Golden Retriever",
}

Good to know: This API method was created using the API Method block, it's how you can build out an API method documentation from scratch. Have a play with the block and you'll see you can do some nifty things like add and reorder parameters, document responses, and give your methods detailed descriptions.

Updating a pet

Update an existing pet

PUThttps://petstore.swagger.io/v2/pet
Authorization
Body

Pet object that needs to be added to the store

idinteger (int64)
categoryCategory (object)
name*string
Example: "doggie"
photoUrls*array of string
tagsarray of Tag (object)
statusenum

pet status in the store

availablependingsold
Response

Invalid ID supplied

Request
const response = await fetch('https://petstore.swagger.io/v2/pet', {
    method: 'PUT',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      "name": "doggie",
      "photoUrls": [
        "text"
      ]
    }),
});
const data = await response.json();

Good to know: This API method was auto-generated from an example Swagger file. You'll see that it's not editable – that's because the contents are synced to a URL! Any time the linked file changes, the documentation will change too.

Last updated