Updating an Insertion Order in Bing Ads API using Python

Sean Hayes 1 Reputation point
2021-12-13T14:43:50.397+00:00

Hello

I am trying to update an existing Insertion Order in an account through the usage of the API. I can do this through the Web UI but I need to replicate it using code. My aim with the existing Insertion Order is to set the SpendCapAmount to Unlimited and to set the End Dateto empty so that there is no end date.

My SOAP request made through the Bing API is as follows:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="https://bingads.microsoft.com/Billing/v13" xmlns:ns0="https://bingads.microsoft.com/Customer/v13/Entities" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns2="https://bingads.microsoft.com/Billing/v13">
   <SOAP-ENV:Header>
      <tns:AuthenticationToken>XXX</tns:AuthenticationToken>
      <tns:DeveloperToken>XXX</tns:DeveloperToken>
   </SOAP-ENV:Header>
   <ns1:Body>
      <ns2:UpdateInsertionOrderRequest>
         <ns2:InsertionOrder>
            <ns0:AccountId>123456</ns0:AccountId>
            <ns0:Id>67890</ns0:Id>
            <ns0:Status>Active</ns0:Status>
            <ns0:PendingChanges>
               <ns0:EndDate>Nil</ns0:EndDate>
               <ns0:SpendCapAmount>Nil</ns0:SpendCapAmount>
               <ns0:ChangeStatus>ApproveChanges</ns0:ChangeStatus>
            </ns0:PendingChanges>
         </ns2:InsertionOrder>
      </ns2:UpdateInsertionOrderRequest>
   </ns1:Body>
</SOAP-ENV:Envelope>

This request gets made but I get hit with a WebFault error: "The string 'Nil' is not a valid AllXsd value."

Assuming that what I want above is possible, whats the correct values to set to those two attributes?

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.
424 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.