Submit Measurements - m3ter Documentation

Submit Measurements

cURL

curl --request POST \
  --url https://ingest.m3ter.com/organizations/{orgId}/measurements \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "measurements": [
    {
      "uid": "string",
      "meter": "string",
      "account": "Acme Corp",
      "ts": "2022-08-24T14:15:22Z",
      "ets": "2022-08-24T15:15:22Z",
      "who": {
        "property1": "string",
        "property2": "string"
      },
      "where": {
        "property1": "string",
        "property2": "string"
      },
      "what": {
        "property1": "string",
        "property2": "string"
      },
      "other": {
        "property1": "string",
        "property2": "string"
      },
      "metadata": {
        "property1": "string",
        "property2": "string"
      },
      "measure": {
        "property1": 0,
        "property2": 0
      },
      "cost": {
        "property1": 0,
        "property2": 0
      },
      "income": {
        "property1": 0,
        "property2": 0
      }
    }
  ]
}
' 

Python

import requests

url = "https://ingest.m3ter.com/organizations/{orgId}/measurements"

payload = { "measurements": [
        {
            "uid": "string",
            "meter": "string",
            "account": "Acme Corp",
            "ts": "2022-08-24T14:15:22Z",
            "ets": "2022-08-24T15:15:22Z",
            "who": {
                "property1": "string",
                "property2": "string"
            },
            "where": {
                "property1": "string",
                "property2": "string"
            },
            "what": {
                "property1": "string",
                "property2": "string"
            },
            "other": {
                "property1": "string",
                "property2": "string"
            },
            "metadata": {
                "property1": "string",
                "property2": "string"
            },
            "measure": {
                "property1": 0,
                "property2": 0
            },
            "cost": {
                "property1": 0,
                "property2": 0
            },
            "income": {
                "property1": 0,
                "property2": 0
            }
        }
    ] }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)

JavaScript (Fetch API)

const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    measurements: [
      {
        uid: 'string',
        meter: 'string',
        account: 'Acme Corp',
        ts: '2022-08-24T14:15:22Z',
        ets: '2022-08-24T15:15:22Z',
        who: {property1: 'string', property2: 'string'},
        where: {property1: 'string', property2: 'string'},
        what: {property1: 'string', property2: 'string'},
        other: {property1: 'string', property2: 'string'},
        metadata: {property1: 'string', property2: 'string'},
        measure: {property1: 0, property2: 0},
        cost: {property1: 0, property2: 0},
        income: {property1: 0, property2: 0}
      }
    ]
  })
};

fetch('https://ingest.m3ter.com/organizations/{orgId}/measurements', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));

Response

200

application/json

Returns the result of the submission

{
  "result": "accepted"
}

Authorizations

Authorization

string

header

required

m3ter supports machine to machine authentication using the clientCredentials OAuth2 flow.

Path Parameters

orgId

string

required

UUID of the organization. The Organization represents your company as a direct customer of the m3ter service.

Body

application/json

measurements

object[]

required

Request containing the usage data measurements for submission.

Required array length: 1 - 1000 elements

Response

200

application/json

Returns the result of the submission

{
  "result": "accepted"
}