Grow your business by advertising on bing, MSN, Xbox, and more!
I'm trying to create an Ad Group via the REST API and I'm getting the internal error message. Any help would be appreciated. Thanks.
URL: https://adcenterapi.microsoft.com/Api/Advertiser/v8/CampaignManagement/CampaignManagementServiceREST.svc/customer/account/campaign/XXXXXXX/adGroup?format=json
Here is the encoded JSON
{\"AdGroups\":[{\"AdDistribution\":[\"Search\"],\"BiddingModel\":\"Keyword\",\"BroadMatchBid\":{\"amount\":0.05},\"ContentMatchBid\":{\"amount\":0.05},\"ExactMatchBid\":{\"amount\":0.05},\"Language\":\"English\",\"Name\":\"Test Group\",\"Network\":\"OwnedAndOperatedOnly\",\"PhraseMatchBid\":{\"amount\":0.05},\"PricingModel\":\"Cpc\",\"PublisherCountries\":[\"US\"]}]}
Response:
<AdApiFaultDetail xmlns="https://adapi.microsoft.com" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><TrackingId>cb54a5d6-9414-40bf-a840-1429086fb551</TrackingId><Errors><AdApiError><Code>0</Code><Detail i:nil="true"/><ErrorCode>InternalError</ErrorCode><Message>An internal error has occurred.</Message></AdApiError></Errors></AdApiFaultDetail>
Hello.
My colleague and I found a couple of issues with your initial JSON request string. Enumerations values such as Cpc should be specified as an int, e.g. "PricingModel":0. Additionally if you are specifying PublisherCountries, the structure should include Country and IsOptedIn elements, e.g. "PublisherCountries":[{"Country":"US","IsOptedIn":true}].
Here is a full sample which works for me for v8 production.
REQUEST_STRING = ('{"AdGroups":[{"AdDistribution":1,"BiddingModel":0,"BroadMatchBid":{"Amount":0.05},"CashBackInfo":null,"ContentMatchBid":{"Amount":0.05},"ExactMatchBid":{"Amount":0.05},"Id":null,"Language":"English","Name":"sample ad group","Network":1,"PhraseMatchBid":{"Amount":0.05},"PricingModel":0,"PublisherCountries":[{"Country":"US","IsOptedIn":true}]}]}')
I hope this helps!
Eric
Thanks Eric, it works.
Could you point me towards some documentation regarding the specs for the JSON request for the REST API? I must have missed it or been looking at the wrong docs because this is the first time the correct specs.
Hello tpsoc,
Sorry for our delayed response, you can find REST API documentation here: http://msdn.microsoft.com/en-US/library/ff728502.aspx
Let us know if you have any futher questions! :-)
Thanks!
Ricky Poole - Web Support Specialist
Twitter: Follow adCenter