---
title: Get measurement data
slug: dev/get-measurement-data
docTags: 
createdAt: 2023-02-23T17:07:09.000Z
---

{
  "id": "wMzMMb56D92XPVLWZkP1S",
  "type": "api-oas-v2",
  "data": {
    "method": "GET",
    "url": "/edgeDevices/{edgeDeviceId}/measurementData",
    "name": "Get measurement data",
    "description": "<p>Allows to retrieve measurement data from a specific edge-device.\nSpecify a specific time frame, granularity, and returned fields with the query parameters.\nIf no 'from' and 'to' parameters are specified, only the most recent data point is returned.</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "edgeDeviceId",
          "type": "string",
          "description": "<p>ID of the edge-device, e.g. a sensor_id</p>"
        }
      ],
      "headerParameters": [
        {
          "kind": "required",
          "name": "Authorization",
          "type": "string",
          "description": "Auth header",
          "example": "{\"Authorization\":\"Bearer {jwt token}\"}"
        }
      ],
      "queryParameters": [
        {
          "kind": "required",
          "name": "granularity",
          "type": "string",
          "description": "<p>Specify the time granularity. Must be one of [\"t\", \"m\", \"q\", \"h\", \"d\"] for ten-second, minute, quarter-hour, hour or day values.</p>",
          "example": "t"
        },
        {
          "kind": "optional",
          "name": "from",
          "type": "string",
          "description": "Specify a time frame starting point.",
          "example": "2023-01-01T00:00:00Z"
        },
        {
          "kind": "optional",
          "name": "to",
          "type": "string",
          "description": "Specify a time frame ending point.",
          "example": "2023-01-02T00:00:00Z"
        },
        {
          "kind": "optional",
          "name": "fields[]",
          "type": "string",
          "description": "<p>Specify the returned fields. Must be in [\"p\", \"e\", \"q\", \"s\", \"u\", \"i\"]. Multiple fields can be specified by setting this parameter multiple times.</p>",
          "example": "p"
        },
        {
          "kind": "optional",
          "name": "$skip",
          "type": "number",
          "description": "Used for pagination. Specify a number of returned elements to skip to the next page.",
          "example": 4320
        }
      ],
      "bodyDataParameters": [],
      "formDataParameters": [],
      "oAuthParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "OK",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "schema": [
              {
                "name": "total",
                "kind": "optional",
                "type": "number",
                "description": "total number of elements",
                "example": ""
              },
              {
                "name": "limit",
                "kind": "optional",
                "type": "number",
                "description": "limit of max returned elements",
                "example": ""
              },
              {
                "name": "skip",
                "kind": "optional",
                "type": "number",
                "description": "number of skipped elements",
                "example": ""
              },
              {
                "name": "data",
                "kind": "optional",
                "type": "array",
                "example": "",
                "itemType": "object",
                "customType": "object[]",
                "schema": [
                  {
                    "name": "time",
                    "kind": "optional",
                    "type": "string",
                    "description": "timestamp",
                    "example": "2023-01-01T00:00:00.000Z"
                  },
                  {
                    "name": "l1_p",
                    "kind": "optional",
                    "type": "number",
                    "description": "real power phase 1",
                    "example": ""
                  },
                  {
                    "name": "l2_p",
                    "kind": "optional",
                    "type": "number",
                    "description": "real power phase 2",
                    "example": ""
                  },
                  {
                    "name": "l3_p",
                    "kind": "optional",
                    "type": "number",
                    "description": "real power phase 3",
                    "example": ""
                  },
                  {
                    "name": "l1_q",
                    "kind": "optional",
                    "type": "number",
                    "description": "reactive power phase 1",
                    "example": ""
                  },
                  {
                    "name": "l2_q",
                    "kind": "optional",
                    "type": "number",
                    "description": "reactive power phase 2",
                    "example": ""
                  },
                  {
                    "name": "l3_q",
                    "kind": "optional",
                    "type": "number",
                    "description": "reactive power phase 3",
                    "example": ""
                  },
                  {
                    "name": "l1_s",
                    "kind": "optional",
                    "type": "number",
                    "description": "apparent power phase 1",
                    "example": ""
                  },
                  {
                    "name": "l2_s",
                    "kind": "optional",
                    "type": "number",
                    "description": "apparent power phase 2",
                    "example": ""
                  },
                  {
                    "name": "l3_s",
                    "kind": "optional",
                    "type": "number",
                    "description": "apparent power phase 3",
                    "example": ""
                  },
                  {
                    "name": "l1_u",
                    "kind": "optional",
                    "type": "number",
                    "description": "voltage phase 1",
                    "example": ""
                  },
                  {
                    "name": "l2_u",
                    "kind": "optional",
                    "type": "number",
                    "description": "voltage phase 2",
                    "example": ""
                  },
                  {
                    "name": "l3_u",
                    "kind": "optional",
                    "type": "number",
                    "description": "voltage phase 3",
                    "example": ""
                  },
                  {
                    "name": "l1_i",
                    "kind": "optional",
                    "type": "number",
                    "description": "current phase 1",
                    "example": ""
                  },
                  {
                    "name": "l2_i",
                    "kind": "optional",
                    "type": "number",
                    "description": "current phase 2",
                    "example": ""
                  },
                  {
                    "name": "l3_i",
                    "kind": "optional",
                    "type": "number",
                    "description": "current phase 3",
                    "example": ""
                  },
                  {
                    "name": "l1_energy",
                    "kind": "optional",
                    "type": "number",
                    "description": "energy phase 1",
                    "example": ""
                  },
                  {
                    "name": "l2_energy",
                    "kind": "optional",
                    "type": "number",
                    "description": "energy phase 2",
                    "example": ""
                  },
                  {
                    "name": "l3_energy",
                    "kind": "optional",
                    "type": "number",
                    "description": "energy phase 3",
                    "example": ""
                  }
                ]
              }
            ],
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "Bad Request",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "schema": [
              {
                "name": "name",
                "kind": "optional",
                "type": "string",
                "description": "Error name",
                "example": "BadRequest"
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": "Error message",
                "example": "Data does not match schema"
              },
              {
                "name": "code",
                "kind": "optional",
                "type": "number",
                "description": "HTTP status code",
                "example": 400
              },
              {
                "name": "className",
                "kind": "optional",
                "type": "string",
                "description": "Error class name",
                "example": "bad-request"
              },
              {
                "name": "data",
                "kind": "optional",
                "type": "string",
                "description": "Error data",
                "example": ""
              },
              {
                "name": "errors",
                "kind": "optional",
                "type": "array",
                "description": "Description of errors",
                "example": "[\"detailed description of error\"]",
                "itemType": "object",
                "customType": "object[]",
                "itemExample": ""
              }
            ],
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "401",
        "description": "Unauthorized",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "schema": [
              {
                "name": "name",
                "kind": "optional",
                "type": "string",
                "description": "Error name",
                "example": "NotAuthenticated"
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": "Error message",
                "example": "Not authenticated"
              },
              {
                "name": "code",
                "kind": "optional",
                "type": "number",
                "description": "HTTP status code",
                "example": 401
              },
              {
                "name": "className",
                "kind": "optional",
                "type": "string",
                "description": "Error class name",
                "example": "not-authenticated"
              },
              {
                "name": "errors",
                "kind": "optional",
                "type": "object",
                "description": "Description of errors",
                "example": "",
                "schema": []
              }
            ],
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "403",
        "description": "Forbidden",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "schema": [
              {
                "name": "name",
                "kind": "optional",
                "type": "string",
                "description": "Error name",
                "example": "Forbidden"
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": "Error message",
                "example": "Access Forbidden"
              },
              {
                "name": "code",
                "kind": "optional",
                "type": "number",
                "description": "HTTP status code",
                "example": 403
              },
              {
                "name": "className",
                "kind": "optional",
                "type": "string",
                "description": "Error class name",
                "example": "forbidden"
              },
              {
                "name": "errors",
                "kind": "optional",
                "type": "object",
                "description": "Description of errors",
                "example": "",
                "schema": []
              }
            ],
            "isExpanded": true
          }
        ]
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "cLXXftHyMEHHcYex50kna",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request GET \\\n     --url '/edgeDevices/{edgeDeviceId}/measurementData?granularity=t' \\\n     --header 'accept: application/json' \\\n     --header 'authorization: {\"Authorization\":\"Bearer {jwt token}\"}'"
        },
        {
          "id": "orCadhVW4hyOBO7zronqe",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\nmyHeaders.append(\"authorization\", \"{\\\"Authorization\\\":\\\"Bearer {jwt token}\\\"}\");\n\nvar requestOptions = {\n   method: 'GET',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"/edgeDevices/{edgeDeviceId}/measurementData?granularity=t\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "8otU6BHoBIQgA2ZwP1U95",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"/edgeDevices/{edgeDeviceId}/measurementData?granularity=t\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Get.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest[\"authorization\"] = \"{\\\"Authorization\\\":\\\"Bearer {jwt token}\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "UpkOmEyHlcL6ZyLLx3vTg",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"/edgeDevices/{edgeDeviceId}/measurementData?granularity=t\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json',\n   'authorization': '{\"Authorization\":\"Bearer {jwt token}\"}'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "cLXXftHyMEHHcYex50kna"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// OK\n{\n  \"total\": 0,\n  \"limit\": 0,\n  \"skip\": 0,\n  \"data\": [\n    {\n      \"time\": \"2023-01-01T00:00:00.000Z\",\n      \"l1_p\": 0,\n      \"l2_p\": 0,\n      \"l3_p\": 0,\n      \"l1_q\": 0,\n      \"l2_q\": 0,\n      \"l3_q\": 0,\n      \"l1_s\": 0,\n      \"l2_s\": 0,\n      \"l3_s\": 0,\n      \"l1_u\": 0,\n      \"l2_u\": 0,\n      \"l3_u\": 0,\n      \"l1_i\": 0,\n      \"l2_i\": 0,\n      \"l3_i\": 0,\n      \"l1_energy\": 0,\n      \"l2_energy\": 0,\n      \"l3_energy\": 0\n    }\n  ]\n}"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Bad Request\n{\n  \"name\": \"BadRequest\",\n  \"message\": \"Data does not match schema\",\n  \"code\": 400,\n  \"className\": \"bad-request\",\n  \"data\": \"\",\n  \"errors\": [\n    {}\n  ]\n}"
        },
        {
          "id": "response-2-401",
          "language": "401",
          "code": "// Unauthorized\n{\n  \"name\": \"NotAuthenticated\",\n  \"message\": \"Not authenticated\",\n  \"code\": 401,\n  \"className\": \"not-authenticated\",\n  \"errors\": {}\n}"
        },
        {
          "id": "response-3-403",
          "language": "403",
          "code": "// Forbidden\n{\n  \"name\": \"Forbidden\",\n  \"message\": \"Access Forbidden\",\n  \"code\": 403,\n  \"className\": \"forbidden\",\n  \"errors\": {}\n}"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "id": "Ugy1-JTcdg9OQKcwl_BYN",
      "type": "paragraph",
      "children": [
        {
          "text": "Allows to retrieve measurement data from a specific edge-device.\nSpecify a specific time frame, granularity, and returned fields with the query parameters.\nIf no 'from' and 'to' parameters are specified, only the most recent data point is returned."
        }
      ]
    }
  ]
}