docs/SegmentsApi.md in klaviyo-api-sdk-6.0.0 vs docs/SegmentsApi.md in klaviyo-api-sdk-7.1.0
- old
+ new
@@ -2,26 +2,169 @@
All URIs are relative to *https://a.klaviyo.com*
| Method | HTTP request | Description |
| ------ | ------------ | ----------- |
+| [**create_segment**](SegmentsApi.md#create_segment) | **POST** /api/segments/ | Create Segment |
+| [**delete_segment**](SegmentsApi.md#delete_segment) | **DELETE** /api/segments/{id}/ | Delete Segment |
| [**get_segment**](SegmentsApi.md#get_segment) | **GET** /api/segments/{id}/ | Get Segment |
| [**get_segment_profiles**](SegmentsApi.md#get_segment_profiles) | **GET** /api/segments/{id}/profiles/ | Get Segment Profiles |
| [**get_segment_relationships_profiles**](SegmentsApi.md#get_segment_relationships_profiles) | **GET** /api/segments/{id}/relationships/profiles/ | Get Segment Relationships Profiles |
| [**get_segment_relationships_tags**](SegmentsApi.md#get_segment_relationships_tags) | **GET** /api/segments/{id}/relationships/tags/ | Get Segment Relationships Tags |
| [**get_segment_tags**](SegmentsApi.md#get_segment_tags) | **GET** /api/segments/{id}/tags/ | Get Segment Tags |
| [**get_segments**](SegmentsApi.md#get_segments) | **GET** /api/segments/ | Get Segments |
| [**update_segment**](SegmentsApi.md#update_segment) | **PATCH** /api/segments/{id}/ | Update Segment |
+## create_segment
+
+> Hash<String, Object> create_segment(segment_create_query)
+
+Create Segment
+
+Create a segment.<br><br>*Rate limits*:<br>Burst: `1/s`<br>Steady: `15/m`<br>Daily: `100/d` **Scopes:** `segments: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::SegmentsApi.new
+segment_create_query = KlaviyoAPI::SegmentCreateQuery.new({data: KlaviyoAPI::SegmentCreateQueryResourceObject.new({type: KlaviyoAPI::SegmentEnum::SEGMENT, attributes: KlaviyoAPI::SegmentCreateQueryResourceObjectAttributes.new({name: 'name_example', definition: KlaviyoAPI::SegmentDefinition.new({condition_groups: [KlaviyoAPI::ConditionGroup.new({conditions: [KlaviyoAPI::ProfileHasGroupMembershipCondition.new({type: KlaviyoAPI::ProfileGroupMembershipEnum::PROFILE_GROUP_MEMBERSHIP, is_member: true, group_ids: ['group_ids_example']})]})]})})})}) # SegmentCreateQuery |
+
+begin
+ # Create Segment
+ result = api_instance.create_segment(segment_create_query)
+ p result
+rescue KlaviyoAPI::ApiError => e
+ puts "Error when calling SegmentsApi->create_segment: #{e}"
+end
+```
+
+#### Using the create_segment_with_http_info variant
+
+This returns an Array which contains the response data, status code and headers.
+
+> <Array(Hash<String, Object>, Integer, Hash)> create_segment_with_http_info(segment_create_query)
+
+```ruby
+begin
+ # Create Segment
+ data, status_code, headers = api_instance.create_segment_with_http_info(segment_create_query)
+ p status_code # => 2xx
+ p headers # => { ... }
+ p data # => Hash<String, Object>
+rescue KlaviyoAPI::ApiError => e
+ puts "Error when calling SegmentsApi->create_segment_with_http_info: #{e}"
+end
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ---- | ---- | ----------- | ----- |
+| **segment_create_query** | [**SegmentCreateQuery**](SegmentCreateQuery.md) | | |
+
+### Return type
+
+**Hash<String, Object>**
+
+### Authorization
+
+[Klaviyo-API-Key](../README.md#Klaviyo-API-Key)
+
+### HTTP request headers
+
+- **Content-Type**: application/json
+- **Accept**: application/json
+
+
+## delete_segment
+
+> delete_segment(id)
+
+Delete Segment
+
+Delete a segment with the given segment ID.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `segments: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::SegmentsApi.new
+id = 'id_example' # String |
+
+begin
+ # Delete Segment
+ api_instance.delete_segment(id)
+rescue KlaviyoAPI::ApiError => e
+ puts "Error when calling SegmentsApi->delete_segment: #{e}"
+end
+```
+
+#### Using the delete_segment_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)> delete_segment_with_http_info(id)
+
+```ruby
+begin
+ # Delete Segment
+ data, status_code, headers = api_instance.delete_segment_with_http_info(id)
+ p status_code # => 2xx
+ p headers # => { ... }
+ p data # => nil
+rescue KlaviyoAPI::ApiError => e
+ puts "Error when calling SegmentsApi->delete_segment_with_http_info: #{e}"
+end
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ---- | ---- | ----------- | ----- |
+| **id** | **String** | | |
+
+### Return type
+
+nil (empty response body)
+
+### Authorization
+
+[Klaviyo-API-Key](../README.md#Klaviyo-API-Key)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/json
+
+
## get_segment
> Hash<String, Object> get_segment(id, opts)
Get Segment
-Get a segment with the given segment ID.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m`<br><br>Rate limits when using the `additional-fields[segment]=profile_count` parameter in your API request:<br>Burst: `1/s`<br>Steady: `15/m`<br><br>To learn more about how the `additional-fields` parameter impacts rate limits, check out our [Rate limits, status codes, and errors](https://developers.klaviyo.com/en/v2024-02-15/docs/rate_limits_and_error_handling) guide. **Scopes:** `segments:read`
+Get a segment with the given segment ID.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m`<br><br>Rate limits when using the `additional-fields[segment]=profile_count` parameter in your API request:<br>Burst: `1/s`<br>Steady: `15/m`<br><br>To learn more about how the `additional-fields` parameter impacts rate limits, check out our [Rate limits, status codes, and errors](https://developers.klaviyo.com/en/v2024-06-15/docs/rate_limits_and_error_handling) guide. **Scopes:** `segments:read`
### Examples
```ruby
require 'time'
@@ -36,13 +179,13 @@
api_instance = KlaviyoAPI::SegmentsApi.new
id = 'id_example' # String |
opts = {
additional_fields_segment: ['profile_count'], # Array<String> | Request additional fields not included by default in the response. Supported values: 'profile_count'
- fields_segment: ['name'], # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets
- fields_tag: ['name'], # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets
- include: ['tags'] # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#relationships
+ fields_segment: ['name'], # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets
+ fields_tag: ['name'], # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets
+ include: ['tags'] # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#relationships
}
begin
# Get Segment
result = api_instance.get_segment(id, opts)
@@ -74,13 +217,13 @@
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **id** | **String** | | |
| **additional_fields_segment** | [**Array<String>**](String.md) | Request additional fields not included by default in the response. Supported values: 'profile_count' | [optional] |
-| **fields_segment** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets | [optional] |
-| **fields_tag** | [**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_segment** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets | [optional] |
+| **fields_tag** | [**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>**
@@ -117,15 +260,15 @@
api_instance = KlaviyoAPI::SegmentsApi.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
- 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>`email`: `any`, `equals`<br>`phone_number`: `any`, `equals`<br>`push_token`: `any`, `equals`<br>`_kx`: `equals`<br>`joined_group_at`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than`
- page_cursor: 'page_cursor_example', # String | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#pagination
+ 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>`email`: `any`, `equals`<br>`phone_number`: `any`, `equals`<br>`push_token`: `any`, `equals`<br>`_kx`: `equals`<br>`joined_group_at`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than`
+ page_cursor: 'page_cursor_example', # String | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#pagination
page_size: 56, # Integer | Default: 20. Min: 1. Max: 100.
- sort: 'joined_group_at' # String | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sorting
+ sort: 'joined_group_at' # String | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sorting
}
begin
# Get Segment Profiles
result = api_instance.get_segment_profiles(id, opts)
@@ -157,15 +300,15 @@
| 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] |
-| **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>`email`: `any`, `equals`<br>`phone_number`: `any`, `equals`<br>`push_token`: `any`, `equals`<br>`_kx`: `equals`<br>`joined_group_at`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than` | [optional] |
-| **page_cursor** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#pagination | [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>`email`: `any`, `equals`<br>`phone_number`: `any`, `equals`<br>`push_token`: `any`, `equals`<br>`_kx`: `equals`<br>`joined_group_at`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than` | [optional] |
+| **page_cursor** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#pagination | [optional] |
| **page_size** | **Integer** | Default: 20. Min: 1. Max: 100. | [optional][default to 20] |
-| **sort** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sorting | [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>**
@@ -201,14 +344,14 @@
end
api_instance = KlaviyoAPI::SegmentsApi.new
id = 'id_example' # String |
opts = {
- 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>`email`: `any`, `equals`<br>`phone_number`: `any`, `equals`<br>`push_token`: `any`, `equals`<br>`_kx`: `equals`<br>`joined_group_at`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than`
- page_cursor: 'page_cursor_example', # String | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#pagination
+ 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>`email`: `any`, `equals`<br>`phone_number`: `any`, `equals`<br>`push_token`: `any`, `equals`<br>`_kx`: `equals`<br>`joined_group_at`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than`
+ page_cursor: 'page_cursor_example', # String | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#pagination
page_size: 56, # Integer | Default: 20. Min: 1. Max: 1000.
- sort: 'joined_group_at' # String | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sorting
+ sort: 'joined_group_at' # String | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sorting
}
begin
# Get Segment Relationships Profiles
result = api_instance.get_segment_relationships_profiles(id, opts)
@@ -239,14 +382,14 @@
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **id** | **String** | | |
-| **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>`email`: `any`, `equals`<br>`phone_number`: `any`, `equals`<br>`push_token`: `any`, `equals`<br>`_kx`: `equals`<br>`joined_group_at`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than` | [optional] |
-| **page_cursor** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#pagination | [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>`email`: `any`, `equals`<br>`phone_number`: `any`, `equals`<br>`push_token`: `any`, `equals`<br>`_kx`: `equals`<br>`joined_group_at`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than` | [optional] |
+| **page_cursor** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#pagination | [optional] |
| **page_size** | **Integer** | Default: 20. Min: 1. Max: 1000. | [optional][default to 20] |
-| **sort** | **String** | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sorting | [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>**
@@ -353,11 +496,11 @@
end
api_instance = KlaviyoAPI::SegmentsApi.new
id = 'id_example' # String |
opts = {
- fields_tag: ['name'] # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets
+ fields_tag: ['name'] # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets
}
begin
# Get Segment Tags
result = api_instance.get_segment_tags(id, opts)
@@ -388,11 +531,11 @@
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **id** | **String** | | |
-| **fields_tag** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets | [optional] |
+| **fields_tag** | [**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>**
@@ -427,15 +570,16 @@
# config.api_key_prefix['Klaviyo-API-Key'] = 'Bearer'
end
api_instance = KlaviyoAPI::SegmentsApi.new
opts = {
- fields_segment: ['name'], # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets
- fields_tag: ['name'], # 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>`name`: `any`, `equals`<br>`id`: `any`, `equals`<br>`created`: `greater-than`<br>`updated`: `greater-than`
- include: ['tags'], # 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
+ fields_segment: ['name'], # Array<String> | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets
+ fields_tag: ['name'], # 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>`name`: `any`, `equals`<br>`id`: `any`, `equals`<br>`created`: `greater-than`<br>`updated`: `greater-than`<br>`is_active`: `any`, `equals`<br>`is_starred`: `equals`
+ include: ['tags'], # 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: 'created' # String | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sorting
}
begin
# Get Segments
result = api_instance.get_segments(opts)
@@ -465,15 +609,16 @@
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
-| **fields_segment** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-02-15/reference/api-overview#sparse-fieldsets | [optional] |
-| **fields_tag** | [**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>`name`: `any`, `equals`<br>`id`: `any`, `equals`<br>`created`: `greater-than`<br>`updated`: `greater-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] |
+| **fields_segment** | [**Array<String>**](String.md) | For more information please visit https://developers.klaviyo.com/en/v2024-06-15/reference/api-overview#sparse-fieldsets | [optional] |
+| **fields_tag** | [**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>`name`: `any`, `equals`<br>`id`: `any`, `equals`<br>`created`: `greater-than`<br>`updated`: `greater-than`<br>`is_active`: `any`, `equals`<br>`is_starred`: `equals` | [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>**
@@ -491,10 +636,10 @@
> Hash<String, Object> update_segment(id, segment_partial_update_query)
Update Segment
-Update the name of a segment with the given segment ID.<br><br>*Rate limits*:<br>Burst: `1/s`<br>Steady: `15/m` **Scopes:** `segments:write`
+Update a segment with the given segment ID.<br><br>*Rate limits*:<br>Burst: `1/s`<br>Steady: `15/m`<br>Daily: `100/d` **Scopes:** `segments:write`
### Examples
```ruby
require 'time'