我正在尝试使用python从Spotify Ads API获取报告数据:
reports = requests.post('https://api-partner.spotify.com/ads/v1.3/adAccounts/8a578aa1-e36d-42da-8110-52914f99f907/report',headers=headers,data=data)
我不断收到此错误:
{"error":{"type":"ParsingError","message":"Request is invalid","errors":["Could not deserialize ReportingRequest"],"sp_trace_id":"89e3b470-6bdd-4e03-8903-d4e814e71164"}}
标头部分是正确的,因为它与其他API端点(如“获取活动数据”)一起工作,但我怀疑错误是因为“数据”部分,该部分由以下内容给出:
data = {
"filters": {
"campaign_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"ad_set_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"ad_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"advertiser_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"country_isos": [
"string"
],
"region_ids": [
0
],
"dma_ids": [
0
],
"platforms": "IOS",
"campaign_statuses": "ACTIVE",
"ad_set_statuses": "ACTIVE",
"ad_set_start_dates": [
"2019-08-24T14:15:22Z"
],
"ad_set_end_dates": [
"2019-08-24T14:15:22Z"
],
"cost_type_filters": "CPCL",
"report_datetime_range": {
"report_start": "2019-08-24T14:15:22Z",
"report_end": "2019-08-24T14:15:22Z"
}
},
"dimensions": "CAMPAIGN",
"fields": "CLICKS",
"organization_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"ad_account_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"continuation_token": "string",
"page_size": 0
}
我尝试使用curl命令而不是python,但在终端中仍然出现相同的错误:
curl --request POST \
--url https://api-partner.spotify.com/ads/v1.3/report \
--header 'Authorization: ' \
--header 'Content-Type: application/json' \
--data '{
"filters": {
"campaign_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"ad_set_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"ad_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"advertiser_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"country_isos": [
"string"
],
"region_ids": [
0
],
"dma_ids": [
0
],
"platforms": "IOS",
"campaign_statuses": "ACTIVE",
"ad_set_statuses": "ACTIVE",
"ad_set_start_dates": [
"2019-08-24T14:15:22Z"
],
"ad_set_end_dates": [
"2019-08-24T14:15:22Z"
],
"cost_type_filters": "CPCL",
"report_datetime_range": {
"report_start": "2019-08-24T14:15:22Z",
"report_end": "2019-08-24T14:15:22Z"
}
},
"dimensions": "CAMPAIGN",
"fields": "CLICKS",
"organization_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"ad_account_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"continuation_token": "string",
"page_size": 0
}'
1条答案
按热度按时间q3qa4bjr1#
当我以下面的形式传递数据时,我能够得到响应:
问题似乎出在report_start和report_end日期上。根据文档,分钟和秒必须按00:00传递,如上所示