Solved

Klaviyo GET-Campaigns API failing when paginating

  • 15 September 2023
  • 12 replies
  • 229 views

Badge

Klaviyo Get Campaigns API failure.

 

I am using the `2023-08-15` of Klaviyo API to get all the campaigns. 

(https://developers.klaviyo.com/en/reference/get_campaigns)

 

I am making paginated requests, using the “next” url in the “links” object. 

At one point, the API is failing with `400` status code & returns

{'errors': [{'id': 'a7fdaa68-1add-4536-91ff-63096728544a',
'status': 400,
'code': 'invalid',
'title': 'Invalid input.',
'detail': "'NoneType' object has no attribute 'tzinfo'",
'source': {'pointer': 'options_static'},
'meta': {}}]
}

 

I am able to get all the campaigns using the deprecated `v1-2` API, so the API keys is fine. 

(https://developers.klaviyo.com/en/v1-2/reference/get-campaigns)

 

icon

Best answer by Kim Strauch 17 January 2024, 17:04

View original

12 replies

Userlevel 7
Badge +35

Hi @vaibhavrai2446!

I’m going to check on this with Engineering and I’ll update the thread ASAP!

 

Best,
Brian

Badge

Hi @vaibhavrai2446!

I’m going to check on this with Engineering and I’ll update the thread ASAP!

 

Best,
Brian

 

Hey Brian,

 

Any updates?

Userlevel 7
Badge +35

Hi @vaibhavrai2446!

My apologies for the delay here! 

 

This looks like a case where the 400 is representative of a bad cursor for the next page. Would you be able to provide the exact "next" url that causes a 400 failure? (With any sensitive information - API keys, etc. redacted)

 

This will allow us to gather more insight about the actual source of the error.

 

Best,

Brian

Badge

Hey Brian,

 

Please find the details below:
URL: 

https://a.klaviyo.com/api/campaigns?filter=equals%28messages.channel%2C%27email%27%29&page%5Bcursor%5D=bmV4dDo6LXVwZGF0ZWQ6OjIwMjItMTAtMTMgMDI6MDA6NDcuNTUwNTY0KzAwOjAw

 

status-code: 400
response-json:

{'errors': [{'id': 'aa6e7f44-8f1b-409c-93e1-de912cb9c21e',
'status': 400,
'code': 'invalid',
'title': 'Invalid input.',
'detail': "'NoneType' object has no attribute 'tzinfo'",
'source': {'pointer': 'options_static'},
'meta': {}}]}

 

Badge

Hey, 

Did you get a chance to take a look in this?

Badge +2

Hi @Brian Turcotte , we’ve faced the same exception with every revision (2023-06-15 -- 2023-10-15). 

URL:

https://a.klaviyo.com/api/campaigns?filter=greater-than%28updated_at%2C2022-01-01T00%3A00%3A00%2B00%3A00%29&sort=updated_at&page%5Bcursor%5D=bmV4dDo6dXBkYXRlZDo6MjAyMi0wOS0xOSAxODozOTo0MyswMDowMA

response:

{
"errors":[
{
"id":"29e038e4-a97c-400b-987c-a5e280415ea7",
"status":400,
"code":"invalid",
"title":"Invalid input.",
"detail":"'NoneType' object has no attribute 'tzinfo'",
"source":{
"pointer":"options_static"
},
"meta":{
}
}
]
}

Any updated so far?

Userlevel 3
Badge +3

Hey @Eugene K and @vaibhavrai2446


Sorry for the delay. This appears to be a bug in our campaigns endpoint; this error was being mis-categorized as a 400 instead of a 500, so we weren’t aware it was happening.

Our engineering team is investigating the issue further and I’ll let you know when we have an ETA for the fix 

Badge

Thanks @Kim Strauch . 
Just wanted to highlight that using the correct status-code would not be sufficient for our usecase. 

This is a major blocker for us since we are unable to get all the required details due to this error. 

@Brian Turcotte 

 

 

Userlevel 7
Badge +35

Hi @vaibhavrai2446 & @Eugene K!

I’ll work with @Kim Strauch and the API to ensure that the thread will be notified when there is an update here!

Best,

Brian

Badge +2

HI @Brian Turcotte, @Kim Strauch,

Do you have any updates regarding the issue?

Userlevel 3
Badge +3

Hey @Eugene K , I checked in with the team and the issue should be fixed on your end. Can you please give it a go and confirm it’s working for you? 

Badge +2

Hi @Kim Strauch, confirming that issue is fixed.

Thanks!

Reply