> ## Documentation Index
> Fetch the complete documentation index at: https://docs.m3ter.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Usage

## List UsageSavedQueries

**Function name:** `m3ter_ListUsageSavedQueries`
**Category:** READ
**HTTP method:** GET (paginated)
**Destination:** m3ter

Retrieve a list of UsageSavedQuery entities

### Parameters

| Name                       | Label            | Type                    | Required | Description                                | Constraints                                                           |
| -------------------------- | ---------------- | ----------------------- | :------: | ------------------------------------------ | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials      | M3terEntityParameter    |    Yes   | The m3ter credentials to use.              | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `statePath`                | State Path       | StateVariableParameter  |    No    | State variable to store the response.      | -                                                                     |
| `queryParams`              | Query Parameters | KeyValueLookupParameter |    No    | Query parameters to include in the request | allowedValues: ids,queryType                                          |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## Create UsageSavedQuery

**Function name:** `m3ter_CreateUsageSavedQuery`
**Category:** WRITE
**HTTP method:** POST
**Destination:** m3ter

Create a new UsageSavedQuery.

### Parameters

| Name                       | Label        | Type                   | Required | Description                            | Constraints                                                           |
| -------------------------- | ------------ | ---------------------- | :------: | -------------------------------------- | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials  | M3terEntityParameter   |    Yes   | The m3ter credentials to use.          | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `requestPath`              | Request Path | StateVariableParameter |    Yes   | State variable containing the request. | -                                                                     |
| `statePath`                | State Path   | StateVariableParameter |    No    | State variable to store the response.  | -                                                                     |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## Query and filter usage data

**Function name:** `m3ter_PostUsageDataQuery`
**Category:** READ
**HTTP method:** POST
**Destination:** m3ter

Query and filter usage data collected for your Organization.

You can use several parameters to filter the range of usage data returned:

* **Time period.** Use `startDate` and `endDate` to define a period. The query references the `timestamp` values of usage data submissions for applying the defined time period, and not the time submissions were `receivedAt` by the platform. Only usage data with a `timestamp` that falls in the defined time period are returned.(Required)
* **Meters.** Specify the Meters you want the query to return data for.
* **Accounts.** Specify the Accounts you want the query to return data for.
* **Dimension Filters.** Specify values for Dimension data fields on included Meters. Only data that match the specified Dimension field values will be returned for the query.

You can apply Aggregations functions to the usage data returned for the query. If you apply Aggregations, you can select to group the data by:

* **Account**
* **Time**
* **Dimension**

### Parameters

| Name                       | Label        | Type                   | Required | Description                            | Constraints                                                           |
| -------------------------- | ------------ | ---------------------- | :------: | -------------------------------------- | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials  | M3terEntityParameter   |    Yes   | The m3ter credentials to use.          | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `requestPath`              | Request Path | StateVariableParameter |    Yes   | State variable containing the request. | -                                                                     |
| `statePath`                | State Path   | StateVariableParameter |    No    | State variable to store the response.  | -                                                                     |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## Retrieve UsageSavedQuery

**Function name:** `m3ter_GetUsageSavedQuery`
**Category:** READ
**HTTP method:** GET
**Destination:** m3ter

Retrieve a UsageSavedQuery for the given UUID.

### Parameters

| Name                       | Label       | Type                   | Required | Description                                  | Constraints                                                           |
| -------------------------- | ----------- | ---------------------- | :------: | -------------------------------------------- | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials | M3terEntityParameter   |    Yes   | The m3ter credentials to use.                | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `id`                       | id          | LookupParameter        |    Yes   | The UUID of the UsageSavedQuery to retrieve. | -                                                                     |
| `statePath`                | State Path  | StateVariableParameter |    No    | State variable to store the response.        | -                                                                     |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## Update UsageSavedQuery

**Function name:** `m3ter_UpdateUsageSavedQuery`
**Category:** WRITE
**HTTP method:** PUT
**Destination:** m3ter

Update a UsageSavedQuery for the given UUID.

### Parameters

| Name                       | Label        | Type                   | Required | Description                                | Constraints                                                           |
| -------------------------- | ------------ | ---------------------- | :------: | ------------------------------------------ | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials  | M3terEntityParameter   |    Yes   | The m3ter credentials to use.              | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `id`                       | id           | LookupParameter        |    Yes   | The UUID of the UsageSavedQuery to update. | -                                                                     |
| `requestPath`              | Request Path | StateVariableParameter |    Yes   | State variable containing the request.     | -                                                                     |
| `statePath`                | State Path   | StateVariableParameter |    No    | State variable to store the response.      | -                                                                     |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## Delete UsageSavedQuery

**Function name:** `m3ter_DeleteUsageSavedQuery`
**Category:** WRITE
**HTTP method:** DELETE
**Destination:** m3ter

Delete the UsageSavedQuery for the given UUID.

### Parameters

| Name                       | Label       | Type                   | Required | Description                                | Constraints                                                           |
| -------------------------- | ----------- | ---------------------- | :------: | ------------------------------------------ | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials | M3terEntityParameter   |    Yes   | The m3ter credentials to use.              | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `id`                       | id          | LookupParameter        |    Yes   | The UUID of the UsageSavedQuery to update. | -                                                                     |
| `statePath`                | State Path  | StateVariableParameter |    No    | State variable to store the response.      | -                                                                     |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |
