Skip to main content

Hello,

 I’m trying the latest python sdk v6.1.0 .   I’m trying to do a simple create event call and I’m getting an error.   I’ve copied the payload directly from the docs, and the “get” queries are working, so i’m not sure what the issue is…  Has anyone else run into this? I’ve tried many different payload formats but i’m not sure what is missing.

 

thanks,

k

 

klaviyo = KlaviyoAPI(settings.KLAVIYO_PRIVATE_KEY, max_delay=60, max_retries=3, test_host=None)

payload = {'data': {'type': 'event',
'attributes': {'properties': {'action': 'Reset Password'},
'metric': {'data': {'type': 'metric',
'attributes': {'name': 'Reset Password'}}},
'profile': {'data': {'type': 'profile',
'attributes': {'email': 'sarah.mason@klaviyo-demo.com'},
'properties': {'PasswordResetLink': 'https://www.website.com/reset/1234567890987654321'}}},
'unique_id': '4b5d3f33-2e21-4c1c-b392-2dae2a74a2er'}}}

result = klaviyo.Events.create_event(data=payload)

ValidationError: 1 validation error for CreateEvent
event_create_query_v2
field required (type=value_error.missing)

 

I’m not sure how to remove this, so i’ll leave it up... in case anyone else makes the same mistake ,the fix was that I had the wrong kwarg.

 

klaviyo.Events.create_event(data=payload) should just be klaviyo.Events.create_event(payload), and everything works alot better.

 


Hi @KeithPYC!

Thanks so much for sharing your solution with the Community!
 

- Brian


Reply