AdWords API Sample GetKeywordIdeas does not work.

84 views
Skip to first unread message

Kosuke Shibayama

unread,
Mar 14, 2019, 5:40:08 PM3/14/19
to AdWords API and Google Ads API Forum
Hello,
I recently started the AdWords API and do not understand well yet.
I downloaded the sample for C#. But it does not work.

An exception occurs at the "page = targetingIdeaService.get(selector);" when I use the sample GetKeywordIdeas.
The exception message is as follows.

AdWordsApiException: Eine Ausnahme vom Typ "Google.Api.Ads.AdWords.Lib.AdWordsApiException" wurde ausgelöst.

Error returned when a <a href='SearchParameter'>SearchParameter</a> doesn't match the <a href='IdeaType'>IdeaType</a> specified in the <a href='TargetingIdeaSelector'>TargetingIdeaSelector</a> or is otherwise invalid. Error trigger usually contains the parameter name, and error details contain a more detailed explanation.. (Error: TargetingIdeaError.INVALID_SEARCH_PARAMETERS, FieldPath: selector.searchParameters[1].adGroupId.adGroupId, Trigger: )


But I do not change ideaType and SearchParameter of sample.

They are as follows.

// Create selector.
TargetingIdeaSelector selector = new TargetingIdeaSelector
{
requestType = RequestType.IDEAS,
ideaType = IdeaType.KEYWORD,
requestedAttributeTypes = new AttributeType[]
{
AttributeType.KEYWORD_TEXT,
AttributeType.SEARCH_VOLUME,
AttributeType.AVERAGE_CPC,
AttributeType.COMPETITION,
AttributeType.CATEGORY_PRODUCTS_AND_SERVICES
}
};


List<SearchParameter> searchParameters = new List<SearchParameter>();

// Create related to query search parameter.
RelatedToQuerySearchParameter relatedToQuerySearchParameter =
new RelatedToQuerySearchParameter
{
queries = new string[]
{
"bakery",
"pastries",
"birthday cake"
}
};
searchParameters.Add(relatedToQuerySearchParameter);


I first enter 412 as "Food, Beverages & Tobacco" when I use the sample.

I changed only the following part of App.config.

DeveloperToken

ClientCustomerId

OAuth2ClientId

OAuth2ClientSecret

OAuth2RefreshToken


My Access level is Basic Access.

I created OAuth2RefreshToken with OAuthTokenGenerator and then entered yes, yes and blank.


Thankful for any advice!

googleadsapi...@google.com

unread,
Mar 15, 2019, 3:22:36 AM3/15/19
to AdWords API and Google Ads API Forum
Hi Kosuke,

Could you confirm if you have specified the client customer id? If not, could you specify it as elaborated here and re-run the client library code? 

If this does not work, could you provide the complete SOAP request and response logs that were generated when you encountered the error? You may provide them using the reply privately to author option. If you have not enabled logging, you may refer to this guide on how to do so.

Regards,
Dannison
AdWords API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
 
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups "AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/a221985c-2c23-4fd5-bbc9-3aa453d6575e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kosuke Shibayama

unread,
Mar 15, 2019, 4:51:44 PM3/15/19
to AdWords API and Google Ads API Forum
Hi Dannison,

I have specified the client customer id.

I send the complete SOAP request and response.
I hide only the clientCustomerId with *.

-----------------BEGIN API CALL---------------------

Request
-------

POST /api/adwords/o/v201806/TargetingIdeaService
VsDebuggerCausalityData: uIDPo2RV2xYcroxGnATyHxkwzfcAAAAA6mrnjENNkUuW7lO1t92pbuELybPsN7NKsux/H4XMV30ACQAA
Authorization: REDACTED
Accept-Encoding: gzip, deflate
TimeStamp: Fri, 15 Mar 2019 11:42:33 GMT


<?xml version="1.0" encoding="utf-16"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <RequestHeader xmlns="https://adwords.google.com/api/adwords/o/v201806">
      <clientCustomerId xmlns="https://adwords.google.com/api/adwords/cm/v201806">***-***-****</clientCustomerId>
      <developerToken xmlns="https://adwords.google.com/api/adwords/cm/v201806">REDACTED</developerToken>
      <userAgent xmlns="https://adwords.google.com/api/adwords/cm/v201806">unknown (AwApi-DotNet/24.4.0, Common-Dotnet/9.5.0, .NET CLR/4.0.30319.42000, OAuthServiceAccountFlow, SelectorBuilder, gzip)</userAgent>
    </RequestHeader>
  </s:Header>
  <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <get xmlns="https://adwords.google.com/api/adwords/o/v201806">
      <selector>
        <searchParameters xsi:type="RelatedToQuerySearchParameter">
          <queries>bakery</queries>
          <queries>pastries</queries>
          <queries>birthday cake</queries>
        </searchParameters>
        <searchParameters xsi:type="LanguageSearchParameter">
          <languages>
            <id xmlns="https://adwords.google.com/api/adwords/cm/v201806">1000</id>
          </languages>
        </searchParameters>
        <searchParameters xsi:type="NetworkSearchParameter">
          <networkSetting>
            <targetGoogleSearch xmlns="https://adwords.google.com/api/adwords/cm/v201806">true</targetGoogleSearch>
            <targetSearchNetwork xmlns="https://adwords.google.com/api/adwords/cm/v201806">false</targetSearchNetwork>
            <targetContentNetwork xmlns="https://adwords.google.com/api/adwords/cm/v201806">false</targetContentNetwork>
            <targetPartnerSearchNetwork xmlns="https://adwords.google.com/api/adwords/cm/v201806">false</targetPartnerSearchNetwork>
          </networkSetting>
        </searchParameters>
        <searchParameters xsi:type="SeedAdGroupIdSearchParameter">
          <adGroupId>412</adGroupId>
        </searchParameters>
        <ideaType>KEYWORD</ideaType>
        <requestType>IDEAS</requestType>
        <requestedAttributeTypes>KEYWORD_TEXT</requestedAttributeTypes>
        <requestedAttributeTypes>SEARCH_VOLUME</requestedAttributeTypes>
        <requestedAttributeTypes>AVERAGE_CPC</requestedAttributeTypes>
        <requestedAttributeTypes>COMPETITION</requestedAttributeTypes>
        <requestedAttributeTypes>CATEGORY_PRODUCTS_AND_SERVICES</requestedAttributeTypes>
        <paging>
          <startIndex xmlns="https://adwords.google.com/api/adwords/cm/v201806">0</startIndex>
          <numberResults xmlns="https://adwords.google.com/api/adwords/cm/v201806">500</numberResults>
        </paging>
      </selector>
    </get>
  </s:Body>
</s:Envelope>

Response
--------

Content-Encoding:
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Alt-Svc: quic=":443"; ma=2592000; v="46,44,43,39"
Transfer-Encoding: chunked
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=UTF-8
Date: Fri, 15 Mar 2019 10:42:33 GMT
Expires: Fri, 15 Mar 2019 10:42:33 GMT
Server: GSE
TimeStamp: Fri, 15 Mar 2019 11:42:33 GMT


<?xml version="1.0" encoding="utf-16"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <ResponseHeader xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201806" xmlns="https://adwords.google.com/api/adwords/o/v201806">
      <ns2:requestId>0005841fb23cdd040a560cc2eb09cfc8</ns2:requestId>
      <ns2:serviceName>AdGroupService</ns2:serviceName>
      <ns2:methodName>get</ns2:methodName>
      <ns2:operations>1</ns2:operations>
      <ns2:responseTime>463</ns2:responseTime>
    </ResponseHeader>
  </soap:Header>
  <soap:Body>
    <soap:Fault>
      <faultcode>soap:Server</faultcode>
      <faultstring>[TargetingIdeaError.INVALID_SEARCH_PARAMETERS @ selector.searchParameters[1].adGroupId.adGroupId]</faultstring>
      <detail>
        <ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/o/v201806" xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201806">
          <ns2:message>[TargetingIdeaError.INVALID_SEARCH_PARAMETERS @ selector.searchParameters[1].adGroupId.adGroupId]</ns2:message>
          <ns2:ApplicationException.Type>ApiException</ns2:ApplicationException.Type>
          <ns2:errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="TargetingIdeaError">
            <ns2:fieldPath>selector.searchParameters[1].adGroupId.adGroupId</ns2:fieldPath>
            <ns2:fieldPathElements>
              <ns2:field>selector</ns2:field>
            </ns2:fieldPathElements>
            <ns2:fieldPathElements>
              <ns2:field>searchParameters</ns2:field>
              <ns2:index>1</ns2:index>
            </ns2:fieldPathElements>
            <ns2:fieldPathElements>
              <ns2:field>adGroupId</ns2:field>
            </ns2:fieldPathElements>
            <ns2:fieldPathElements>
              <ns2:field>adGroupId</ns2:field>
            </ns2:fieldPathElements>
            <ns2:trigger></ns2:trigger>
            <ns2:errorString>TargetingIdeaError.INVALID_SEARCH_PARAMETERS</ns2:errorString>
            <ns2:ApiError.Type>TargetingIdeaError</ns2:ApiError.Type>
            <reason>INVALID_SEARCH_PARAMETERS</reason>
          </ns2:errors>
        </ApiExceptionFault>
      </detail>
    </soap:Fault>
  </soap:Body>
</soap:Envelope>
-----------------END API CALL-----------------------

2019年3月15日金曜日 8時22分36秒 UTC+1 googleadsapi-forumadvisor:

googleadsapi...@google.com

unread,
Mar 17, 2019, 10:58:11 PM3/17/19
to AdWords API and Google Ads API Forum
Hi Kosuke,

Upon checking the logs, it appears that the adGroupId you have specified (412) is invalid. Could you input a valid adGroupId in your request and check if the error would still occur? You could get the list of ad groups under you account by running the AdGroupService.get().

Regards,
Dannison
AdWords API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/

Kosuke Shibayama

unread,
Mar 19, 2019, 4:41:48 AM3/19/19
to AdWords API and Google Ads API Forum
The sample works if I do not specify the adGroupId.

Thank you.

2019年3月18日月曜日 3時58分11秒 UTC+1 googleadsapi-forumadvisor:
Reply all
Reply to author
Forward
0 new messages