---
title: Find purchase order by ID
slug: mihai-tests/find-purchase-order-by-id
createdAt: 2024-05-23T13:14:55.472Z
---

{
  "id": "IzJe5LcaOlnVyZYSBhrvG",
  "type": "api-oas-v2",
  "data": {
    "method": "GET",
    "url": "https://petstore3.swagger.io/api/v3/store/order/{orderId}",
    "servers": [
      {
        "url": "https://petstore3.swagger.io/api/v3/store/order/{orderId}"
      }
    ],
    "name": "Find purchase order by ID",
    "description": "<p>For valid response try integer IDs with value &#x3C;= 5 or > 10. Other values will generate exceptions.</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "orderId",
          "type": "integer<int64>",
          "description": "ID of order that needs to be fetched"
        }
      ],
      "headerParameters": [],
      "queryParameters": [],
      "bodyDataParameters": [],
      "formDataParameters": [],
      "oAuthParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "successful operation",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "customType": "Order",
            "schema": [
              {
                "name": "id",
                "kind": "optional",
                "type": "integer<int64>",
                "example": 10
              },
              {
                "name": "petId",
                "kind": "optional",
                "type": "integer<int64>",
                "example": 198772
              },
              {
                "name": "quantity",
                "kind": "optional",
                "type": "integer<int32>",
                "example": 7
              },
              {
                "name": "shipDate",
                "kind": "optional",
                "type": "string<date-time>",
                "example": ""
              },
              {
                "name": "status",
                "kind": "optional",
                "type": "string<placed | approved | delivered>",
                "description": "Order Status",
                "example": "approved"
              },
              {
                "name": "complete",
                "kind": "optional",
                "type": "boolean",
                "example": ""
              }
            ],
            "modelRef": "#/components/schemas/Order",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "Invalid ID supplied",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "404",
        "description": "Order not found",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "PXwPGR5yU1Z_86aUTIwtC",
          "language": "curl",
          "label": "cURL",
          "code": "curl --location --globoff 'https://petstore3.swagger.io/api/v3/store/order/{orderId}' \\\n--header 'Accept: application/json' \\\n--header 'Content-Type: application/json'"
        },
        {
          "id": "AOKN3nYPbtC0U9EUaRx7Y",
          "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: 'GET',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://petstore3.swagger.io/api/v3/store/order/{orderId}\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "Jf4_cSl_Mcjnfimp9VwgW",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://petstore3.swagger.io/api/v3/store/order/{orderId}\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Accept\"] = \"application/json\"\nrequest[\"Content-Type\"] = \"application/json\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "B6HcaBKhECbSxn8vTEtI1",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://petstore3.swagger.io/api/v3/store/order/{orderId}\"\n\npayload = {}\nheaders = {\n   'Accept': 'application/json',\n   'Content-Type': 'application/json'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "PXwPGR5yU1Z_86aUTIwtC"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// successful operation\n{\n  \"id\": 10,\n  \"petId\": 198772,\n  \"quantity\": 7,\n  \"shipDate\": \"\",\n  \"status\": \"approved\",\n  \"complete\": false\n}"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Invalid ID supplied\n"
        },
        {
          "id": "response-2-404",
          "language": "404",
          "code": "// Order not found\n"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "id": "ObeXE2Zbgx939oYqVqsPK",
      "type": "paragraph",
      "children": [
        {
          "text": "For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions."
        }
      ]
    }
  ]
}