Grow your business by advertising on bing, MSN, Xbox, and more!
Hello,
Here are a few sample SOAP requests for some of the V5.1 CampaignManagement, Reporting, and Administration Web service operations.
Please provide feedback within this blog on the value and format of these samples. We'll use that information to determine how best to include SOAP samples in our MSDN documentation for Microsoft adCenter API.
Thank you, and also thanks to my Microsoft colleague Strohm for providing the initial Reporting SOAP sample.
Walter PouporeDeveloper Content ManagerMicrosoft adCenter API
Example Reporting.QueueReport request
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Header> <h:ApplicationToken i:nil="true" xmlns:h="https://adcenter.microsoft.com/api/advertiser/v5" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"/> <h:DeveloperToken xmlns:h="https://adcenter.microsoft.com/api/advertiser/v5" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <h:Value>XXXXX</h:Value> </h:DeveloperToken> <h:UserCredentials xmlns:h="https://adcenter.microsoft.com/api/advertiser/v5" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <h:Password>XXXXX</h:Password> <h:Username>XXXXX</h:Username> </h:UserCredentials> </s:Header> <s:Body> <QueueReportRequest xmlns="https://adcenter.microsoft.com/api/advertiser/v5"> <ReportRequest i:type="KeywordPerformanceReportRequest" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <Format>Xml</Format> <Language>English</Language> <ReportName>My Keyword Report</ReportName> <ReturnOnlyCompleteData>false</ReturnOnlyCompleteData> <Aggregation>Monthly</Aggregation> <Columns> <KeywordPerformanceReportColumn>AccountName</KeywordPerformanceReportColumn> <KeywordPerformanceReportColumn>CampaignName</KeywordPerformanceReportColumn> <KeywordPerformanceReportColumn>Keyword</KeywordPerformanceReportColumn> <KeywordPerformanceReportColumn>TimePeriod</KeywordPerformanceReportColumn> <KeywordPerformanceReportColumn>Impressions</KeywordPerformanceReportColumn> <KeywordPerformanceReportColumn>Conversions</KeywordPerformanceReportColumn> </Columns> <Filter> <AdDistribution>Search</AdDistribution> <DeliveredMatchType i:nil="true"/> <Keywords i:nil="true" xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/> <LanguageAndRegion>UnitedStates</LanguageAndRegion> </Filter> <Scope> <AccountIds xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <a:int>XXXXX</a:int> </AccountIds> <AdGroups i:nil="true"/> <Campaigns i:nil="true"/> </Scope> <Time> <CustomDateRangeEnd i:nil="true"/> <CustomDateRangeStart i:nil="true"/> <CustomDates i:nil="true"/> <PredefinedTime>LastSixMonths</PredefinedTime> </Time> </ReportRequest> </QueueReportRequest> </s:Body></s:Envelope>
Example CampaignManagement.AddCampaigns request
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://adcenter.microsoft.com/api/advertiser/v5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SOAP-ENV:Header> <ns1:ApplicationToken> <ns1:Value></ns1:Value> </ns1:ApplicationToken> <ns1:DeveloperToken> <ns1:Value>XXXXX</ns1:Value> </ns1:DeveloperToken> <ns1:UserCredentials> <ns1:Password>XXXXX</ns1:Password> <ns1:Username>XXXXX</ns1:Username> </ns1:UserCredentials> </SOAP-ENV:Header> <SOAP-ENV:Body> <ns1:AddCampaignsRequest> <ns1:AccountId>489</ns1:AccountId> <ns1:Campaigns> <ns1:Campaign> <ns1:BudgetType>DailyBudgetWithMaximumMonthlySpend</ns1:BudgetType> <ns1:ConversionTrackingEnabled>true</ns1:ConversionTrackingEnabled> <ns1:DailyBudget>50</ns1:DailyBudget> <ns1:DaylightSaving>true</ns1:DaylightSaving> <ns1:Description>Winter Clothing Products</ns1:Description> <ns1:MonthlyBudget>5000</ns1:MonthlyBudget> <ns1:Name>Winter Clothing</ns1:Name> <ns1:NegativeKeywords xsi:nil="true"/> <ns1:TimeZone>PacificTimeUSCanadaTijuana</ns1:TimeZone> </ns1:Campaign> <ns1:Campaign> <ns1:BudgetType>DailyBudgetWithMaximumMonthlySpend</ns1:BudgetType> <ns1:ConversionTrackingEnabled>true</ns1:ConversionTrackingEnabled> <ns1:DailyBudget>2000</ns1:DailyBudget> <ns1:DaylightSaving>true</ns1:DaylightSaving> <ns1:Description>Athletic gear for winter</ns1:Description> <ns1:MonthlyBudget>40000</ns1:MonthlyBudget> <ns1:Name>Winter Athletic Gear</ns1:Name> <ns1:NegativeKeywords xsi:nil="true"/> <ns1:TimeZone>EasternTimeUSCanada</ns1:TimeZone> </ns1:Campaign> </ns1:Campaigns> </ns1:AddCampaignsRequest> </SOAP-ENV:Body></SOAP-ENV:Envelope>
Example CampaignManagement.AddAdGroups request
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://adcenter.microsoft.com/api/advertiser/v5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SOAP-ENV:Header> <ns1:ApplicationToken> <ns1:Value></ns1:Value> </ns1:ApplicationToken> <ns1:DeveloperToken> <ns1:Value>XXXXX</ns1:Value> </ns1:DeveloperToken> <ns1:UserCredentials> <ns1:Password>XXXXX</ns1:Password> <ns1:Username>XXXXX</ns1:Username> </ns1:UserCredentials> </SOAP-ENV:Header> <SOAP-ENV:Body> <ns1:AddAdGroupsRequest> <ns1:CampaignId>185918</ns1:CampaignId> <ns1:AdGroups> <ns1:AdGroup> <ns1:AdDistribution>Search</ns1:AdDistribution> <ns1:EndDate> <ns1:Day>31</ns1:Day> <ns1:Month>12</ns1:Month> <ns1:Year>2009</ns1:Year> </ns1:EndDate> <ns1:LanguageAndRegion>EnglishUnitedStates</ns1:LanguageAndRegion> <ns1:Name>Hand wear</ns1:Name> <ns1:NegativeKeywords xsi:nil="true"/> <ns1:StartDate> <ns1:Day>1</ns1:Day> <ns1:Month>11</ns1:Month> <ns1:Year>2008</ns1:Year> </ns1:StartDate> </ns1:AdGroup> <ns1:AdGroup> <ns1:AdDistribution>Search</ns1:AdDistribution> <ns1:EndDate> <ns1:Day>31</ns1:Day> <ns1:Month>12</ns1:Month> <ns1:Year>2009</ns1:Year> </ns1:EndDate> <ns1:LanguageAndRegion>EnglishUnitedStates</ns1:LanguageAndRegion> <ns1:Name>Headwear</ns1:Name> <ns1:NegativeKeywords xsi:nil="true"/> <ns1:StartDate> <ns1:Day>1</ns1:Day> <ns1:Month>11</ns1:Month> <ns1:Year>2008</ns1:Year> </ns1:StartDate> </ns1:AdGroup> </ns1:AdGroups> </ns1:AddAdGroupsRequest> </SOAP-ENV:Body></SOAP-ENV:Envelope>
Example CampaignManagement.AddAds request
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://adcenter.microsoft.com/api/advertiser/v5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SOAP-ENV:Header> <ns1:ApplicationToken> <ns1:Value></ns1:Value> </ns1:ApplicationToken> <ns1:DeveloperToken> <ns1:Value>XXXXX</ns1:Value> </ns1:DeveloperToken> <ns1:UserCredentials> <ns1:Password>XXXXX</ns1:Password> <ns1:Username>XXXXX</ns1:Username> </ns1:UserCredentials> </SOAP-ENV:Header> <SOAP-ENV:Body> <ns1:AddAdsRequest> <ns1:AdGroupId>50927722</ns1:AdGroupId> <ns1:Ads> <ns1:Ad xsi:type="ns1:TextAd"> <ns1:DestinationUrl>http://www.alpineskihouse.com/</ns1:DestinationUrl> <ns1:DisplayUrl>alpineskihouse.com</ns1:DisplayUrl> <ns1:Text>Alpine Ski House has a great selection for you.</ns1:Text> <ns1:Title>Alpine Ski House</ns1:Title> </ns1:Ad> <ns1:Ad xsi:type="ns1:TextAd"> <ns1:DestinationUrl>http://www.alpineskihouse.com/</ns1:DestinationUrl> <ns1:DisplayUrl>alpineskihouse.com</ns1:DisplayUrl> <ns1:Text>Alpine Ski House has winter gear for you.</ns1:Text> <ns1:Title>Winter deals</ns1:Title> </ns1:Ad> </ns1:Ads> </ns1:AddAdsRequest> </SOAP-ENV:Body></SOAP-ENV:Envelope>
Example CampaignManagement.AddKeywords request
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://adcenter.microsoft.com/api/advertiser/v5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <SOAP-ENV:Header> <ns1:ApplicationToken> <ns1:Value></ns1:Value> </ns1:ApplicationToken> <ns1:DeveloperToken> <ns1:Value>XXXXX</ns1:Value> </ns1:DeveloperToken> <ns1:UserCredentials> <ns1:Password>XXXXX</ns1:Password> <ns1:Username>XXXXX</ns1:Username> </ns1:UserCredentials> </SOAP-ENV:Header> <SOAP-ENV:Body> <ns1:AddKeywordsRequest> <ns1:AdGroupId>50927723</ns1:AdGroupId> <ns1:Keywords> <ns1:Keyword> <ns1:BroadMatchBid>0.5</ns1:BroadMatchBid> <ns1:ContentMatchBid>0.5</ns1:ContentMatchBid> <ns1:ExactMatchBid>0.5</ns1:ExactMatchBid> <ns1:NegativeKeywords xsi:nil="true"/> <ns1:Param1 xsi:nil="true"/> <ns1:Param2 xsi:nil="true"/> <ns1:Param3 xsi:nil="true"/> <ns1:Text>mittens</ns1:Text> </ns1:Keyword> <ns1:Keyword> <ns1:BroadMatchBid>0.5</ns1:BroadMatchBid> <ns1:ContentMatchBid>0.5</ns1:ContentMatchBid> <ns1:ExactMatchBid>0.5</ns1:ExactMatchBid> <ns1:NegativeKeywords> <ns2:string>latex</ns2:string> <ns2:string>boxing</ns2:string> <ns2:string>softball</ns2:string> <ns2:string>baseball</ns2:string> </ns1:NegativeKeywords> <ns1:Param1 xsi:nil="true"/> <ns1:Param2 xsi:nil="true"/> <ns1:Param3 xsi:nil="true"/> <ns1:Text>gloves</ns1:Text> </ns1:Keyword> </ns1:Keywords> </ns1:AddKeywordsRequest> </SOAP-ENV:Body></SOAP-ENV:Envelope>
Example CustomerManagement.GetAccounts requestNoteThe CustomerManagement, Administration, and NotificationManagement Web services rely on ASP.Net Web Services (ASMX) technology, while the CampaignManagement and Reporting Web services rely on Windows Communication Foundation (WCF) technology. In addition to the technology differences, adCenter API uses different elements for the ASMX and WCF headers. Hence, you'll see differences in the SOAP request between the ASMX and the WCF Web services.
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://adcenter.microsoft.com/syncapis"> <SOAP-ENV:Header> <ns1:ApiUserAuthHeader> <ns1:UserName>XXXXX</ns1:UserName> <ns1:Password>XXXXX</ns1:Password> <ns1:UserAccessKey>XXXXX</ns1:UserAccessKey> </ns1:ApiUserAuthHeader> </SOAP-ENV:Header> <SOAP-ENV:Body> <ns1:GetAccounts/> </SOAP-ENV:Body></SOAP-ENV:Envelope>
Sign in to adCenter | Need an account? Sign up now
Follow us on Twitter @adCenter & @MSAdvertising | Find us on Facebook and YouTube | Share your thoughts and ask questions in the Forums | Subscribe to the adCenter API Blog
WOW!! Great Programming!
Thanks for the code!