Class: KlaviyoAPI::ReportingApi

Inherits:
Object
  • Object
show all
Defined in:
lib/klaviyo-api-sdk/api/reporting_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ReportingApi

Returns a new instance of ReportingApi.



19
20
21
# File 'lib/klaviyo-api-sdk/api/reporting_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/klaviyo-api-sdk/api/reporting_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#query_campaign_values(campaign_values_request_dto, opts = {}) ⇒ Hash<String, Object> Also known as: create_campaign_value_report, create_campaign_values_report

Query Campaign Values Returns the requested campaign analytics values data
*Rate limits*:
Burst: ‘1/s`
Steady: `2/m`
Daily: `225/d` Scopes: `campaigns:read`

Parameters:

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


28
29
30
31
# File 'lib/klaviyo-api-sdk/api/reporting_api.rb', line 28

def query_campaign_values(campaign_values_request_dto, opts = {})
  data, _status_code, _headers = query_campaign_values_with_http_info(campaign_values_request_dto, opts)
  data
end

#query_campaign_values_with_http_info(campaign_values_request_dto, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: create_campaign_value_report_with_http_info, create_campaign_values_report_with_http_info

Query Campaign Values Returns the requested campaign analytics values data&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;1/s&#x60;&lt;br&gt;Steady: &#x60;2/m&#x60;&lt;br&gt;Daily: &#x60;225/d&#x60; Scopes: &#x60;campaigns:read&#x60;

Parameters:

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/klaviyo-api-sdk/api/reporting_api.rb', line 45

def query_campaign_values_with_http_info(campaign_values_request_dto, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ReportingApi.query_campaign_values ...'
  end
  # verify the required parameter 'campaign_values_request_dto' is set
  if @api_client.config.client_side_validation && campaign_values_request_dto.nil?
    fail ArgumentError, "Missing the required parameter 'campaign_values_request_dto' when calling ReportingApi.query_campaign_values"
  end
  # resource path
  local_var_path = '/api/campaign-values-reports'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page_cursor'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(campaign_values_request_dto)

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ReportingApi.query_campaign_values",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ReportingApi#query_campaign_values\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#query_flow_series(flow_series_request_dto, opts = {}) ⇒ Hash<String, Object> Also known as: create_flow_sery_report, create_flow_series_report

Query Flow Series Returns the requested flow analytics series data
*Rate limits*:
Burst: ‘1/s`
Steady: `2/m`
Daily: `225/d` Scopes: `flows:read`

Parameters:

  • flow_series_request_dto (FlowSeriesRequestDTO)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


113
114
115
116
# File 'lib/klaviyo-api-sdk/api/reporting_api.rb', line 113

def query_flow_series(flow_series_request_dto, opts = {})
  data, _status_code, _headers = query_flow_series_with_http_info(flow_series_request_dto, opts)
  data
end

#query_flow_series_with_http_info(flow_series_request_dto, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: create_flow_sery_report_with_http_info, create_flow_series_report_with_http_info

Query Flow Series Returns the requested flow analytics series data&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;1/s&#x60;&lt;br&gt;Steady: &#x60;2/m&#x60;&lt;br&gt;Daily: &#x60;225/d&#x60; Scopes: &#x60;flows:read&#x60;

Parameters:

  • flow_series_request_dto (FlowSeriesRequestDTO)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/klaviyo-api-sdk/api/reporting_api.rb', line 130

def query_flow_series_with_http_info(flow_series_request_dto, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ReportingApi.query_flow_series ...'
  end
  # verify the required parameter 'flow_series_request_dto' is set
  if @api_client.config.client_side_validation && flow_series_request_dto.nil?
    fail ArgumentError, "Missing the required parameter 'flow_series_request_dto' when calling ReportingApi.query_flow_series"
  end
  # resource path
  local_var_path = '/api/flow-series-reports'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page_cursor'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(flow_series_request_dto)

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ReportingApi.query_flow_series",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ReportingApi#query_flow_series\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#query_flow_values(flow_values_request_dto, opts = {}) ⇒ Hash<String, Object> Also known as: create_flow_value_report, create_flow_values_report

Query Flow Values Returns the requested flow analytics values data
*Rate limits*:
Burst: ‘1/s`
Steady: `2/m`
Daily: `225/d` Scopes: `flows:read`

Parameters:

  • flow_values_request_dto (FlowValuesRequestDTO)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


198
199
200
201
# File 'lib/klaviyo-api-sdk/api/reporting_api.rb', line 198

def query_flow_values(flow_values_request_dto, opts = {})
  data, _status_code, _headers = query_flow_values_with_http_info(flow_values_request_dto, opts)
  data
end

#query_flow_values_with_http_info(flow_values_request_dto, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: create_flow_value_report_with_http_info, create_flow_values_report_with_http_info

Query Flow Values Returns the requested flow analytics values data&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;1/s&#x60;&lt;br&gt;Steady: &#x60;2/m&#x60;&lt;br&gt;Daily: &#x60;225/d&#x60; Scopes: &#x60;flows:read&#x60;

Parameters:

  • flow_values_request_dto (FlowValuesRequestDTO)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# File 'lib/klaviyo-api-sdk/api/reporting_api.rb', line 215

def query_flow_values_with_http_info(flow_values_request_dto, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ReportingApi.query_flow_values ...'
  end
  # verify the required parameter 'flow_values_request_dto' is set
  if @api_client.config.client_side_validation && flow_values_request_dto.nil?
    fail ArgumentError, "Missing the required parameter 'flow_values_request_dto' when calling ReportingApi.query_flow_values"
  end
  # resource path
  local_var_path = '/api/flow-values-reports'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page_cursor'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(flow_values_request_dto)

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ReportingApi.query_flow_values",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ReportingApi#query_flow_values\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#query_form_series(form_series_request_dto, opts = {}) ⇒ Hash<String, Object> Also known as: create_form_sery_report, create_form_series_report

Query Form Series Returns the requested form analytics series data.
*Rate limits*:
Burst: ‘1/s`
Steady: `2/m`
Daily: `225/d` Scopes: `forms:read`

Parameters:

  • form_series_request_dto (FormSeriesRequestDTO)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Hash<String, Object>)


282
283
284
285
# File 'lib/klaviyo-api-sdk/api/reporting_api.rb', line 282

def query_form_series(form_series_request_dto, opts = {})
  data, _status_code, _headers = query_form_series_with_http_info(form_series_request_dto, opts)
  data
end

#query_form_series_with_http_info(form_series_request_dto, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: create_form_sery_report_with_http_info, create_form_series_report_with_http_info

Query Form Series Returns the requested form analytics series data.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;1/s&#x60;&lt;br&gt;Steady: &#x60;2/m&#x60;&lt;br&gt;Daily: &#x60;225/d&#x60; Scopes: &#x60;forms:read&#x60;

Parameters:

  • form_series_request_dto (FormSeriesRequestDTO)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
# File 'lib/klaviyo-api-sdk/api/reporting_api.rb', line 298

def query_form_series_with_http_info(form_series_request_dto, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ReportingApi.query_form_series ...'
  end
  # verify the required parameter 'form_series_request_dto' is set
  if @api_client.config.client_side_validation && form_series_request_dto.nil?
    fail ArgumentError, "Missing the required parameter 'form_series_request_dto' when calling ReportingApi.query_form_series"
  end
  # resource path
  local_var_path = '/api/form-series-reports'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(form_series_request_dto)

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ReportingApi.query_form_series",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ReportingApi#query_form_series\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#query_form_values(form_values_request_dto, opts = {}) ⇒ Hash<String, Object> Also known as: create_form_value_report, create_form_values_report

Query Form Values Returns the requested form analytics values data.
*Rate limits*:
Burst: ‘1/s`
Steady: `2/m`
Daily: `225/d` Scopes: `forms:read`

Parameters:

  • form_values_request_dto (FormValuesRequestDTO)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Hash<String, Object>)


364
365
366
367
# File 'lib/klaviyo-api-sdk/api/reporting_api.rb', line 364

def query_form_values(form_values_request_dto, opts = {})
  data, _status_code, _headers = query_form_values_with_http_info(form_values_request_dto, opts)
  data
end

#query_form_values_with_http_info(form_values_request_dto, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: create_form_value_report_with_http_info, create_form_values_report_with_http_info

Query Form Values Returns the requested form analytics values data.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;1/s&#x60;&lt;br&gt;Steady: &#x60;2/m&#x60;&lt;br&gt;Daily: &#x60;225/d&#x60; Scopes: &#x60;forms:read&#x60;

Parameters:

  • form_values_request_dto (FormValuesRequestDTO)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
# File 'lib/klaviyo-api-sdk/api/reporting_api.rb', line 380

def query_form_values_with_http_info(form_values_request_dto, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ReportingApi.query_form_values ...'
  end
  # verify the required parameter 'form_values_request_dto' is set
  if @api_client.config.client_side_validation && form_values_request_dto.nil?
    fail ArgumentError, "Missing the required parameter 'form_values_request_dto' when calling ReportingApi.query_form_values"
  end
  # resource path
  local_var_path = '/api/form-values-reports'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(form_values_request_dto)

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ReportingApi.query_form_values",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ReportingApi#query_form_values\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#query_segment_series(segment_series_request_dto, opts = {}) ⇒ Hash<String, Object> Also known as: create_segment_sery_report, create_segment_series_report

Query Segment Series Returns the requested segment analytics series data.
*Rate limits*:
Burst: ‘1/s`
Steady: `2/m`
Daily: `225/d` Scopes: `segments:read`

Parameters:

Returns:

  • (Hash<String, Object>)


446
447
448
449
# File 'lib/klaviyo-api-sdk/api/reporting_api.rb', line 446

def query_segment_series(segment_series_request_dto, opts = {})
  data, _status_code, _headers = query_segment_series_with_http_info(segment_series_request_dto, opts)
  data
end

#query_segment_series_with_http_info(segment_series_request_dto, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: create_segment_sery_report_with_http_info, create_segment_series_report_with_http_info

Query Segment Series Returns the requested segment analytics series data.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;1/s&#x60;&lt;br&gt;Steady: &#x60;2/m&#x60;&lt;br&gt;Daily: &#x60;225/d&#x60; Scopes: &#x60;segments:read&#x60;

Parameters:

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
# File 'lib/klaviyo-api-sdk/api/reporting_api.rb', line 462

def query_segment_series_with_http_info(segment_series_request_dto, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ReportingApi.query_segment_series ...'
  end
  # verify the required parameter 'segment_series_request_dto' is set
  if @api_client.config.client_side_validation && segment_series_request_dto.nil?
    fail ArgumentError, "Missing the required parameter 'segment_series_request_dto' when calling ReportingApi.query_segment_series"
  end
  # resource path
  local_var_path = '/api/segment-series-reports'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(segment_series_request_dto)

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ReportingApi.query_segment_series",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ReportingApi#query_segment_series\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#query_segment_values(segment_values_request_dto, opts = {}) ⇒ Hash<String, Object> Also known as: create_segment_value_report, create_segment_values_report

Query Segment Values Returns the requested segment analytics values data.
*Rate limits*:
Burst: ‘1/s`
Steady: `2/m`
Daily: `225/d` Scopes: `segments:read`

Parameters:

Returns:

  • (Hash<String, Object>)


528
529
530
531
# File 'lib/klaviyo-api-sdk/api/reporting_api.rb', line 528

def query_segment_values(segment_values_request_dto, opts = {})
  data, _status_code, _headers = query_segment_values_with_http_info(segment_values_request_dto, opts)
  data
end

#query_segment_values_with_http_info(segment_values_request_dto, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: create_segment_value_report_with_http_info, create_segment_values_report_with_http_info

Query Segment Values Returns the requested segment analytics values data.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;1/s&#x60;&lt;br&gt;Steady: &#x60;2/m&#x60;&lt;br&gt;Daily: &#x60;225/d&#x60; Scopes: &#x60;segments:read&#x60;

Parameters:

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
# File 'lib/klaviyo-api-sdk/api/reporting_api.rb', line 544

def query_segment_values_with_http_info(segment_values_request_dto, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ReportingApi.query_segment_values ...'
  end
  # verify the required parameter 'segment_values_request_dto' is set
  if @api_client.config.client_side_validation && segment_values_request_dto.nil?
    fail ArgumentError, "Missing the required parameter 'segment_values_request_dto' when calling ReportingApi.query_segment_values"
  end
  # resource path
  local_var_path = '/api/segment-values-reports'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-04-15"
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(segment_values_request_dto)

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']

  new_options = opts.merge(
    :operation => :"ReportingApi.query_segment_values",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ReportingApi#query_segment_values\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end