Snapchat API错误:“开始时间应该是DAY查询的本地时区的开始时间。”

时间:2018-11-20 12:18:25

标签: api timestamp-with-timezone snapchat

我正在请求以下Snapchat API:

GET https://adsapi.snapchat.com/v1/ads/7e4ebe9a-f903-4849-bd46-c590dbb4345e/stats?
granularity=DAY
&fields=android_installs,attachment_avg_view_time_millis,attachment_impressions,attachment_quartile_1,attachment_quartile_2,attachment_quartile_3,attachment_total_view_time_millis,attachment_view_completion,avg_screen_time_millis,avg_view_time_millis,impressions,ios_installs,quartile_1,quartile_2,quartile_3,screen_time_millis,spend,swipe_up_percent,swipes,total_installs,video_views,view_completion,view_time_millis,conversion_purchases,conversion_purchases_value,conversion_save,conversion_start_checkout,conversion_add_cart,conversion_view_content,conversion_add_billing,conversion_searches,conversion_level_completes,conversion_app_opens,conversion_page_views,attachment_frequency,attachment_uniques,frequency,uniques,story_opens,story_completes,conversion_sign_ups,total_installs_swipe_up,android_installs_swipe_up,ios_installs_swipe_up,conversion_purchases_swipe_up,conversion_purchases_value_swipe_up,conversion_save_swipe_up,conversion_start_checkout_swipe_up,conversion_add_cart_swipe_up,conversion_view_content_swipe_up,conversion_add_billing_swipe_up,conversion_sign_ups_swipe_up,conversion_searches_swipe_up,conversion_level_completes_swipe_up,conversion_app_opens_swipe_up,conversion_page_views_swipe_up,total_installs_view,android_installs_view,ios_installs_view,conversion_purchases_view,conversion_purchases_value_view,conversion_save_view,conversion_start_checkout_view,conversion_add_cart_view,conversion_view_content_view,conversion_add_billing_view,conversion_sign_ups_view,conversion_searches_view,conversion_level_completes_view,conversion_app_opens_view,conversion_page_views_view
&swipe_up_attribution_window=28_DAY
&view_attribution_window=1_DAY
&start_time=2018-10-05T00:00:00.000-08:00
&end_time=2018-10-19T00:00:00.000-08:00

出现以下错误:

 {
    "request_status": "ERROR",
    "request_id": "5bf3f47e00ff060ab0faf7f4330001737e616473617069736300016275696c642d30666635373463642d312d3232302d350001010c",
    "debug_message": "The start time should be start of a Local Time Zone day for DAY query.",
    "display_message": "We're sorry, but the data provided in the request is incomplete or incorrect",
    "error_code": "E1008"
}

某些日期范围将起作用,而其他日期范围将不起作用。我使用什么时区偏移量(欧洲/伦敦+00:00,洛杉矶,-08:00)也无关紧要,也不用格式化请求日期的格式(2018-10-01T00:00:00Z,2018-10-广告统计信息请求日期范围的01T00:00:00.000、2018-10-01T00:00:00.000-08:00等),错误将再次出现。该错误有一个代码,但是在Snapchat的文档中没有详细说明。他们只说“这是一个不好的要求”。

例如,一个广告会让我查询日期为29/10/2018,甚至查询29/10/2018为30/10/2018,但是一旦我将其更改为28/10/2018,它就会失败,同样的错误。

广告没有明显的开始/结束时间,因为我认为这可能与此有关。在我们测试的这种情况下,它也与广告系列的开始/结束时间无关。

API DOC:https://developers.snapchat.com/api/docs/?shell#overview

1 个答案:

答案 0 :(得分:1)

解决了上述错误的问题。我忘记在通过时区偏移时考虑夏令时。

例如我们需要检查start_time或end_time是否有日光节约时间,并相应调整该时区的偏移量。