Closed linus closed 3 years ago
I'm trying to get a valid networkCode
for the authenticated user.
I'm getting an error stating that I need to pass in a networkCode
, but per ad manager documentation https://developers.google.com/ad-manager/api/soap_xml getCurrentNetwork
does not require thenetworkCode
const dfp1 = new DFP({networkCode: 'doesnotmatter', apiVersion: 'v202102'});
const networkSerivce = await dfp1.getService('NetworkService', dfpAccessToken);
const res = await networkSerivce.getCurrentNetwork({}); //we need to pass in empty object
Error: soap:Server: [AuthenticationError.NETWORK_NOT_FOUND @ ; trigger:'doesnotmatter']: {"ApiExceptionFault":{"message":"[AuthenticationError.NETWORK_NOT_FOUND @ ; trigger:'doesnotmatter']","errors":{"attributes":{"xsi:type":"AuthenticationError"},"fieldPath":"","trigger":"doesnotmatter","errorString":"AuthenticationError.NETWORK_NOT_FOUND","reason":"NETWORK_NOT_FOUND"}}}
I tried omitting the networkCode
from the object parameter, same problem.
@linus You workaround with an empty object works great. Thank you for that.
It does work if I pass in a valid networkCode
, but I'm trying to get the code on behave of my users so they don't need to copy it from the GAM UI.
Did anyone else had a similar issue?
OK, I found the issue.
I was using getCurrentNetwork
instead of getAllNetworks
.
It works If I call the API like this.
const dfp1 = new DFP({networkCode: 'doesnotmatter', apiVersion: 'v202102'});
const networkSerivce = await dfp1.getService('NetworkService', dfpAccessToken);
const res = await networkSerivce.getAllNetworks({}); //we need to pass in empty object
When running a function that takes no parameters, eg
NetworkService.getCurrentNetwork()
, the client fails withThe request to NetworkService contains no information about the requested method (
soap:Body
is empty):However, passing an empty object works, so that
NetworkService.getCurrentNetwork({})
returns info about the current network, with the SOAP request body being: