---
title: Get Policy Keys by Element Type
slug: single-connect-api-3-0-3/get-policy-keys-by-element-type
description: Learn how to make a GET request to a specific URL using cURL with this code example. Retrieve policy keys based on an element type ID effortlessly, using JSON data sent and accepted through the included headers. Optimize your API integration now.
docTags: 
createdAt: 2022-11-10T14:21:49.000Z
---

{
  "id": "LvH8V9z-W5m_AxzM0xbm5",
  "data": {
    "url": "{{url}}/aioc-rest-web/rest/policy/getPolicyKeysByElementTypeId/ELEMENTTYPEID",
    "method": "GET",
    "request": {
      "pathParameters": [],
      "queryParameters": [],
      "headerParameters": [
        {
          "name": "X-XSRF-TOKEN",
          "type": "string",
          "example": "{{csrftoken}}",
          "description": ""
        }
      ],
      "bodyDataParameters": [],
      "formDataParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "List Policy Keys by Element Type",
        "jsonExample": "[\n    {\n        \"dbId\": 376251,\n        \"userCreate\": \"admin\",\n        \"userUpdate\": null,\n        \"creationDate\": 1581605373075,\n        \"lastUpdate\": null,\n        \"key\": \".*\",\n        \"description\": null,\n        \"userBehaviorRate\": null,\n        \"type\": \"WHITE\",\n        \"deviceTypes\": [\n            \"linux\"\n        ],\n        \"taskName\": null,\n        \"xmlContent\": null\n    },\n    {\n        \"dbId\": 377572,\n        \"userCreate\": \"admin\",\n        \"userUpdate\": null,\n        \"creationDate\": 1581608151289,\n        \"lastUpdate\": null,\n        \"key\": \"date\",\n        \"description\": null,\n        \"userBehaviorRate\": null,\n        \"type\": \"BLACK\",\n        \"deviceTypes\": [\n            \"linux\"\n        ],\n        \"taskName\": null,\n        \"xmlContent\": null\n    }\n]"
      }
    ],
    "contentType": "application/json",
    "description": "This method responds with policy keys which are applicable in related element types. The element type is used as search method for policy keys. Elementy type ID is sent in request URL.",
    "examples": {
      "languages": [
        {
          "id": "38wZCFggH7fgMbWKIBZE9",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request GET \\\n     --url {{url}}/aioc-rest-web/rest/policy/getPolicyKeysByElementTypeId/ELEMENTTYPEID \\\n     --header 'accept: application/json'"
        },
        {
          "id": "XZ3PCOJGRvfIeEJDesO7g",
          "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(\"{{url}}/aioc-rest-web/rest/policy/getPolicyKeysByElementTypeId/ELEMENTTYPEID\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "ksnpzq_a73NdIjNok-4Kf",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"{{url}}/aioc-rest-web/rest/policy/getPolicyKeysByElementTypeId/ELEMENTTYPEID\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Get.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "kTVTgNGc0C0s8oxhXa8-W",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"{{url}}/aioc-rest-web/rest/policy/getPolicyKeysByElementTypeId/ELEMENTTYPEID\"\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": "38wZCFggH7fgMbWKIBZE9"
    },
    "results": {
      "languages": [
        {
          "id": "DC1CJZ1A2pOCqesVfDFsd",
          "language": "200",
          "code": "[\n    {\n        \"dbId\": 376251,\n        \"userCreate\": \"admin\",\n        \"userUpdate\": null,\n        \"creationDate\": 1581605373075,\n        \"lastUpdate\": null,\n        \"key\": \".*\",\n        \"description\": null,\n        \"userBehaviorRate\": null,\n        \"type\": \"WHITE\",\n        \"deviceTypes\": [\n            \"linux\"\n        ],\n        \"taskName\": null,\n        \"xmlContent\": null\n    },\n    {\n        \"dbId\": 377572,\n        \"userCreate\": \"admin\",\n        \"userUpdate\": null,\n        \"creationDate\": 1581608151289,\n        \"lastUpdate\": null,\n        \"key\": \"date\",\n        \"description\": null,\n        \"userBehaviorRate\": null,\n        \"type\": \"BLACK\",\n        \"deviceTypes\": [\n            \"linux\"\n        ],\n        \"taskName\": null,\n        \"xmlContent\": null\n    }\n]"
        }
      ],
      "selectedLanguageId": "DC1CJZ1A2pOCqesVfDFsd"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}