docs/MetricsApi.md in klaviyo-api-sdk-1.0.1 vs docs/MetricsApi.md in klaviyo-api-sdk-1.1.0

- old
+ new

@@ -13,11 +13,11 @@ > Hash&lt;String, Object&gt; get_metric(id, opts) Get Metric -Get a metric with the given metric ID. Request specific fields using [sparse fieldsets](https://developers.klaviyo.com/en/v2022-10-17/reference/api_overview#sparse-fieldsets)<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `Metrics Read` +Get a metric with the given metric ID.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `Metrics Read` ### Examples ```ruby require 'time' @@ -29,13 +29,13 @@ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) # config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer' end api_instance = KlaviyoAPI::MetricsApi.new -id = 'id_example' # String | +id = 'id_example' # String | Metric ID opts = { - fields_metric: ['name'] # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2022-10-17/reference/api-overview#sparse-fieldsets + fields_metric: ['name'] # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2023-01-24/reference/api-overview#sparse-fieldsets } begin # Get Metric result = api_instance.get_metric(id, opts) @@ -65,12 +65,12 @@ ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | | | -| **fields_metric** | [**Array&lt;String&gt;**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2022-10-17/reference/api-overview#sparse-fieldsets | [optional] | +| **id** | **String** | Metric ID | | +| **fields_metric** | [**Array&lt;String&gt;**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2023-01-24/reference/api-overview#sparse-fieldsets | [optional] | ### Return type **Hash&lt;String, Object&gt;** @@ -88,11 +88,11 @@ > Hash&lt;String, Object&gt; get_metrics(opts) Get Metrics -Get all metrics in an account. Requests can be filtered by the following fields: integration `name`, integration `category` Request specific fields using [sparse fieldsets](https://developers.klaviyo.com/en/v2022-10-17/reference/api_overview#sparse-fieldsets). Returns a maximum of 200 results per page, which can be paginated with [cursor-based pagination](https://developers.klaviyo.com/en/v2022-10-17/reference/api_overview#pagination)<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `Metrics Read` +Get all metrics in an account. Requests can be filtered by the following fields: integration `name`, integration `category` Returns a maximum of 200 results per page.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `Metrics Read` ### Examples ```ruby require 'time' @@ -105,13 +105,13 @@ # config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer' end api_instance = KlaviyoAPI::MetricsApi.new opts = { - fields_metric: ['name'], # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2022-10-17/reference/api-overview#sparse-fieldsets - filter: 'filter_example', # String | For more information please visit https://developers.klaviyo.com/en/v2022-10-17/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`integration.name`: `equals`<br>`integration.category`: `equals` - page_cursor: 'page_cursor_example' # String | For more information please visit https://developers.klaviyo.com/en/v2022-10-17/reference/api-overview#pagination + fields_metric: ['name'], # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2023-01-24/reference/api-overview#sparse-fieldsets + filter: 'filter_example', # String | For more information please visit https://developers.klaviyo.com/en/v2023-01-24/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`integration.name`: `equals`<br>`integration.category`: `equals` + page_cursor: 'page_cursor_example' # String | For more information please visit https://developers.klaviyo.com/en/v2023-01-24/reference/api-overview#pagination } begin # Get Metrics result = api_instance.get_metrics(opts) @@ -141,13 +141,13 @@ ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **fields_metric** | [**Array&lt;String&gt;**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2022-10-17/reference/api-overview#sparse-fieldsets | [optional] | -| **filter** | **String** | For more information please visit https://developers.klaviyo.com/en/v2022-10-17/reference/api-overview#filtering&lt;br&gt;Allowed field(s)/operator(s):&lt;br&gt;&#x60;integration.name&#x60;: &#x60;equals&#x60;&lt;br&gt;&#x60;integration.category&#x60;: &#x60;equals&#x60; | [optional] | -| **page_cursor** | **String** | For more information please visit https://developers.klaviyo.com/en/v2022-10-17/reference/api-overview#pagination | [optional] | +| **fields_metric** | [**Array&lt;String&gt;**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2023-01-24/reference/api-overview#sparse-fieldsets | [optional] | +| **filter** | **String** | For more information please visit https://developers.klaviyo.com/en/v2023-01-24/reference/api-overview#filtering&lt;br&gt;Allowed field(s)/operator(s):&lt;br&gt;&#x60;integration.name&#x60;: &#x60;equals&#x60;&lt;br&gt;&#x60;integration.category&#x60;: &#x60;equals&#x60; | [optional] | +| **page_cursor** | **String** | For more information please visit https://developers.klaviyo.com/en/v2023-01-24/reference/api-overview#pagination | [optional] | ### Return type **Hash&lt;String, Object&gt;** @@ -165,11 +165,11 @@ > Hash&lt;String, Object&gt; query_metric_aggregates(metric_aggregate_query) Query Metric Aggregates -Query and aggregate event data associated with a metric, including native Klaviyo metrics, integration-specific metrics, and custom events. Queries must be passed in the JSON body of your `POST` request. Results can be filtered and grouped by time, event, or profile dimensions. **Request body parameters** (nested under `attributes`): * `return_fields`: request specific fields using [sparse fieldsets](https://developers.klaviyo.com/en/v2022-10-17/reference/api_overview#sparse-fieldsets) * `sort`: sort results by a specified field, such as `\"-timestamp\"` * `page_cursor`: results can be paginated with [cursor-based pagination](https://developers.klaviyo.com/en/v2022-10-17/reference/api_overview#pagination) * `page_size`: limit the number of returned results per page * `by`: optional attributes used to group by the aggregation function * When using `by` attributes, an empty `dimensions` response is expected when the counts for the events do not have the associated dimension requested by the set `by` attribute. For example, a query including `\"by\": [\"$flow\"]` will return an empty dimensions response for counts of metrics not associated with a `$flow` * `measurement`: the measurement key supports the following values: * `\"sum_value\"`: perform a summation of the `_Event Value_`, optionally partitioned over any dimension provided in the `by` field * `\"count\"`: counts the number of events associated to a metric, optionally partitioned over any dimension provided in the `by` field * `\"unique\"` counts the number of unique customers associated to a metric, optionally partitioned over any dimension provided in the `by` field * `interval`: aggregation interval, such as `\"hour\"`,`\"day\"`,`\"week\"`, and `\"month\"` * `metric_id`: the metric ID used in the aggregation * `filter`: list of filters for specific fields, must include time range using ISO 8601 format (`\"YYYY-MM-DDTHH:MM:SS.mmmmmm\"`) * The time range can be filtered by providing a `greater_or_equal` filter on the datetime field, such as `\"greater-or-equal(datetime,2021-07-01T00:00:00)\"` and a `less-than` filter on the same datetime field, such as `\"less-than(datetime,2022-07-01T00:00:00)\"` * The time range may span a maximum of one year. Time range dates may be set to a maximum of 5 years prior to the current date * Filter the list of supported aggregate dimensions using the common filter syntax, such as `\"equals(URL,\\\"https://www.klaviyo.com/\\\")\"` * `timezone`: the timezone used when processing the query. Case sensitive. This field is validated against a list of common timezones from the [IANA Time Zone Database](https://www.iana.org/time-zones) For a comprehensive list of native Klaviyo metrics and their associated attributes for grouping and filtering, please refer to the [metrics attributes guide](https://developers.klaviyo.com/en/v2022-10-17/docs/supported_metrics_and_attributes).<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `Metrics Read` +Query and aggregate event data associated with a metric, including native Klaviyo metrics, integration-specific metrics, and custom events. Queries must be passed in the JSON body of your `POST` request. Results can be filtered and grouped by time, event, or profile dimensions. **Request body parameters** (nested under `attributes`): * `return_fields`: request specific fields using [sparse fieldsets](https://developers.klaviyo.com/en/reference/api_overview#sparse-fieldsets) * `sort`: sort results by a specified field, such as `\"-timestamp\"` * `page_cursor`: results can be paginated with [cursor-based pagination](https://developers.klaviyo.com/en/reference/api_overview#pagination) * `page_size`: limit the number of returned results per page * `by`: optional attributes used to group by the aggregation function * When using `by` attributes, an empty `dimensions` response is expected when the counts for the events do not have the associated dimension requested by the set `by` attribute. For example, a query including `\"by\": [\"$flow\"]` will return an empty dimensions response for counts of metrics not associated with a `$flow` * `measurement`: the measurement key supports the following values: * `\"sum_value\"`: perform a summation of the `_Event Value_`, optionally partitioned over any dimension provided in the `by` field * `\"count\"`: counts the number of events associated to a metric, optionally partitioned over any dimension provided in the `by` field * `\"unique\"` counts the number of unique customers associated to a metric, optionally partitioned over any dimension provided in the `by` field * `interval`: aggregation interval, such as `\"hour\"`,`\"day\"`,`\"week\"`, and `\"month\"` * `metric_id`: the metric ID used in the aggregation * `filter`: list of filters for specific fields, must include time range using ISO 8601 format (`\"YYYY-MM-DDTHH:MM:SS.mmmmmm\"`) * The time range can be filtered by providing a `greater_or_equal` filter on the datetime field, such as `\"greater-or-equal(datetime,2021-07-01T00:00:00)\"` and a `less-than` filter on the same datetime field, such as `\"less-than(datetime,2022-07-01T00:00:00)\"` * The time range may span a maximum of one year. Time range dates may be set to a maximum of 5 years prior to the current date * Filter the list of supported aggregate dimensions using the common filter syntax, such as `\"equals(URL,\\\"https://www.klaviyo.com/\\\")\"` * `timezone`: the timezone used when processing the query. Case sensitive. This field is validated against a list of common timezones from the [IANA Time Zone Database](https://www.iana.org/time-zones) For a comprehensive list of native Klaviyo metrics and their associated attributes for grouping and filtering, please refer to the [metrics attributes guide](https://developers.klaviyo.com/en/docs/supported_metrics_and_attributes).<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `Metrics Read` ### Examples ```ruby require 'time' @@ -181,10 +181,10 @@ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) # config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer' end api_instance = KlaviyoAPI::MetricsApi.new -metric_aggregate_query = KlaviyoAPI::MetricAggregateQuery.new({data: KlaviyoAPI::MetricAggregateQueryAsSubResource.new({type: 'metric-aggregate', attributes: KlaviyoAPI::MetricAggregateQueryAsSubResourceAttributes.new({metric_id: 'metric_id_example', measurements: ['count'], interval: 'day', filter: ['filter_example'], timezone: 'timezone_example'})})}) # MetricAggregateQuery | Retrieve Metric Aggregations +metric_aggregate_query = KlaviyoAPI::MetricAggregateQuery.new({data: KlaviyoAPI::MetricAggregateQueryAsSubResource.new({type: 'metric-aggregate', attributes: KlaviyoAPI::MetricAggregateQueryAsSubResourceAttributes.new({metric_id: '0rG4eQ', measurements: count, interval: 'day', filter: ["greater-or-equal(datetime, 2022-12-01T00: 00: 00)", "less-than(datetime, 2022-12-08T00: 00: 00"]})})}) # MetricAggregateQuery | Retrieve Metric Aggregations begin # Query Metric Aggregates result = api_instance.query_metric_aggregates(metric_aggregate_query) p result