Problème d'api bing

CHAMAK Yonah 1 Reputation point
2022-08-31T13:48:16.2+00:00

Hello,
I have a problem when I develop to retrieve campaign performance reports.
The returned error is:
<Code>100</Code><Details i:nil="true"/><ErrorCode>NullRequest</ErrorCode><Message>The request message is null.</Message></OperationError></OperationErrors></ApiFaultDetail></detail></s:Fault></s:Body></s:Envelope>'
WARNING:suds.client:Web service reported a SOAP processing fault using an unexpected HTTP status code 200. Reporting as an internal server error.

it's as if he couldn't find data when we have a lot.

Could someone help me?

def get_report_request(account_id):
"""
Use a sample report request or build your own.
"""
aggregation = 'Daily'
exclude_column_headers=False
exclude_report_footer=False
exclude_report_header=False
time=reporting_service.factory.create('ReportTime')
# You can either use a custom date range or predefined time.
time.PredefinedTime='Yesterday'
time.ReportTimeZone='BrusselsCopenhagenMadridParis'
time.CustomDateRangeStart = None
time.CustomDateRangeEnd = None
return_only_complete_data=False

campaign_performance_report_request=get_campaign_performance_report_request(  
    account_id=account_id,  
    aggregation=aggregation,  
    exclude_column_headers=exclude_column_headers,  
    exclude_report_footer=exclude_report_footer,  
    exclude_report_header=exclude_report_header,  
    report_file_format=REPORT_FILE_FORMAT,  
    return_only_complete_data=return_only_complete_data,  
    time=time)  
 

def get_campaign_performance_report_request(
account_id,
aggregation,
exclude_column_headers,
exclude_report_footer,
exclude_report_header,
report_file_format,
return_only_complete_data,
time):

report_request=reporting_service.factory.create('CampaignPerformanceReportRequest')  
report_request.Aggregation=aggregation  
report_request.ExcludeColumnHeaders=exclude_column_headers  
report_request.ExcludeReportFooter=exclude_report_footer  
report_request.ExcludeReportHeader=exclude_report_header  
report_request.Format=report_file_format  
report_request.ReturnOnlyCompleteData=return_only_complete_data  
report_request.Time=time      
report_request.ReportName="My Campaign Performance Report"  
scope=reporting_service.factory.create('AccountThroughCampaignReportScope')  
scope.AccountIds={'long': [account_id] }  
#scope.AccountIds= account_id  
print(scope)  
scope.Campaigns=None  
report_request.Scope=scope       

report_columns=reporting_service.factory.create('ArrayOfCampaignPerformanceReportColumn')  
report_columns.CampaignPerformanceReportColumn.append([  
    'TimePeriod',  
    'CampaignId',  
    'CampaignName',  
    'DeviceType',  
    'Network',  
    'Impressions',  
    'Clicks',    
    'Spend'  
])  

report_request.Columns=report_columns  
  
return report_request  
  
Microsoft Advertising API
Microsoft Advertising API
A Microsoft API that provides programmatic access to Microsoft Advertising to manage large campaigns or to integrate your marketing with other in-house systems.
382 questions
{count} votes

1 answer

Sort by: Most helpful
  1. CHAMAK Yonah 1 Reputation point
    2022-08-31T15:44:06.97+00:00

    Hello,

    thanks a lot for your help
    I use the Bing Ads API to retrieve reports on the performance of our campaigns. I performed these steps:
    -authentication is ok with refresh token system.

    • then I look at all the accounts to which I am attached
      -I then make the request to retrieve the information concerning these accounts

    But the query returns nothing

    It's the first time for me with this API so I have a little trouble