GAM soap API create Line Item

39 views
Skip to first unread message

D K

unread,
Sep 4, 2025, 5:19:02 AM (6 days ago)  Sep 4
to Google Ad Manager API Forum
In the GAM background, create a Line Item. If the Line Item Type selects Ad Exchange (12), some required fields can be left unfilled, such as costPerUnit. But I use the api to create, and costPerUnit must be passed.

My request parameters: <?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/v202508 ">
  <SOAP-ENV:Header>
    <ns1:RequestHeader>
      <ns1:networkCode>**</ns1:networkCode>
      <ns1:applicationName>**</ns1:applicationName>
    </ns1:RequestHeader>
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <ns1:createLineItems>
      <ns1:lineItems>
        <ns1:orderId>***</ns1:orderId>
        <ns1:name>ApiTest-LineItem</ns1:name>
        <ns1:startDateTimeType>IMMEDIATELY</ns1:startDateTimeType>
        <ns1:unlimitedEndDateTime>1</ns1:unlimitedEndDateTime>
        <ns1:creativeRotationType>EVEN</ns1:creativeRotationType>
        <ns1:frequencyCaps>
          <ns1:maxImpressions>1</ns1:maxImpressions>
          <ns1:numTimeUnits>1</ns1:numTimeUnits>
          <ns1:timeUnit>MINUTE</ns1:timeUnit>
        </ns1:frequencyCaps>
        <ns1:lineItemType>AD_EXCHANGE</ns1:lineItemType>
        <ns1:environmentType>BROWSER</ns1:environmentType>
        <ns1:webPropertyCode>**</ns1:webPropertyCode>
        <ns1:targeting>
          <ns1:inventoryTargeting>
            <ns1:targetedAdUnits>
              <ns1:adUnitId>**</ns1:adUnitId>
              <ns1:includeDescendants>true</ns1:includeDescendants>
            </ns1:targetedAdUnits>
          </ns1:inventoryTargeting>
        </ns1:targeting>
      </ns1:lineItems>
    </ns1:createLineItems>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Failed: requestId: b141617bf1223cf60fbd589921945897, status: 500, faultcode: soap:Server, faultstring: [NotNullError.NULL @ costPerUnit]

Ad Manager API Forum Advisor

unread,
Sep 4, 2025, 9:09:54 AM (6 days ago)  Sep 4
to qq861...@gmail.com, google-doubleclick...@googlegroups.com
Hi,

Thank you for contacting the Ad Manager API support team.

As per the API documentation , the attribute costPerUnit  is required for creating a  LineItem  via Ad Manger API. I would suggest you to refer to this Java sample code  to know all the required fields to create lineitem via Ad Manager API. You may check available client libraries  for other languages. Let us know if you have any further queries.

Thanks,
Google Logo
Ad Manager API Team

Feedback
How was our support today?

rating1 rating2 rating3 rating4 rating5
[2025-09-04 13:09:38Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01u5oxh:ref" (ADR-00331858)



ouer1994

unread,
Sep 4, 2025, 6:28:11 PM (6 days ago)  Sep 4
to Google Ad Manager API Forum
and  I also want to know how to implement the GAM backend. When creating a Line Item, the value of Expected Creatives is All Request Sizes. How to implement it through the API

D K < qq861...@gmail.com > 于2025年9月4日周四 17:19写道:
--
You received this message because you are subscribed to the Google Groups "Google Ad Manager API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-doubleclick-for-p...@googlegroups.com .
To view this discussion visit https://groups.google.com/d/msgid/google-doubleclick-for-publishers-api/34bb592f-624b-47f7-bdb7-378a5222429an%40googlegroups.com .


--
ouer1994

Ad Manager API Forum Advisor

unread,
Sep 8, 2025, 3:57:35 AM (2 days ago)  Sep 8
to qq861...@gmail.com, google-doubleclick...@googlegroups.com

Hi,

To assist further, Please provide a complete UI screenshot where you are able to see that the value of Expected Creatives is All Request Sizes.


Thanks,
Google Logo
Ad Manager API Team

Feedback
How was our support today?

rating1 rating2 rating3 rating4 rating5

[2025-09-08 07:57:20Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01u5oxh:ref" (ADR-00331858)



Ad Manager API Forum Advisor

unread,
Sep 8, 2025, 4:00:04 AM (2 days ago)  Sep 8
to google-doubleclick...@googlegroups.com, qq861...@gmail.com

Hi,

To assist further, Please provide a complete UI screenshot where you are able to see that the value of Expected Creatives is All Request Sizes.

You can send the details via Reply privately to the author option, or direct private replyto this email.


Thanks,
Google Logo
Ad Manager API Team

Feedback
How was our support today?

rating1 rating2 rating3 rating4 rating5

[2025-09-08 07:59:49Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01u5oxh:ref" (ADR-00331858)



Reply all
Reply to author
Forward
0 new messages