---
title: Update an existing pet
slug: mihai-tests/update-an-existing-pet
createdAt: 2023-11-09T13:52:55.274Z
---

{
  "id": "GZ-PsBA5PhWRmIoslhDkJ",
  "type": "api-oas-v2",
  "data": {
    "request": {
      "oAuthParameters": [],
      "pathParameters": [],
      "headerParameters": [
        {
          "kind": "optional",
          "name": "Accept-Language",
          "type": "string",
          "example": "en-US",
          "description": "<p>The language you prefer for messages. Supported values are en-AU, en-CA, en-GB, en-US</p>",
          "default": "en-AU"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "Pet object that needs to be added to the store",
          "customType": "Pet",
          "schema": [
            {
              "name": "id",
              "kind": "optional",
              "type": "integer",
              "description": "Pet ID",
              "modelRef": "#/components/schemas/Id",
              "customType": "Id",
              "schema": []
            },
            {
              "name": "category",
              "kind": "optional",
              "type": "object",
              "description": "Categories this pet belongs to",
              "modelRef": "#/components/schemas/Category",
              "customType": "Category",
              "schema": [
                {
                  "name": "id",
                  "kind": "optional",
                  "type": "integer",
                  "description": "Category ID",
                  "modelRef": "#/components/schemas/Id",
                  "customType": "Id",
                  "schema": []
                },
                {
                  "name": "name",
                  "kind": "optional",
                  "type": "string",
                  "description": "Category name",
                  "example": ""
                },
                {
                  "name": "sub",
                  "kind": "optional",
                  "type": "object",
                  "description": "Test Sub Category",
                  "example": "",
                  "schema": [
                    {
                      "name": "prop1",
                      "kind": "optional",
                      "type": "string",
                      "description": "Dumb Property",
                      "example": ""
                    }
                  ]
                }
              ]
            },
            {
              "name": "name",
              "kind": "required",
              "type": "string",
              "description": "The name given to a pet",
              "example": "Guru"
            },
            {
              "name": "photoUrls",
              "kind": "required",
              "type": "string,integer,null",
              "description": "The list of URL to a cute photos featuring pet",
              "example": ""
            },
            {
              "name": "friend",
              "kind": "optional",
              "type": "object",
              "modelRef": "#/components/schemas/Pet",
              "customType": "Pet",
              "schema": [
                {
                  "name": "",
                  "description": "",
                  "customType": "Circular-Reference"
                }
              ]
            },
            {
              "name": "tags",
              "kind": "optional",
              "type": "array",
              "description": "Tags attached to the pet",
              "modelRef": "#/components/schemas/Tag",
              "customType": "Tag[]",
              "schema": [
                {
                  "name": "id",
                  "kind": "optional",
                  "type": "integer",
                  "description": "Tag ID",
                  "modelRef": "#/components/schemas/Id",
                  "customType": "Id",
                  "schema": []
                },
                {
                  "name": "name",
                  "kind": "optional",
                  "type": "string",
                  "description": "Tag name",
                  "example": ""
                }
              ]
            },
            {
              "name": "status",
              "kind": "optional",
              "type": "string<available | pending | sold>",
              "description": "Pet status in the store",
              "example": "",
              "default": "pending"
            },
            {
              "name": "petType",
              "kind": "optional",
              "type": "string",
              "description": "Type of a pet",
              "example": ""
            },
            {
              "name": "huntingSkill",
              "kind": "optional",
              "type": "integer",
              "example": ""
            }
          ],
          "modelRef": "#/components/schemas/Pet",
          "isExpanded": true
        }
      ],
      "formDataParameters": []
    },
    "method": "PUT",
    "url": "//petstore.swagger.io/v2/pet",
    "servers": [
      {
        "url": "//petstore.swagger.io/v2/pet",
        "description": "Default server"
      },
      {
        "url": "//petstore.swagger.io/sandbox/pet",
        "description": "Sandbox server"
      }
    ],
    "examples": {
      "selectedLanguageId": "jqqI60QxzqZsXY4FYk_ec",
      "languages": [
        {
          "id": "jqqI60QxzqZsXY4FYk_ec",
          "language": "curl",
          "label": "cURL",
          "code": "curl --location --request PUT '//petstore.swagger.io/v2/pet' \\\n--header 'Accept: application/json' \\\n--header 'Content-Type: application/json' \\\n--header 'Accept-Language: en-AU' \\\n--data '{\n  \"id\": 0,\n  \"category\": {\n    \"id\": 0,\n    \"name\": \"\",\n    \"sub\": {\n      \"prop1\": \"\"\n    }\n  },\n  \"name\": \"\",\n  \"photoUrls\": 0,\n  \"friend\": {\n    \"\": \"\"\n  },\n  \"tags\": [\n    {\n      \"id\": 0,\n      \"name\": \"\"\n    }\n  ],\n  \"status\": \"pending\",\n  \"petType\": \"\",\n  \"huntingSkill\": 0\n}'"
        },
        {
          "id": "ZbwlP_99s2DiwocHmemMQ",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"Accept\", \"application/json\");\nmyHeaders.append(\"Content-Type\", \"application/json\");\nmyHeaders.append(\"Accept-Language\", \"en-AU\");\n\nvar raw = JSON.stringify({\n   \"id\": 0,\n   \"category\": {\n      \"id\": 0,\n      \"name\": \"\",\n      \"sub\": {\n         \"prop1\": \"\"\n      }\n   },\n   \"name\": \"\",\n   \"photoUrls\": 0,\n   \"friend\": {\n      \"\": \"\"\n   },\n   \"tags\": [\n      {\n         \"id\": 0,\n         \"name\": \"\"\n      }\n   ],\n   \"status\": \"pending\",\n   \"petType\": \"\",\n   \"huntingSkill\": 0\n});\n\nvar requestOptions = {\n   method: 'PUT',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"//petstore.swagger.io/v2/pet\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "1pb2Sfb9GjO8COcNX7B4u",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"//petstore.swagger.io/v2/pet\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Put.new(url)\nrequest[\"Accept\"] = \"application/json\"\nrequest[\"Content-Type\"] = \"application/json\"\nrequest[\"Accept-Language\"] = \"en-AU\"\nrequest.body = JSON.dump({\n   \"id\": 0,\n   \"category\": {\n      \"id\": 0,\n      \"name\": \"\",\n      \"sub\": {\n         \"prop1\": \"\"\n      }\n   },\n   \"name\": \"\",\n   \"photoUrls\": 0,\n   \"friend\": {\n      \"\": \"\"\n   },\n   \"tags\": [\n      {\n         \"id\": 0,\n         \"name\": \"\"\n      }\n   ],\n   \"status\": \"pending\",\n   \"petType\": \"\",\n   \"huntingSkill\": 0\n})\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "lELAfI_pbD9dtms2Yj4F5",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"//petstore.swagger.io/v2/pet\"\n\npayload = json.dumps({\n   \"id\": 0,\n   \"category\": {\n      \"id\": 0,\n      \"name\": \"\",\n      \"sub\": {\n         \"prop1\": \"\"\n      }\n   },\n   \"name\": \"\",\n   \"photoUrls\": 0,\n   \"friend\": {\n      \"\": \"\"\n   },\n   \"tags\": [\n      {\n         \"id\": 0,\n         \"name\": \"\"\n      }\n   ],\n   \"status\": \"pending\",\n   \"petType\": \"\",\n   \"huntingSkill\": 0\n})\nheaders = {\n   'Accept': 'application/json',\n   'Content-Type': 'application/json',\n   'Accept-Language': 'en-AU'\n}\n\nresponse = requests.request(\"PUT\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ]
    },
    "results": {
      "languages": [
        {
          "id": "response-0-400",
          "language": "400",
          "code": "// Invalid ID supplied\n"
        },
        {
          "id": "response-1-404",
          "language": "404",
          "code": "// Pet not found\n"
        },
        {
          "id": "response-2-405",
          "language": "405",
          "code": "// Validation exception\n"
        }
      ],
      "selectedLanguageId": "response-0-400"
    },
    "responses": [
      {
        "statusCode": "400",
        "description": "Invalid ID supplied",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "404",
        "description": "Pet not found",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "405",
        "description": "Validation exception",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "description": ""
  },
  "children": [
    {
      "text": ""
    }
  ]
}