Getting Error while creating Images element in Bing ads image extensions

Karthik Yaragani 1 Reputation point
2021-01-04T13:42:45.817+00:00

Getting error "The image ad extension's media id is invalid." while adding Images element instead of Mediaid's in bing ads image extension

Microsoft Authenticator
Microsoft Authenticator
A Microsoft app for iOS and Android devices that enables authentication with two-factor verification, phone sign-in, and code generation.
6,550 questions
Microsoft Advertising API
Microsoft Advertising API
A Microsoft API that provides programmatic access to Microsoft Advertising to manage large campaigns or to integrate your marketing with other in-house systems.
415 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Eric Urban - MSFT 626 Reputation points Microsoft Employee
    2021-01-04T18:50:42.673+00:00

    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.

    0 comments No comments

  2. 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"  
                  
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.