문제

I'm working with https://adwords.google.com/api/adwords/mcm/v201402/ManagedCustomerService and wanting to get the account hierarchy.

The requests are being made in raw XML (controlled by JScript) -- a bit perverse, I know, but that's the situation.

I've generated the following SOAP packet

<?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 soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns:ns1="https://adwords.google.com/api/adwords/mcm/v201402">
            <ns1:clientCustomerId>some_ccid</ns1:clientCustomerId>
            <ns1:developerToken>some_developer_token</ns1:developerToken>
            <ns1:userAgent>GAS</ns1:userAgent>
            <ns1:validateOnly>false</ns1:validateOnly>
            <ns1:partialFailure>false</ns1:partialFailure>
        </ns1:RequestHeader>
    </soapenv:Header>
    <soapenv:Body>
        <get xmlns="https://adwords.google.com/api/adwords/mcm/v201402">
            <serviceSelector>
                <fields>Login</fields>
                <fields>Customer</fields>
                <fields>Name</fields>
                <predicate>
                    <field>id</field>
                    <operator>GREATER_THAN</operator>
                    <values>0</values>
                </predicate>
            </serviceSelector>
        </get>
    </soapenv:Body>
</soapenv:Envelope>

Please note the idGREATER_THAN0. This is my naive way of getting everything.

I notice that the PHP GetAccountHierarchy.php has

// Create selector.
$selector = new Selector();
// Specify the fields to retrieve.
$selector->fields = array('Login', 'CustomerId',  'Name');

// Make the get request.
$graph = $managedCustomerService->get($selector);

This would seem to imply that no predicate has been defined. However, I'm a bit leery of doing that because the documentation says (yes, I do read the friendly manual), "predicates ContentsNotNull"

The response I get is

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header>
        <ns2:ResponseHeader xmlns:ns2="https://adwords.google.com/api/adwords/mcm/v201402" xmlns="https://adwords.google.com/api/adwords/cm/v201402">
            <requestId>0004f553e08eaca00abc25900000893f</requestId>
            <serviceName>ManagedCustomerService</serviceName>
            <methodName>get</methodName>
            <operations>0</operations>
            <responseTime>141</responseTime>
        </ns2:ResponseHeader>
    </soap:Header>
    <soap:Body>
        <soap:Fault>
            <faultcode>soap:Server</faultcode>
            <faultstring>[QuotaCheckError.INVALID_TOKEN_HEADER @ ]</faultstring>
            <detail>
                <ns2:ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/cm/v201402" xmlns:ns2="https://adwords.google.com/api/adwords/mcm/v201402">
                    <message>[QuotaCheckError.INVALID_TOKEN_HEADER @ ]</message>
                    <ApplicationException.Type>ApiException</ApplicationException.Type>
                    <errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="QuotaCheckError">
                        <fieldPath/>
                        <trigger/>
                        <errorString>QuotaCheckError.INVALID_TOKEN_HEADER</errorString>
                        <ApiError.Type>QuotaCheckError</ApiError.Type>
                        <reason>INVALID_TOKEN_HEADER</reason>
                    </errors>
                </ns2:ApiExceptionFault>
            </detail>
        </soap:Fault>
    </soap:Body>
</soap:Envelope>

What am I doing incorrectly that I should get such a response?

BTW, if I do leave out the predicate or specify it with a null content, I still get the QuotaCheckError.INVALID_TOKEN_HEADER error.

도움이 되었습니까?

해결책

A solution has been provided on the Adwords API google group. Working nicely now!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top