2

I am working on Snapchat Ads API. (Writing a connector to a big query). currently I get metrics(performance stats) at day's granularity. I pass the following as query parameters to the request URL.

the accounts time zone: America/Los_Angeles

I use the following date format successfully to retrieve data.

2019-03-11T00:00:00.000-07:00 2019-03-12T00:00:00.000-07:00

payload = {
  'granularity': 'DAY',
  'start_time': start_datetime,
  'end_time': end_datetime,
  'fields': fields
}

However, when I query for the date of 2019-03-10(I assume it is the daylight saving adjustment which causes this) it gives me the following error

{'request_status': 'ERROR', 'request_id': 'xxxxxxxx', 'debug_message': "Unsupported Stats Query: Timeseries queries with DAY granularity must have a start time that is the start of day (00:00:00) for the account's timezone. This account's timezone  is: America/Los_Angeles", 'display_message': "We're sorry, but the data provided in the request is incomplete or incorrect", 'error_code': 'E1008'}

I also tried querying by adjusting for daylight saving adjustments. but not successful.

2019-03-11T00:00:00.000-08:00 2019-03-12T00:00:00.000-08:00

2019-03-11T00:00:00.000-06:00 2019-03-12T00:00:00.000-06:00

There is no documentation available on: https://developers.snapchat.com/api/docs/

Any help will be really appreciated. Thanks!

jarvis
  • 157
  • 1
  • 13

2 Answers2

0

You can try this format. The start date is still the same but we apply daylight saving time to end date.

2019-03-11T00:00:00.000-07:00 2019-03-12T00:00:00.000-08:00

It works for me, hope it helps.

0

I could not get the "DAY" granularity to work for me, either. This worked for me:

params = {
    "granularity": "TOTAL",
    "start_time": "2019-03-11T00:00:00.000-07:00",
    "end_time": "2019-03-12T00:00:00.000-07:00",
}

Then the thought being you could loop over a date range and obtain your stats that way.

mykisscool
  • 852
  • 2
  • 9
  • 24