Note, if you are not in the Multi-Image Ad Extensions pilot you must use the ImageMediaIds element. Please check the reference docs and let me know if you have any additional questions.
Getting Error while creating Images element in Bing ads image extensions
Karthik Yaragani
1
Reputation point
Getting error "The image ad extension's media id is invalid." while adding Images element instead of Mediaid's in bing ads image extension
2 answers
Sort by: Most helpful
-
Eric Urban - MSFT 626 Reputation points Microsoft Employee
2021-01-04T18:50:42.673+00:00 -
OA 1 Reputation point
2022-09-08T22:19:47.513+00:00 Dear EricUrban-MSFT,
I try to add an image extension via Bing Ads API in Python.
In my opinion, I care about the documentation rules. But I am getting below error.
Could you help me to understand what is wrong or missing?My code :
value = values["values"][0] ad_extensions = self.service.factory.create("ArrayOfAdExtension") asset_links = self.service.factory.create("ArrayOfAssetLink") image = set_elements_to_none(self.service.factory.create("ImageAdExtension")) image.ImageMediaIds = {"long": [value["asset_remote_id"]]} image.AlternativeText = value["image_name"] image.DisplayText = value["image_name"] image.FinalUrls = {"string": value["image_url"]} image_asset = set_elements_to_none(self.service.factory.create("ImageAsset")) asset_link = set_elements_to_none(self.service.factory.create("AssetLink")) image_asset.Id = value["asset_remote_id"] image_asset.SubType = "LandscapeImageMedia" image_asset.Type = "ImageAsset" asset_link.Asset = image_asset asset_links.AssetLink.append(asset_link) image.Images = asset_links ad_extensions.AdExtension.append(image) response = self.service.AddAdExtensions( AccountId=self.account_id, AdExtensions=ad_extensions, )
Error message:
(reply){ AdExtensionIdentities = (ArrayOfAdExtensionIdentity){ AdExtensionIdentity[] = <empty> } NestedPartialErrors = (ArrayOfBatchErrorCollection){ BatchErrorCollection[] = (BatchErrorCollection){ BatchErrors = None Code = 4027 Details = None ErrorCode = "RequiredImageMissing" FieldPath = "Images" ForwardCompatibilityMap = None Index = 0 Message = "Required image is missing." Type = "BatchErrorCollection" }, (BatchErrorCollection){ BatchErrors = None Code = 4036 Details = None ErrorCode = "InvalidImageExtensionLayout" FieldPath = None ForwardCompatibilityMap = None Index = 0 Message = "Invalid ImageAdExtension Layout." Type = "BatchErrorCollection"