---
title: Returns pet inventories by status
slug: docs/demo/returns-pet-inventories-by-status
description: Learn how to use the curl command to effortlessly retrieve inventory data from the Petstore API by making a GET request to the specified URL. This code example includes the essential headers for seamlessly accepting and transmitting JSON content. Improve 
docTags: 
createdAt: 2022-11-25T15:11:39.000Z
---

{
  "id": "lkpi1vcY0oAQLLwnH1nvs",
  "data": {
    "url": "https://petstore.swagger.io/v2/store/inventory",
    "name": "Returns pet inventories by status",
    "method": "GET",
    "request": {
      "pathParameters": [],
      "queryParameters": [],
      "headerParameters": [],
      "bodyDataParameters": [],
      "formDataParameters": []
    },
    "responses": [
      {
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "schema": [],
            "isExpanded": true,
            "description": "successful operation"
          }
        ],
        "isExpanded": true,
        "statusCode": "200",
        "description": "successful operation",
        "jsonExample": ""
      }
    ],
    "contentType": "application/json",
    "description": "Returns a map of status codes to quantities",
    "examples": {
      "languages": [
        {
          "id": "-c30-6o_enz__zlRvydEO",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request GET \\\n     --url https://petstore.swagger.io/v2/store/inventory \\\n     --header 'accept: application/json'"
        },
        {
          "id": "XTNiVd4zcBn9c4rr-hShG",
          "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://petstore.swagger.io/v2/store/inventory\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "TAHFc6U16pdytVZ4uL_ro",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://petstore.swagger.io/v2/store/inventory\")\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": "oD7pk0QPLeOV7Dx-X-jA4",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://petstore.swagger.io/v2/store/inventory\"\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": "-c30-6o_enz__zlRvydEO"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// successful operation\n{}"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}