Creating a line item cant figure out field order

33 views
Skip to first unread message

Eyal Gershon

unread,
May 19, 2024, 3:54:23 AMMay 19
to Google Ad Manager API Forum
Hey guys, 
This is an example of my request:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://www.google.com/apis/ads/publisher/v202311" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <SOAP-ENV:Header>
        <ns1:RequestHeader>
            <ns1:networkCode>XXXXXXXXX</ns1:networkCode>
            <ns1:applicationName>XXXXXX</ns1:applicationName>
        </ns1:RequestHeader>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <ns1:createLineItems>
            <ns1:lineItems>
                <ns1:orderId>3536726631</ns1:orderId>
                <ns1:name>test line item</ns1:name>
                <ns1:externalId>123456789</ns1:externalId>
                <ns1:startDateTime>
                    <ns1:date>
                        <ns1:year>2024</ns1:year>
                        <ns1:month>6</ns1:month>
                        <ns1:day>1</ns1:day>
                    </ns1:date>
                    <ns1:hour>10</ns1:hour>
                    <ns1:minute>0</ns1:minute>
                    <ns1:second>0</ns1:second>
                    <ns1:timeZoneId>Asia/Jerusalem</ns1:timeZoneId>
                </ns1:startDateTime>
                <ns1:startDateTimeType>USE_START_DATE_TIME</ns1:startDateTimeType>
                <ns1:creativeRotationType>EVEN</ns1:creativeRotationType>
                <ns1:deliveryRateType>EVENLY</ns1:deliveryRateType>
                <ns1:deliveryForecastSource>HISTORICAL</ns1:deliveryForecastSource>
                <ns1:roadblockingType>ONE_OR_MORE</ns1:roadblockingType>
                <ns1:skippableAdType>DISABLED</ns1:skippableAdType>
                <ns1:lineItemType>SPONSORSHIP</ns1:lineItemType>
                <ns1:priority>7</ns1:priority>
                <ns1:costPerUnit>
                    <ns1:currencyCode>ILS</ns1:currencyCode>
                    <ns1:microAmount>0</ns1:microAmount>
                </ns1:costPerUnit>
                <ns1:valueCostPerUnit>
                    <ns1:currencyCode>ILS</ns1:currencyCode>
                    <ns1:microAmount>0</ns1:microAmount>
                </ns1:valueCostPerUnit>
                <ns1:costType>CPD</ns1:costType>
                <ns1:discountType>PERCENTAGE</ns1:discountType>
                <ns1:creativePlaceholders>
                    <ns1:size>
                        <ns1:width>120</ns1:width>
                        <ns1:height>600</ns1:height>
                        <ns1:isAspectRatio>false</ns1:isAspectRatio>
                    </ns1:size>
                    <ns1:creativeSizeType>PIXEL</ns1:creativeSizeType>
                    <ns1:isAmpOnly>false</ns1:isAmpOnly>
                </ns1:creativePlaceholders>
                <ns1:environmentType>BROWSER</ns1:environmentType>
                <ns1:companionDeliveryOption>UNKNOWN</ns1:companionDeliveryOption>
                <ns1:primaryGoal>
                    <ns1:goalType>DAILY</ns1:goalType>
                    <ns1:unitType>IMPRESSIONS</ns1:unitType>
                    <ns1:units>100</ns1:units>
                </ns1:primaryGoal>
                <ns1:childContentEligibility>DISALLOWED</ns1:childContentEligibility>
                <ns1:targeting>
                    <ns1:inventoryTargeting>
                        <ns1:targetedAdUnits>
                            <ns1:adUnitId></ns1:adUnitId>
                            <ns1:includeDescendants>false</ns1:includeDescendants>
                        </ns1:targetedAdUnits>
                    </ns1:inventoryTargeting>
                </ns1:targeting>
                <ns1:creativeTargetings/>
                <ns1:unlimitedEndDateTime>true</ns1:unlimitedEndDateTime>
                <ns1:competitiveConstraintScope>POD</ns1:competitiveConstraintScope>
                <ns1:isMissingCreatives>true</ns1:isMissingCreatives>
                <ns1:notes>testing</ns1:notes>
            </ns1:lineItems>
        </ns1:createLineItems>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The response I get is:

<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>Unmarshalling Error: cvc-complex-type.2.4.a: Invalid content was found starting with element '{"https://www.google.com/apis/ads/publisher/v202311":competitiveConstraintScope}'. One of '{"https://www.google.com/apis/ads/publisher/v202311":creativeTargetings}' is expected. </faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>

I keep moving elements around because I know the order matters but  I cant seem to understand what is wrong, I would appreciate your help

Eyal Gershon

unread,
May 19, 2024, 3:56:38 AMMay 19
to Google Ad Manager API Forum
Sorry I gave you the wrong response, this is the one I am referring to :

<?xml version="1.0"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <soap:Fault> <faultcode>soap:Client</faultcode> <faultstring>Unmarshalling Error: cvc-complex-type.2.4.a: Invalid content was found starting with element '{"https://www.google.com/apis/ads/publisher/v202311":unlimitedEndDateTime}'. One of '{"https://www.google.com/apis/ads/publisher/v202311":creativeTargetings}' is expected. </faultstring> </soap:Fault> </soap:Body> </soap:Envelope>

Ad Manager API Forum Advisor

unread,
May 20, 2024, 4:43:45 AMMay 20
to ey...@callbox.co.il, google-doubleclick...@googlegroups.com

Hi,

Thank you for contacting the Ad Manager API support team.

I have reviewed your query and understand that while creating a Line item, you are getting the error i.e, ‘Unmarshalling Error: cvc-complex-type.2.4.a: Invalid content was found starting with element’. In SOAP XML, the order of the fields matters. I recommend using the documentation to ensure the correct order followed while creating the Line item. Also, please refer to the provided logs, which follow the correct insertion order of fields or parameters. You may refer to this link for the all available client libraries for the Ad Manager API.


Code snippet:

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <soapenv:Header>             

    <ns1:RequestHeader xmlns:ns1="https://www.google.com/apis/ads/publisher/v202311"       soapenv:mustUnderstand="0">                        

      <ns1:networkCode></ns1:networkCode>                  

      <ns1:applicationName></ns1:applicationName>                

      </ns1:RequestHeader>            

    </soapenv:Header>        

     <soapenv:Body>                

      <createLineItems xmlns="https://www.google.com/apis/ads/publisher/v202311">      

                 <lineItems>

                <orderId></orderId>

                <name>test line item</name>

                <externalId>123456789</externalId>

                <startDateTime>

                  <date>

                  <year>2024</year>

                   <month>6</month>

                    <day>1</day>

                    </date>

                    <hour>10</hour>

                    <minute>0</minute>

                    <second>0</second>

                    <timeZoneId>Asia/Jerusalem</timeZoneId>

                    </startDateTime>

                    <startDateTimeType>USE_START_DATE_TIME</startDateTimeType>

                    <unlimitedEndDateTime>true</unlimitedEndDateTime>

                    <creativeRotationType>EVEN</creativeRotationType>

                   <deliveryRateType>EVENLY</deliveryRateType>

                   <deliveryForecastSource>HISTORICAL</deliveryForecastSource>

                   <roadblockingType>ONE_OR_MORE</roadblockingType>

                   <skippableAdType>DISABLED</skippableAdType>

                   <lineItemType>SPONSORSHIP</lineItemType>

                   <priority>7</priority>

                    <costPerUnit>

                   <currencyCode></currencyCode>

                   <microAmount>0</microAmount>

                    </costPerUnit>

                    <valueCostPerUnit>

                   <currencyCode></currencyCode>

                   <microAmount>0</microAmount>

                  </valueCostPerUnit>

                 <costType>CPD</costType>

                <discountType>PERCENTAGE</discountType>

                 <creativePlaceholders>

                  <size>

                     <width>120</width>

                     <height>600</height>

                     <isAspectRatio>false</isAspectRatio>

                    </size>

                   <creativeSizeType>PIXEL</creativeSizeType>

                   <isAmpOnly>false</isAmpOnly>

                   </creativePlaceholders>

                   <environmentType>BROWSER</environmentType>

                  <companionDeliveryOption>UNKNOWN</companionDeliveryOption>

                  <notes>testing</notes>

                   <competitiveConstraintScope>POD</competitiveConstraintScope>

                   <isMissingCreatives>true</isMissingCreatives>

                    <primaryGoal>

                    <goalType>DAILY</goalType>

                    <unitType>IMPRESSIONS</unitType>

                    <units>100</units>

                    </primaryGoal>

                   <childContentEligibility>DISALLOWED</childContentEligibility>

                    <targeting>

                    <inventoryTargeting>

                    <targetedAdUnits>

                     <adUnitId></adUnitId>

                     <includeDescendants>true</includeDescendants>

                     </targetedAdUnits>

                    </inventoryTargeting>

                    </targeting>                

                     </lineItems>                   

                      </createLineItems>           

                     </soapenv:Body>    

                      </soapenv:Envelope>


 

This message is in relation to case "ref:!00D1U01174p.!5004Q02tJ1cU:ref" (ADR-00235616)

Thanks,
 
Google Logo Ad Manager API Team


Reply all
Reply to author
Forward
0 new messages