MicrosoftDocs / Advertising-docs

Creative Commons Attribution 4.0 International
15 stars 59 forks source link

Error: There was an error while trying to deserialize parameter. Bing Ads API V13 Python. #1032

Closed Greta991 closed 3 years ago

Greta991 commented 3 years ago

Hi, i'm using this to get the ads:

campaignmanagement_service = ServiceClient(service='CampaignManagementService', version=13, authorization_data=authorization_data, environment=environment)

ad_group_id = '123456'
ad_types = ['Text Image Product AppInstall ExpandedText DynamicSearch ResponsiveAd ResponsiveSearch']

response = campaignmanagement_service.GetAdsByAdGroupId (AdGroupId = ad_group_id, AdTypes = ad_types)

but i encountered the following error: 'The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter https://bingads.microsoft.com/CampaignManagement/v13:AdTypes. The InnerException message was 'Error in line 1 position 2655. Expecting state' Element '.. Encountered' Text 'with name' ', namespace' '.'.

What am i doing wrong? Thanks in advance.

eric-urban commented 3 years ago

@Greta991 - Please see this sample definition of all ad types:

ALL_AD_TYPES={ 'AdType': ['AppInstall', 'DynamicSearch', 'ExpandedText', 'Product', 'ResponsiveAd', 'ResponsiveSearchAd', 'Text'] }

https://github.com/BingAds/BingAds-Python-SDK/blob/7302d0fc749da1a08827a270d2d0e08bffe63106/examples/v13/auth_helper.py#L26

I hope this helps!

Greta991 commented 3 years ago

It works! Thank you!

rishaab commented 2 years ago

I wish this is included in the documentation!