Accessing AdManager API(DFP API) using SOAP in Golang

339 views
Skip to first unread message

Bhadreswar Ghuku

unread,
Aug 28, 2022, 4:28:01 AM8/28/22
to Google Ad Manager API Forum
Hi,

I wanted to use SOAP in Golang(Go) to access Ad Manager API. 

Since there is no official library of Ad Manager in Go, I used ad manager services WSDL endpoints(e.g. for line item service https://ads.google.com/apis/ads/publisher/v202208/LineItemService?wsdl) to generate corresponding Go packages using WSDL2Go library available(https://github.com/hooklift/gowsdl).

Using google auth2 and soap client, I am able to make requests to Ad Manager API and get responses for most of the api calls. 

I am facing issues with abstract type and extended types defined in WSDL schema.
e.g. CustomCriteriaSet has fields as children(type CustomCriteriaNode which is base object for CustomCriteriaSet). 
corresponding go struct generated as follows.

type CustomCriteriaSet struct {
*CustomCriteriaNode
LogicalOperator *CustomCriteriaSet_LogicalOperator `xml:"logicalOperator,omitempty" json:"logicalOperator,omitempty"`
Children []*CustomCriteriaNode `xml:"children,omitempty" json:"children,omitempty"`
type CustomCriteriaNode struct {
}
type CustomCriteria struct {
*CustomCriteriaLeaf
KeyId int64 `xml:"keyId,omitempty" json:"keyId,omitempty"`
ValueIds []int64 `xml:"valueIds,omitempty" json:"valueIds,omitempty"`
Operator *CustomCriteria_ComparisonOperator `xml:"operator,omitempty" json:"operator,omitempty"`
}

Here I am not able to build custom targeting for line items since Go doesn't support struct extends of parent to base.

Can anyone give me some ideas how to fix this ? Is there any alternative way I can access Ad Manager API in Golang? 

Any help would be appreciated.

Thanks,
Bhadreswar

Ad Manager API Forum Advisor

unread,
Aug 29, 2022, 3:38:56 AM8/29/22
to bhadresw...@thecarousell.com, google-doubleclick...@googlegroups.com
Hi Bhadreswar,

Thank you for reaching out to the Ad Manager API support team. I am Chekurthi and will be assisting you.

From the documentation, I can confirm that these are available client libraries and are supported by the Ad Manager API. I am afraid to inform you that, we do not have an official GO Lang library for the Ad Manager API. 

You are going to basically need to make your GO Lang application build the SOAP request that will be sent to Ad Manager API. Take a look at one of our client libraries for Ad Manager API. For example, the Java client library has classes that are used to create objects that then get used to build the request that will be sent to the server. Each Ad Manager API service has a WSDL file that can be found in the "Overview" section. I would also recommend checking the GO Lang documentation if there is a way to achieve your requirement.

Regards,
Google Logo
Chekurthi
Ad Manager API Team
 

 

ref:_00D1U1174p._5004Q2doRuh:ref
Reply all
Reply to author
Forward
0 new messages