@@ -107,6 +107,71 @@ klaviyo = KlaviyoAPI("YOUR API KEY HERE", max_delay=60, max_retries=3, test_host
107107klaviyo.Metrics.get_metrics()
108108```
109109
110+ ### Use Case Examples
111+
112+ #### How to use filtering, sorting, and spare fieldset JSON API features
113+
114+ ** Use Case** : Get events associated with a specific metric, then return just the event properties sorted by oldest to newest datetime.
115+
116+ ``` python
117+ klaviyo.Events.get_events(
118+ fields_event = [' event_properties' ],
119+ filter = " equals(metric_id,\" aBc123\" )" ,
120+ sort = ' -datetime'
121+ )
122+ ```
123+
124+ #### How to filter based on datetime
125+
126+ ** Use Case** : Get profiles that have been updated between two datetimes.
127+
128+ ``` python
129+ klaviyo.Profiles.get_profiles(
130+ filter = ' less-than(updated,2023-04-26T00:00:00Z),greater-than(updated,2023-04-19T00:00:00Z)'
131+ )
132+ ```
133+
134+ #### How to use pagination and the page[ size] param
135+
136+ ** Use Case** : Use cursor-based pagination to get the next 20 profile records.
137+
138+ ``` python
139+ klaviyo.Profiles.get_profiles(
140+ page_cursor = " https://a.klaviyo.com/api/profiles/?page%5Bcursor%5D=bmV4dDo6aWQ6OjAxRjNaWk5ITlRYMUtFVEhQMzJTUzRBN0ZY" ,
141+ page_size = 20
142+ )
143+ ```
144+
145+ NOTE: This page cursor value is exactly what is returned in the ` self ` /` next ` /` prev ` response values
146+
147+ #### How to add additional information to your API response via additional-fields and the ` includes ` parameter
148+
149+ ** Use Case** : Get a specific profile, return an additional predictive analytics field, and also return the list objects associated with the profile.
150+
151+ ``` python
152+ klaviyo.Profiles.get_profile(
153+ ' 01GDDKASAP8TKDDA2GRZDSVP4H' ,
154+ additional_fields_profile = [' predictive_analytics' ],
155+ include = [' lists' ]
156+ )
157+ ```
158+
159+ #### How to use our relationship endpoints to see related resources
160+
161+ ** Use Case** : Get all list memberships for a profile with the given ` profile_id ` .
162+
163+ ``` python
164+ klaviyo.Profiles.get_profile_relationships_lists(' 01GDDKASAP8TKDDA2GRZDSVP4H' )
165+ ```
166+
167+ #### How to see what Klaviyo objects are associated with a specific tag
168+
169+ ** Use Case** : Get all campaigns associated with the given ` tag_id ` .
170+
171+ ``` python
172+ klaviyo.Tags.get_tag_relationships_campaigns(' 9c8db7a0-5ab5-4e3c-9a37-a3224fd14382' )
173+ ```
174+
110175## Error Handling
111176
112177This SDK throws an ` ApiException ` error when the server returns a non-` 2XX ` response.
0 commit comments