Skip to main content
POST
/
organizations
/
{orgId}
/
usage
/
savedqueries
Create UsageSavedQuery
curl --request POST \
  --url https://api.m3ter.com/organizations/{orgId}/usage/savedqueries \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "usageQuery": {
    "startDate": "2023-11-07T05:31:56Z",
    "endDate": "2023-11-07T05:31:56Z",
    "meterIds": [
      "<string>"
    ],
    "accountIds": [
      "<string>"
    ],
    "dimensionFilters": [
      {
        "meterId": "<string>",
        "fieldCode": "<string>",
        "values": [
          "<string>"
        ]
      }
    ],
    "aggregations": [
      {
        "meterId": "<string>",
        "fieldCode": "<string>",
        "fieldType": "DIMENSION",
        "function": "SUM"
      }
    ],
    "groups": [
      {
        "groupType": "ACCOUNT"
      }
    ],
    "limit": 10000,
    "timePeriod": "TODAY"
  },
  "version": 123
}
'
{
  "id": "<string>",
  "version": 123,
  "name": "<string>",
  "usageQuery": {
    "startDate": "2023-11-07T05:31:56Z",
    "endDate": "2023-11-07T05:31:56Z",
    "meterIds": [
      "<string>"
    ],
    "accountIds": [
      "<string>"
    ],
    "dimensionFilters": [
      {
        "meterId": "<string>",
        "fieldCode": "<string>",
        "values": [
          "<string>"
        ]
      }
    ],
    "aggregations": [
      {
        "meterId": "<string>",
        "fieldCode": "<string>",
        "fieldType": "DIMENSION",
        "function": "SUM"
      }
    ],
    "groups": [
      {
        "groupType": "ACCOUNT"
      }
    ],
    "limit": 10000,
    "timePeriod": "TODAY"
  }
}

Authorizations

Authorization
string
header
required

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

The authorizationCode flow controls access for human users via the m3ter Console application.

Path Parameters

orgId
string
required

UUID of the organization

Body

application/json

Request representing a usage saved query

name
string
required

Name of the saved query

Minimum string length: 1
usageQuery
object
required
version
integer<int64>

The version number of the entity:

  • Create entity: Not valid for initial insertion of new entity - do not use for Create. On initial Create, version is set at 1 and listed in the response.
  • Update Entity: On Update, version is required and must match the existing version because a check is performed to ensure sequential versioning is preserved. Version is incremented by 1 and listed in the response.

Response

Return the created UsageSavedQuery

Request representing a usage saved query

id
string
required

The UUID of the entity.

version
integer<int64>

The version number:

  • Create: On initial Create to insert a new entity, the version is set at 1 in the response.
  • Update: On successful Update, the version is incremented by 1 in the response.
name
string

Name of the saved query

usageQuery
object