Closed jfscyberpub closed 5 years ago
Which version are you using? These attributes are available in the lib since version 11.12.6 already for campaign API. for bulkAPI, they are available since 11.12.7. Please check.
Hi qitia,
Sorry my late response.
Here is what I got when I use GetAdsByAdGroupId
-- 2019-01-29 09:08:16,883 - DEBUG - client.headers:724 -- headers = {'Content-Type': 'text/xml; charset=utf-8', 'SOAPAction': b'"GetAdsByAdGroupId"', 'User-Agent': 'BingAdsSDKPython 12.0.2 (3, 5, 2)'}
-- 2019-01-29 09:08:17,301 - DEBUG - client.process_reply:632 -- HTTP succeeded:
b'<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><h:TrackingId xmlns:h="https://bingads.microsoft.com/CampaignManagement/v12">*********-****-****-****-************</h:TrackingId></s:Header><s:Body><GetAdsByAdGroupIdResponse xmlns="https://bingads.microsoft.com/CampaignManagement/v12"><Ads xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><Ad i:type="ExpandedTextAd"><AdFormatPreference>All</AdFormatPreference><DevicePreference>0</DevicePreference><EditorialStatus>Inactive</EditorialStatus><FinalAppUrls i:nil="true"/><FinalMobileUrls i:nil="true" xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/><FinalUrls xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"><a:string>http://www.pepsicola.co</a:string></FinalUrls><ForwardCompatibilityMap xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic"/><Id>****************</Id><Status>Paused</Status><TrackingUrlTemplate i:nil="true"/><Type>ExpandedText</Type><UrlCustomParameters i:nil="true"/><Domain>www.pepsicola.co</Domain><Path1/><Path2/><Text>Play it again</Text><TitlePart1>{KeyWord:Gag Gifts\xe2\x80\xaa}\xe2\x80\xac</TitlePart1><TitlePart2>Not for you</TitlePart2></Ad></Ads></GetAdsByAdGroupIdResponse></s:Body></s:Envelope>'
[(ExpandedTextAd){
AdFormatPreference = "All"
DevicePreference = 0
EditorialStatus = "Inactive"
FinalAppUrls = None
FinalMobileUrls = None
FinalUrls =
(ArrayOfstring){
string[] =
"http://www.pepsicola.co",
}
ForwardCompatibilityMap = None
Id = ******************
Status = "Paused"
TrackingUrlTemplate = None
Type = "ExpandedText"
UrlCustomParameters = None
Domain = "www.pepsicola.co"
Path1 = None
Path2 = None
Text = "Play it again"
TitlePart1 = "{KeyWord:Gag Gifts}"
TitlePart2 = "Not for you"
}]
The code that execute this query:
operations = {
'get': 'GetAdsByAdGroupId',
'create': 'AddAds',
'update': 'UpdateAds',
'delete': 'DeleteAds',
}
# ...
getattr(
self.bing_client.manager,
self.operations['get']
)(
AdGroupId=advertiser_id,
AdTypes=ad_types
).Ad
EDIT: I forgot to mention that we are testing with the sandbox of Bing Ads.
EDIT2: This is the version I use bingads==12.0.2
@jfscyberpub you'll also need to set ReturnAdditionalFields and explicitly request TitlePart3. In v.next this optional field / gating mechanism will be removed, and all ExpandedTextAd properties will be returned by default. I hope this helps!
@eric-urban Thank you for your feedback. I tested the ReturnAdditionalFields. I pass a list of fields but only the first element is taken evaluated and the rest is ignored.
getattr(
self.bing_client.manager,
self.operations['get']
)(
AdGroupId=advertiser_id,
AdTypes=ad_types,
ReturnAdditionalFields=['TitlePart3', 'TextPart2']
).Ad
In this case, only TitlePart3 is returned. TextPart2 is ignored for some reason.
Here is the body of the SOAP request:
<ns1:Body>
<ns0:GetAdsByAdGroupIdRequest>
<ns0:AdGroupId>1206164341625644</ns0:AdGroupId>
<ns0:AdTypes>
<ns0:AdType>ExpandedText</ns0:AdType>
</ns0:AdTypes>
<ns0:ReturnAdditionalFields>TitlePart3</ns0:ReturnAdditionalFields>
<ns0:ReturnAdditionalFields>TextPart2</ns0:ReturnAdditionalFields>
</ns0:GetAdsByAdGroupIdRequest>
</ns1:Body>
@jfscyberpub the data type requires a list of flags e.g., via Python as ReturnAdditionalFields=['TitlePart3 TextPart2']
. Please try and let me know if you have any other questions.
@eric-urban Thanks. It works now.
Hello,
Bing Ads has released TitlePart3 and TextPart2 for ExpandedTextAd. Any idea when will it available in the BingAds python lib?
Thank you.