# KlaviyoAPI::ReportingApi
All URIs are relative to *https://a.klaviyo.com*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |
| [**query_campaign_values**](ReportingApi.md#query_campaign_values) | **POST** /api/campaign-values-reports/ | Query Campaign Values |
| [**query_flow_series**](ReportingApi.md#query_flow_series) | **POST** /api/flow-series-reports/ | Query Flow Series |
| [**query_flow_values**](ReportingApi.md#query_flow_values) | **POST** /api/flow-values-reports/ | Query Flow Values |
## query_campaign_values
> Hash<String, Object> query_campaign_values(campaign_values_request_dto, opts)
Query Campaign Values
Returns the requested campaign analytics values data
*Rate limits*:
Burst: `1/s`
Steady: `2/m`
Daily: `225/d` **Scopes:** `campaigns:read`
### Examples
```ruby
require 'time'
require 'klaviyo-api-sdk'
# setup authorization
KlaviyoAPI.configure do |config|
# Configure API key authorization: Klaviyo-API-Key
config.api_key['Klaviyo-API-Key'] = 'YOUR API KEY'
# 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::ReportingApi.new
campaign_values_request_dto = KlaviyoAPI::CampaignValuesRequestDTO.new({data: KlaviyoAPI::CampaignValuesRequestDTOResourceObject.new({type: KlaviyoAPI::CampaignValuesReportEnum::CAMPAIGN_VALUES_REPORT, attributes: KlaviyoAPI::CampaignValuesRequestDTOResourceObjectAttributes.new({statistics: ["opens", "open_rate"], timeframe: KlaviyoAPI::CustomTimeframe.new({start: Time.parse('2022-11-08T00:00Z'), _end: Time.parse('2022-11-08T00:00Z')}), conversion_metric_id: 'RESQ6t'})})}) # CampaignValuesRequestDTO |
opts = {
page_cursor: 'page_cursor_example' # String | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#pagination
}
begin
# Query Campaign Values
result = api_instance.query_campaign_values(campaign_values_request_dto, opts)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ReportingApi->query_campaign_values: #{e}"
end
```
#### Using the query_campaign_values_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> query_campaign_values_with_http_info(campaign_values_request_dto, opts)
```ruby
begin
# Query Campaign Values
data, status_code, headers = api_instance.query_campaign_values_with_http_info(campaign_values_request_dto, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => Hash<String, Object>
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ReportingApi->query_campaign_values_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **campaign_values_request_dto** | [**CampaignValuesRequestDTO**](CampaignValuesRequestDTO.md) | | |
| **page_cursor** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#pagination | [optional] |
### Return type
**Hash<String, Object>**
### Authorization
[Klaviyo-API-Key](../README.md#Klaviyo-API-Key)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## query_flow_series
> Hash<String, Object> query_flow_series(flow_series_request_dto, opts)
Query Flow Series
Returns the requested flow analytics series data
*Rate limits*:
Burst: `1/s`
Steady: `2/m`
Daily: `225/d` **Scopes:** `flows:read`
### Examples
```ruby
require 'time'
require 'klaviyo-api-sdk'
# setup authorization
KlaviyoAPI.configure do |config|
# Configure API key authorization: Klaviyo-API-Key
config.api_key['Klaviyo-API-Key'] = 'YOUR API KEY'
# 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::ReportingApi.new
flow_series_request_dto = KlaviyoAPI::FlowSeriesRequestDTO.new({data: KlaviyoAPI::FlowSeriesRequestDTOResourceObject.new({type: KlaviyoAPI::FlowSeriesReportEnum::FLOW_SERIES_REPORT, attributes: KlaviyoAPI::FlowSeriesRequestDTOResourceObjectAttributes.new({statistics: ["opens", "open_rate"], timeframe: KlaviyoAPI::CustomTimeframe.new({start: Time.parse('2022-11-08T00:00Z'), _end: Time.parse('2022-11-08T00:00Z')}), interval: 'daily', conversion_metric_id: 'RESQ6t'})})}) # FlowSeriesRequestDTO |
opts = {
page_cursor: 'page_cursor_example' # String | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#pagination
}
begin
# Query Flow Series
result = api_instance.query_flow_series(flow_series_request_dto, opts)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ReportingApi->query_flow_series: #{e}"
end
```
#### Using the query_flow_series_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> query_flow_series_with_http_info(flow_series_request_dto, opts)
```ruby
begin
# Query Flow Series
data, status_code, headers = api_instance.query_flow_series_with_http_info(flow_series_request_dto, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => Hash<String, Object>
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ReportingApi->query_flow_series_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **flow_series_request_dto** | [**FlowSeriesRequestDTO**](FlowSeriesRequestDTO.md) | | |
| **page_cursor** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#pagination | [optional] |
### Return type
**Hash<String, Object>**
### Authorization
[Klaviyo-API-Key](../README.md#Klaviyo-API-Key)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## query_flow_values
> Hash<String, Object> query_flow_values(flow_values_request_dto, opts)
Query Flow Values
Returns the requested flow analytics values data
*Rate limits*:
Burst: `1/s`
Steady: `2/m`
Daily: `225/d` **Scopes:** `flows:read`
### Examples
```ruby
require 'time'
require 'klaviyo-api-sdk'
# setup authorization
KlaviyoAPI.configure do |config|
# Configure API key authorization: Klaviyo-API-Key
config.api_key['Klaviyo-API-Key'] = 'YOUR API KEY'
# 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::ReportingApi.new
flow_values_request_dto = KlaviyoAPI::FlowValuesRequestDTO.new({data: KlaviyoAPI::FlowValuesRequestDTOResourceObject.new({type: KlaviyoAPI::FlowValuesReportEnum::FLOW_VALUES_REPORT, attributes: KlaviyoAPI::FlowValuesRequestDTOResourceObjectAttributes.new({statistics: ["opens", "open_rate"], timeframe: KlaviyoAPI::CustomTimeframe.new({start: Time.parse('2022-11-08T00:00Z'), _end: Time.parse('2022-11-08T00:00Z')}), conversion_metric_id: 'RESQ6t'})})}) # FlowValuesRequestDTO |
opts = {
page_cursor: 'page_cursor_example' # String | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#pagination
}
begin
# Query Flow Values
result = api_instance.query_flow_values(flow_values_request_dto, opts)
p result
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ReportingApi->query_flow_values: #{e}"
end
```
#### Using the query_flow_values_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> query_flow_values_with_http_info(flow_values_request_dto, opts)
```ruby
begin
# Query Flow Values
data, status_code, headers = api_instance.query_flow_values_with_http_info(flow_values_request_dto, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => Hash<String, Object>
rescue KlaviyoAPI::ApiError => e
puts "Error when calling ReportingApi->query_flow_values_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **flow_values_request_dto** | [**FlowValuesRequestDTO**](FlowValuesRequestDTO.md) | | |
| **page_cursor** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#pagination | [optional] |
### Return type
**Hash<String, Object>**
### Authorization
[Klaviyo-API-Key](../README.md#Klaviyo-API-Key)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json