---
title: Deletes a pet
slug: mihai-tests/deletes-a-pet
createdAt: 2023-11-09T13:52:55.274Z
---

{
  "id": "HlBRB_Zbd6T-E88ayrHap",
  "type": "api-oas-v2",
  "data": {
    "method": "DELETE",
    "url": "//petstore.swagger.io/v2/pet/{petId}",
    "servers": [
      {
        "url": "//petstore.swagger.io/v2/pet/{petId}",
        "description": "Default server"
      },
      {
        "url": "//petstore.swagger.io/sandbox/pet/{petId}",
        "description": "Sandbox server"
      }
    ],
    "name": "Deletes a pet",
    "description": "",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "petId",
          "type": "integer",
          "description": "Pet id to delete"
        }
      ],
      "headerParameters": [
        {
          "kind": "optional",
          "name": "api_key",
          "type": "string",
          "example": "Bearer <TOKEN>"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [],
      "formDataParameters": [],
      "oAuthParameters": []
    },
    "responses": [
      {
        "statusCode": "400",
        "description": "Invalid pet value",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "examples": {
      "selectedLanguageId": "rRqoOq9lKOq9X-f0daOUp",
      "languages": [
        {
          "id": "rRqoOq9lKOq9X-f0daOUp",
          "language": "curl",
          "label": "cURL",
          "code": "curl --location --globoff --request DELETE '//petstore.swagger.io/v2/pet/{petId}' \\\n--header 'Accept: application/json' \\\n--header 'Content-Type: application/json'"
        },
        {
          "id": "_mwqAI-RjWsyLod4LZJ6f",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"Accept\", \"application/json\");\nmyHeaders.append(\"Content-Type\", \"application/json\");\n\nvar requestOptions = {\n   method: 'DELETE',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"//petstore.swagger.io/v2/pet/{petId}\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "Fj4R3AlJmS5WuOKk5KF3S",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"//petstore.swagger.io/v2/pet/{petId}\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"Accept\"] = \"application/json\"\nrequest[\"Content-Type\"] = \"application/json\"\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "awCnQram2Kjz56sAivVE0",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"//petstore.swagger.io/v2/pet/{petId}\"\n\npayload = {}\nheaders = {\n   'Accept': 'application/json',\n   'Content-Type': 'application/json'\n}\n\nresponse = requests.request(\"DELETE\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ]
    },
    "results": {
      "languages": [
        {
          "id": "response-0-400",
          "language": "400",
          "code": "// Invalid pet value\n"
        }
      ],
      "selectedLanguageId": "response-0-400"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}