docs/EventsApi.md in klaviyo-api-sdk-6.0.0 vs docs/EventsApi.md in klaviyo-api-sdk-7.1.0
- old
+ new
@@ -2,26 +2,97 @@
All URIs are relative to *https://a.klaviyo.com*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |
+| [**bulk_create_events**](EventsApi.md#bulk_create_events) | **POST** /api/event-bulk-create-jobs/ | Bulk Create Events |
| [**create_event**](EventsApi.md#create_event) | **POST** /api/events/ | Create Event |
| [**get_event**](EventsApi.md#get_event) | **GET** /api/events/{id}/ | Get Event |
| [**get_event_metric**](EventsApi.md#get_event_metric) | **GET** /api/events/{id}/metric/ | Get Event Metric |
| [**get_event_profile**](EventsApi.md#get_event_profile) | **GET** /api/events/{id}/profile/ | Get Event Profile |
| [**get_event_relationships_metric**](EventsApi.md#get_event_relationships_metric) | **GET** /api/events/{id}/relationships/metric/ | Get Event Relationships Metric |
| [**get_event_relationships_profile**](EventsApi.md#get_event_relationships_profile) | **GET** /api/events/{id}/relationships/profile/ | Get Event Relationships Profile |
| [**get_events**](EventsApi.md#get_events) | **GET** /api/events/ | Get Events |
+## bulk_create_events
+
+> bulk_create_events(events_bulk_create_job)
+
+Bulk Create Events
+
+Create a batch of events for one or more profiles. Note that this endpoint allows you to create new profiles or update existing profile properties. At a minimum, profile and metric objects should include at least one profile identifier (e.g., `id`, `email`, or `phone_number`) and the metric `name`, respectively. Accepts up to 1,000 events per request. The maximum allowed payload size is 5MB.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `events:write`
+
+### 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::EventsApi.new
+events_bulk_create_job = KlaviyoAPI::EventsBulkCreateJob.new({data: KlaviyoAPI::EventsBulkCreateJobResourceObject.new({type: KlaviyoAPI::EventBulkCreateJobEnum::EVENT_BULK_CREATE_JOB, attributes: KlaviyoAPI::EventsBulkCreateJobResourceObjectAttributes.new({events_bulk_create: KlaviyoAPI::EventsBulkCreateJobResourceObjectAttributesEventsBulkCreate.new({data: [KlaviyoAPI::EventsBulkCreateQueryResourceObject.new({type: KlaviyoAPI::EventBulkCreateEnum::EVENT_BULK_CREATE, attributes: KlaviyoAPI::EventsBulkCreateQueryResourceObjectAttributes.new({profile: KlaviyoAPI::EventsBulkCreateQueryResourceObjectAttributesProfile.new({data: KlaviyoAPI::OnsiteProfileCreateQueryResourceObject.new({type: KlaviyoAPI::ProfileEnum::PROFILE, attributes: KlaviyoAPI::OnsiteProfileCreateQueryResourceObjectAttributes.new})}), events: KlaviyoAPI::EventsBulkCreateQueryResourceObjectAttributesEvents.new({data: [KlaviyoAPI::BaseEventCreateQueryResourceObject.new({type: KlaviyoAPI::EventEnum::EVENT, attributes: KlaviyoAPI::BaseEventCreateQueryResourceObjectAttributes.new({properties: {"Brand":"Kids Book","Categories":["Fiction","Children"],"ProductID":1111,"ProductName":"Winnie the Pooh","$extra":{"URL":"http://www.example.com/path/to/product","ImageURL":"http://www.example.com/path/to/product/image.png"}}, metric: KlaviyoAPI::EventCreateQueryV2ResourceObjectAttributesMetric.new({data: KlaviyoAPI::MetricCreateQueryResourceObject.new({type: KlaviyoAPI::MetricEnum::METRIC, attributes: KlaviyoAPI::MetricCreateQueryResourceObjectAttributes.new({name: 'Viewed Product'})})})})})]})})})]})})})}) # EventsBulkCreateJob |
+
+begin
+ # Bulk Create Events
+ api_instance.bulk_create_events(events_bulk_create_job)
+rescue KlaviyoAPI::ApiError => e
+ puts "Error when calling EventsApi->bulk_create_events: #{e}"
+end
+```
+
+#### Using the bulk_create_events_with_http_info variant
+
+This returns an Array which contains the response data (`nil` in this case), status code and headers.
+
+> <Array(nil, Integer, Hash)> bulk_create_events_with_http_info(events_bulk_create_job)
+
+```ruby
+begin
+ # Bulk Create Events
+ data, status_code, headers = api_instance.bulk_create_events_with_http_info(events_bulk_create_job)
+ p status_code # => 2xx
+ p headers # => { ... }
+ p data # => nil
+rescue KlaviyoAPI::ApiError => e
+ puts "Error when calling EventsApi->bulk_create_events_with_http_info: #{e}"
+end
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ---- | ---- | ----------- | ----- |
+| **events_bulk_create_job** | [**EventsBulkCreateJob**](EventsBulkCreateJob.md) | | |
+
+### Return type
+
+nil (empty response body)
+
+### Authorization
+
+[Klaviyo-API-Key](../README.md#Klaviyo-API-Key)
+
+### HTTP request headers
+
+- **Content-Type**: application/json
+- **Accept**: application/json
+
+
## create_event
> create_event(event_create_query_v2)
Create Event
-Create a new event to track a profile's activity. Successful response indicates that the event was validated and submitted for processing, but does not guarantee that processing is complete.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `events:write`
+Create a new event to track a profile's activity. Note that this endpoint allows you to create a new profile or update an existing profile's properties. At a minimum, profile and metric objects should include at least one profile identifier (e.g., `id`, `email`, or `phone_number`) and the metric `name`, respectively. Successful response indicates that the event was validated and submitted for processing, but does not guarantee that processing is complete.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `events:write`
### Examples
```ruby
require 'time'
@@ -33,11 +104,11 @@
# 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::EventsApi.new
-event_create_query_v2 = KlaviyoAPI::EventCreateQueryV2.new({data: KlaviyoAPI::EventCreateQueryV2ResourceObject.new({type: KlaviyoAPI::EventEnum::EVENT, attributes: KlaviyoAPI::EventCreateQueryV2ResourceObjectAttributes.new({properties: {"Brand":"Kids Book","Categories":["Fiction","Children"],"ProductID":1111,"ProductName":"Winnie the Pooh","$extra":{"URL":"http://www.example.com/path/to/product","ImageURL":"http://www.example.com/path/to/product/image.png"}}, metric: KlaviyoAPI::EventCreateQueryV2ResourceObjectAttributesMetric.new({data: KlaviyoAPI::MetricCreateQueryResourceObject.new({type: KlaviyoAPI::MetricEnum::METRIC, attributes: KlaviyoAPI::MetricCreateQueryResourceObjectAttributes.new({name: 'Viewed Product'})})}), profile: KlaviyoAPI::EventCreateQueryV2ResourceObjectAttributesProfile.new({data: KlaviyoAPI::OnsiteProfileCreateQueryResourceObject.new({type: KlaviyoAPI::ProfileEnum::PROFILE, attributes: KlaviyoAPI::OnsiteProfileCreateQueryResourceObjectAttributes.new})})})})}) # EventCreateQueryV2 |
+event_create_query_v2 = KlaviyoAPI::EventCreateQueryV2.new({data: KlaviyoAPI::EventCreateQueryV2ResourceObject.new({type: KlaviyoAPI::EventEnum::EVENT, attributes: KlaviyoAPI::EventCreateQueryV2ResourceObjectAttributes.new({properties: {"Brand":"Kids Book","Categories":["Fiction","Children"],"ProductID":1111,"ProductName":"Winnie the Pooh","$extra":{"URL":"http://www.example.com/path/to/product","ImageURL":"http://www.example.com/path/to/product/image.png"}}, metric: KlaviyoAPI::EventCreateQueryV2ResourceObjectAttributesMetric.new({data: KlaviyoAPI::MetricCreateQueryResourceObject.new({type: KlaviyoAPI::MetricEnum::METRIC, attributes: KlaviyoAPI::MetricCreateQueryResourceObjectAttributes.new({name: 'Viewed Product'})})}), profile: KlaviyoAPI::EventCreateQueryV2ResourceObjectAttributesProfile.new({data: KlaviyoAPI::EventProfileCreateQueryResourceObject.new({type: KlaviyoAPI::ProfileEnum::PROFILE, attributes: KlaviyoAPI::EventProfileCreateQueryResourceObjectAttributes.new})})})})}) # EventCreateQueryV2 |
begin
# Create Event
api_instance.create_event(event_create_query_v2)
rescue KlaviyoAPI::ApiError => e
@@ -105,14 +176,14 @@
end
api_instance = KlaviyoAPI::EventsApi.new
id = 'id_example' # String | ID of the event
opts = {
- fields_event: ['timestamp'], # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets
- fields_metric: ['name'], # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets
- fields_profile: ['email'], # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets
- include: ['attributions'] # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#relationships
+ fields_event: ['timestamp'], # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets
+ fields_metric: ['name'], # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets
+ fields_profile: ['email'], # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets
+ include: ['attributions'] # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#relationships
}
begin
# Get Event
result = api_instance.get_event(id, opts)
@@ -143,14 +214,14 @@
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **id** | **String** | ID of the event | |
-| **fields_event** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets | [optional] |
-| **fields_metric** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets | [optional] |
-| **fields_profile** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets | [optional] |
-| **include** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#relationships | [optional] |
+| **fields_event** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets | [optional] |
+| **fields_metric** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets | [optional] |
+| **fields_profile** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets | [optional] |
+| **include** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#relationships | [optional] |
### Return type
**Hash<String, Object>**
@@ -186,11 +257,11 @@
end
api_instance = KlaviyoAPI::EventsApi.new
id = 'id_example' # String |
opts = {
- fields_metric: ['name'] # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets
+ fields_metric: ['name'] # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets
}
begin
# Get Event Metric
result = api_instance.get_event_metric(id, opts)
@@ -221,11 +292,11 @@
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **id** | **String** | | |
-| **fields_metric** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets | [optional] |
+| **fields_metric** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets | [optional] |
### Return type
**Hash<String, Object>**
@@ -262,11 +333,11 @@
api_instance = KlaviyoAPI::EventsApi.new
id = 'id_example' # String |
opts = {
additional_fields_profile: ['subscriptions'], # Array<String> | Request additional fields not included by default in the response. Supported values: 'subscriptions', 'predictive_analytics'
- fields_profile: ['email'] # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets
+ fields_profile: ['email'] # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets
}
begin
# Get Event Profile
result = api_instance.get_event_profile(id, opts)
@@ -298,11 +369,11 @@
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **id** | **String** | | |
| **additional_fields_profile** | [**Array<String>**](String.md) | Request additional fields not included by default in the response. Supported values: 'subscriptions', 'predictive_analytics' | [optional] |
-| **fields_profile** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets | [optional] |
+| **fields_profile** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets | [optional] |
### Return type
**Hash<String, Object>**
@@ -479,17 +550,17 @@
# config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer'
end
api_instance = KlaviyoAPI::EventsApi.new
opts = {
- fields_event: ['timestamp'], # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets
- fields_metric: ['name'], # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets
- fields_profile: ['email'], # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets
- filter: 'filter_example', # String | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`metric_id`: `equals`<br>`profile_id`: `equals`<br>`profile`: `has`<br>`datetime`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than`<br>`timestamp`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than`
- include: ['attributions'], # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#relationships
- page_cursor: 'page_cursor_example', # String | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#pagination
- sort: 'datetime' # String | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sorting
+ fields_event: ['timestamp'], # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets
+ fields_metric: ['name'], # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets
+ fields_profile: ['email'], # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets
+ filter: 'filter_example', # String | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`metric_id`: `equals`<br>`profile_id`: `equals`<br>`profile`: `has`<br>`datetime`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than`<br>`timestamp`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than`
+ include: ['attributions'], # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#relationships
+ page_cursor: 'page_cursor_example', # String | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#pagination
+ sort: 'datetime' # String | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sorting
}
begin
# Get Events
result = api_instance.get_events(opts)
@@ -519,16 +590,16 @@
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
-| **fields_event** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets | [optional] |
-| **fields_metric** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets | [optional] |
-| **fields_profile** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets | [optional] |
-| **filter** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`metric_id`: `equals`<br>`profile_id`: `equals`<br>`profile`: `has`<br>`datetime`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than`<br>`timestamp`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than` | [optional] |
-| **include** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#relationships | [optional] |
-| **page_cursor** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#pagination | [optional] |
-| **sort** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sorting | [optional] |
+| **fields_event** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets | [optional] |
+| **fields_metric** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets | [optional] |
+| **fields_profile** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets | [optional] |
+| **filter** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`metric_id`: `equals`<br>`profile_id`: `equals`<br>`profile`: `has`<br>`datetime`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than`<br>`timestamp`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than` | [optional] |
+| **include** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#relationships | [optional] |
+| **page_cursor** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#pagination | [optional] |
+| **sort** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sorting | [optional] |
### Return type
**Hash<String, Object>**