---
title: Delete purchase order by ID
slug: docs/demo/delete-purchase-order-by-id
description: Learn how to send a DELETE request to a targeted API endpoint using the curl command. This code example presents the necessary request URL, headers, and body to successfully implement the functionality. Enhance your understanding of utilizing curl for eff
docTags: 
createdAt: 2022-11-25T15:11:39.000Z
---

{
  "id": "o7YotySwz_h-eOCatIvo8",
  "data": {
    "url": "https://petstore.swagger.io/v2/store/order/{orderId}",
    "name": "Delete purchase order by ID",
    "method": "DELETE",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "orderId",
          "type": "integer",
          "description": "ID of the order that needs to be deleted"
        }
      ],
      "queryParameters": [],
      "headerParameters": [],
      "bodyDataParameters": [],
      "formDataParameters": []
    },
    "responses": [
      {
        "isExpanded": true,
        "statusCode": "400",
        "description": "Invalid ID supplied",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "404",
        "description": "Order not found",
        "jsonExample": ""
      }
    ],
    "contentType": "application/json",
    "description": "<p>For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors</p>",
    "examples": {
      "languages": [
        {
          "id": "6KK89H4lYVEKozvo8b0Cj",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request DELETE \\\n     --url https://petstore.swagger.io/v2/store/order/{orderId} \\\n     --header 'accept: application/json'"
        },
        {
          "id": "Ut1uTIuCGhZ7x8u4TwoBt",
          "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(\"https://petstore.swagger.io/v2/store/order/{orderId}\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "WOFQigQx68zFe7j2vdzlG",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://petstore.swagger.io/v2/store/order/{orderId}\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "L3HLRIJxYMQZZ41Feh4mW",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://petstore.swagger.io/v2/store/order/{orderId}\"\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"
        }
      ],
      "selectedLanguageId": "6KK89H4lYVEKozvo8b0Cj"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-400",
          "language": "400",
          "code": "// Invalid ID supplied\n"
        },
        {
          "id": "response-1-404",
          "language": "404",
          "code": "// Order not found\n"
        }
      ],
      "selectedLanguageId": "response-0-400"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}