{"info":{"_postman_id":"b3d8836b-0cd0-40dd-b45c-1a882bbc3922","name":"Ingest API (legacy)","description":"<html><head></head><body><h2 id=\"authentication\">Authentication</h2>\n<p>The Ingest API uses JSON Web Tokens to authorize requests. The ClearTrace team will create a client application and data delivery grant, and the user will be able to obtain their client credentials and the refresh token related to the grant through the ClearTrace dashboard.<br>The user will exchange the refresh token for an access token (1 hour expiry) as described in the ClearTrace API documentation. Requests to the /v1/energy endpoint are expected to include this access token in the Authorization header of the POST requests.<br>[Refresh Token Exchange Documentation] (<a href=\"https://documenter.getpostman.com/view/4558673/Rztmr8WX#1a181511-a78f-4655-8b41-875f81ba9f22\">https://documenter.getpostman.com/view/4558673/Rztmr8WX#1a181511-a78f-4655-8b41-875f81ba9f22</a>)</p>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"owner":"4558673","collectionId":"b3d8836b-0cd0-40dd-b45c-1a882bbc3922","publishedId":"TVeiDWRY","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"publishDate":"2021-11-23T15:34:41.000Z"},"item":[{"name":"Health","item":[{"name":"health","id":"04cfdfde-e20a-4c93-a940-1b9d3b5daf42","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"GET","header":[],"url":"{{ingestApi.baseUrl}}/v1/health","urlObject":{"path":["v1","health"],"host":["{{ingestApi.baseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"04cfdfde-e20a-4c93-a940-1b9d3b5daf42"}],"id":"de6f81c5-3325-4c4d-b6d1-88b9dedc3df9","_postman_id":"de6f81c5-3325-4c4d-b6d1-88b9dedc3df9","description":"","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{ingestApi.accessToken}}"}]},"isInherited":true,"source":{"_postman_id":"b3d8836b-0cd0-40dd-b45c-1a882bbc3922","id":"b3d8836b-0cd0-40dd-b45c-1a882bbc3922","name":"Ingest API (legacy)","type":"collection"}}},{"name":"Energies","item":[{"name":"Post Energy","event":[{"listen":"prerequest","script":{"id":"6f4da85d-d737-4676-b442-1778ab96fd6b","exec":["pm.sendRequest({","    url: 'https://authapi-test.cleartrace.io/v1/auth/login',","    method: 'POST',","    header: {\"Content-Type\": \"application/json\"},","    body: { ","        username: 'tstark',","        password: 'EB33m59Z9wKFCF'","    },","    function (err, response) {  ","        console.log(response.json());  ","}}",");"],"type":"text/javascript","packages":{},"requests":{}}}],"id":"a378af71-c80c-4a5c-b528-4d8e2431cc5c","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n            \"source_id\": \"TAG.5e8765c8026b89216f6ad397\",\n            \"reading_type\": \"interval\",\n            \"timestamp\": \"2020-11-07T19:00:00+00:00\",\n            \"granularity\": 60,\n            \"data\": [\n                {\n                    \"value\": 161000,\n                    \"unit\": \"Wh\",\n                    \"energy_timestamp\": \"2020-11-07T18:00:00+00:00\"\n                }\n            ]\n        }\n        ","options":{"raw":{"language":"json"}}},"url":"{{ingestApi.baseUrl}}/v1/energy","description":"<h1 id=\"field-descriptions\">Field Descriptions</h1>\n<p>All timestamp fields expect an ISO8061 formatted string, with timezone offset.</p>\n<p><code>source_id</code> should be the <code>external_source_id</code> associated with the meter in the Cleartrace system. This is typically provided by the customer during onboarding.</p>\n<p>The top-level <code>timestamp</code> property is a metadata field that indicates when the associated readings were captured by the meter, device, or system. If no such timestamp exists, this may be set (by the client) to the time the request was sent.</p>\n<p>Accepted values for <code>reading_type</code> are <code>\"interval\", \"instantaneous\"</code>. When providing <em>energy</em> data, this should typically be <code>interval</code>. When providing <em>power</em>, this is typically intantaneous.</p>\n<p>When <code>interval</code> readings are provided, you must provide <code>granularity</code> with a value of <code>5, 10, 15, 20, 30, 60</code>, corresponding to the number of minutes in each interval (e.g. hourly data would be <code>60</code>.</p>\n<p>The <code>data</code> array contains the actual energy readings, with each reading passed as an object within.</p>\n<h1 id=\"data\">Data</h1>\n<p>The <code>energy_timestamp</code> indicates the start of the interval for which the associated energy value applies. It should be aligned with the provided <code>granularity</code> (e.g. <code>60</code> minute should have a timestamp on the hour, with no minutes or seconds).</p>\n<p><code>value</code> represents the actual energy reading.</p>\n<p>Accepted values for <code>unit</code> include <code>\"MW\", \"kW\", \"W\", \"MWh\", \"kWh\", \"Wh\"</code></p>\n","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{ingestApi.accessToken}}"}]},"isInherited":true,"source":{"_postman_id":"b3d8836b-0cd0-40dd-b45c-1a882bbc3922","id":"b3d8836b-0cd0-40dd-b45c-1a882bbc3922","name":"Ingest API (legacy)","type":"collection"}},"urlObject":{"path":["v1","energy"],"host":["{{ingestApi.baseUrl}}"],"query":[],"variable":[]}},"response":[{"id":"93cb836a-558b-49cc-95ec-98b4cf90649c","name":"Post Energy","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n\t\"source_id\":\"TAG.5e8765c8026b89216f6ad397\",\n\t\"reading_type\":\"interval\",\n    \"timestamp\":\"2020-11-07T19:00:00+00:00\", \n    \"granularity\": 60,\n\t\"data\":[{\n\t\t\t\"value\":161000.000,\n\t\t\t\"unit\":\"Wh\",\n\t\t\t\"energy_timestamp\":\"2020-11-07T18:00:00+00:00\"\n\t\t}]\n}\n","options":{"raw":{"language":"json"}}},"url":"https://ingest-staging.cleartrace.io/v1/energy"},"_postman_previewlanguage":null,"header":null,"cookie":[],"responseTime":null,"body":null}],"_postman_id":"a378af71-c80c-4a5c-b528-4d8e2431cc5c"},{"name":"Post Energy - Required field validation error","event":[{"listen":"prerequest","script":{"id":"7ac9db9f-3fba-4006-87f4-7e1d082a582e","exec":["function test(n = 0){","","    let count = n","    let d = []","    let b =  {","\t\"source_id\":\"TAG.5e8765c8026b89216f6ad397\",","\t\"reading_type\":\"interval\",","    \"timestamp\":\"2019-12-31T23:55:00\",","\t\"data\":[]","}","    for(let i =0;i < count;i++){","        b.data.push({","\t\t\t\"value\": Number(12.00 + i),","\t\t\t\"unit\":\"mw\",","\t\t\t\"energy_timestamp\":\"2019-12-31T23:55:00\"","\t\t})","    }","    console.log(b)","","    return b","}","let body = test(10)","pm.environment.set('req_body', JSON.stringify(body))","// pm.variables.set('body',)",""],"type":"text/javascript","packages":{},"requests":{}}}],"id":"e45a830d-7875-49e5-9a7c-af425eda2270","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{{req_body}} ","options":{"raw":{"language":"json"}}},"url":"{{ingestApi.baseUrl}}/v1/energy","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{ingestApi.accessToken}}"}]},"isInherited":true,"source":{"_postman_id":"b3d8836b-0cd0-40dd-b45c-1a882bbc3922","id":"b3d8836b-0cd0-40dd-b45c-1a882bbc3922","name":"Ingest API (legacy)","type":"collection"}},"urlObject":{"path":["v1","energy"],"host":["{{ingestApi.baseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"e45a830d-7875-49e5-9a7c-af425eda2270"},{"name":"Post Energy - Property type error","id":"4b10d3ba-55bd-4fdc-ac4f-c494b80ad1b7","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n\t\"source_id\":\"external meter id\",\n\t\"reading_type\":\"interval\",\n    \"timestamp\":\"2020-01-01T12:00:00\", \n\t\"data\":[{\n\t\t\t\"value\":\"12.00\",\n\t\t\t\"unit\":\"mw\",\n\t\t\t\"energy_timestamp\":\"2019-12-31T23:55:00\"\n\t\t}]\n}\n","options":{"raw":{"language":"json"}}},"url":"{{ingestApi.baseUrl}}/v1/energy","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{ingestApi.accessToken}}"}]},"isInherited":true,"source":{"_postman_id":"b3d8836b-0cd0-40dd-b45c-1a882bbc3922","id":"b3d8836b-0cd0-40dd-b45c-1a882bbc3922","name":"Ingest API (legacy)","type":"collection"}},"urlObject":{"path":["v1","energy"],"host":["{{ingestApi.baseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"4b10d3ba-55bd-4fdc-ac4f-c494b80ad1b7"}],"id":"9800215d-7ab2-4a90-95bb-a0ac5daf289a","_postman_id":"9800215d-7ab2-4a90-95bb-a0ac5daf289a","description":"","auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{ingestApi.accessToken}}"}]},"isInherited":true,"source":{"_postman_id":"b3d8836b-0cd0-40dd-b45c-1a882bbc3922","id":"b3d8836b-0cd0-40dd-b45c-1a882bbc3922","name":"Ingest API (legacy)","type":"collection"}}}],"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{ingestApi.accessToken}}"}]}},"event":[{"listen":"prerequest","script":{"id":"a3660cd6-47d0-4240-9057-2dd0c41caf10","type":"text/javascript","requests":{},"exec":[""]}},{"listen":"test","script":{"id":"1c0fa4b5-6452-46bc-a7b8-83478abf4a1a","type":"text/javascript","requests":{},"exec":[""]}}],"variable":[{"key":"ingest_url","value":"https://ingest.cleartrace.io"}]}