BingAds API : Unable to update adgroup product partition

Romain Orixa 0 Reputation points
2023-09-19T14:29:54.7033333+00:00

Hello,

I'm working on a tool which helps our customers to create and manage Bing Smart Shopping campaigns.

I'm able to create a campaign with a given product partition on my adgroup, but I'm unable to update the product partition (if I want to exclude more brands for instance)

User's image

According to the documentation, the way to update product partition is to remove the existing tree and replace with the new one.

If I try to delete the previous tree and recreate it, I get an error at delete step. I tried with both criterion ids, and just the root one and get always the same error : The ad group criterion ID is not valid, althought whe criterions ID were previously fetched from the api.

DeleteAdGroupCriterionsRequest

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:ns2="https://bingads.microsoft.com/CampaignManagement/v13">
    <SOAP-ENV:Header>
        <ns2:CustomerId>252910931</ns2:CustomerId>
        <ns2:CustomerAccountId>176334572</ns2:CustomerAccountId>
        <ns2:AuthenticationToken> .... </ns2:AuthenticationToken>
        <ns2:DeveloperToken>......</ns2:DeveloperToken>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <ns2:DeleteAdGroupCriterionsRequest>
            <ns2:AdGroupCriterionIds>
                <ns1:long>4585719406960487</ns1:long>
            </ns2:AdGroupCriterionIds>
            <ns2:AdGroupId>1313918708471185</ns2:AdGroupId>
            <ns2:CriterionType>ProductPartition</ns2:CriterionType>
        </ns2:DeleteAdGroupCriterionsRequest>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Response (tracking id : fde8caa4-f872-42f2-b758-b6d44ab9b1b4):

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Header>
        <h:TrackingId xmlns:h="https://bingads.microsoft.com/CampaignManagement/v13">fde8caa4-f872-42f2-b758-b6d44ab9b1b4</h:TrackingId>
    </s:Header>
    <s:Body>
        <DeleteAdGroupCriterionsResponse xmlns="https://bingads.microsoft.com/CampaignManagement/v13">
            <PartialErrors xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
                <BatchError>
                    <Code>4100</Code>
                    <Details i:nil="true"/>
                    <ErrorCode>CampaignServiceAdGroupCriterionIdInvalid</ErrorCode>
                    <FieldPath i:nil="true"/>
                    <ForwardCompatibilityMap xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic" i:nil="true"/>
                    <Index>0</Index>
                    <Message>The ad group criterion ID is not valid.</Message>
                    <Type>BatchError</Type>
                </BatchError>
            </PartialErrors>
        </DeleteAdGroupCriterionsResponse>
    </s:Body>
</s:Envelope>

I also tried to update & replace via a single ApplyProductPartitionActionsRequest, as it seems to be possible in the doc (For a Delete action you only need to specify the Id and AdGroupId in the AdGroupCriterion.)

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://bingads.microsoft.com/CampaignManagement/v13" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <SOAP-ENV:Header>
        <ns1:CustomerId>252910931</ns1:CustomerId>
        <ns1:CustomerAccountId>176334572</ns1:CustomerAccountId>
        <ns1:AuthenticationToken>...</ns1:AuthenticationToken>
        <ns1:DeveloperToken>...</ns1:DeveloperToken>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <ns1:ApplyProductPartitionActionsRequest>
            <ns1:CriterionActions>
                <ns1:AdGroupCriterionAction>
                    <ns1:Action>Delete</ns1:Action>
                    <ns1:AdGroupCriterion>
                        <ns1:AdGroupId>1316117731422499</ns1:AdGroupId>
                        <ns1:Criterion xsi:nil="true"/>
                        <ns1:Id>4585856845924605</ns1:Id>
                        <ns1:Status xsi:nil="true"/>
                        <ns1:Type xsi:nil="true"/>
                    </ns1:AdGroupCriterion>
                </ns1:AdGroupCriterionAction>
                <ns1:AdGroupCriterionAction>
                    <ns1:Action>Delete</ns1:Action>
                    <ns1:AdGroupCriterion>
                        <ns1:AdGroupId>1316117731422499</ns1:AdGroupId>
                        <ns1:Criterion xsi:nil="true"/>
                        <ns1:Id>4585856845924606</ns1:Id>
                        <ns1:Status xsi:nil="true"/>
                        <ns1:Type xsi:nil="true"/>
                    </ns1:AdGroupCriterion>
                </ns1:AdGroupCriterionAction>
                <ns1:AdGroupCriterionAction>
                    <ns1:Action>Delete</ns1:Action>
                    <ns1:AdGroupCriterion>
                        <ns1:AdGroupId>1316117731422499</ns1:AdGroupId>
                        <ns1:Criterion xsi:nil="true"/>
                        <ns1:Id>4585856845924607</ns1:Id>
                        <ns1:Status xsi:nil="true"/>
                        <ns1:Type xsi:nil="true"/>
                    </ns1:AdGroupCriterion>
                </ns1:AdGroupCriterionAction>
                <ns1:AdGroupCriterionAction>
                    <ns1:Action>Delete</ns1:Action>
                    <ns1:AdGroupCriterion>
                        <ns1:AdGroupId>1316117731422499</ns1:AdGroupId>
                        <ns1:Criterion xsi:nil="true"/>
                        <ns1:Id>4585856845924608</ns1:Id>
                        <ns1:Status xsi:nil="true"/>
                        <ns1:Type xsi:nil="true"/>
                    </ns1:AdGroupCriterion>
                </ns1:AdGroupCriterionAction>
            </ns1:CriterionActions>
        </ns1:ApplyProductPartitionActionsRequest>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

With this error

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <s:Fault>
            <faultcode xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:InternalServiceFault</faultcode>
            <faultstring xml:lang="en-US">The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs.</faultstring>
        </s:Fault>
    </s:Body>
</s:Envelope>

Any ideas ?

Thanks for your help

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.
416 questions
0 comments No comments
{count} votes

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.