Is there a way to do a request with a Google Ads test account?

93 views
Skip to first unread message

Leonardo Botta

unread,
Oct 24, 2019, 10:34:01 AM10/24/19
to AdWords API and Google Ads API Forum
I am always getting this error, I was wondering if I am getting that error because of my account type


<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Header>
         <ns2:requestId>000595a8dd9a7a930ac54941030a8a7f</ns2:requestId>
         <ns2:serviceName>TargetingIdeaService</ns2:serviceName>
         <ns2:methodName>get</ns2:methodName>
         <ns2:operations>1</ns2:operations>
         <ns2:responseTime>117</ns2:responseTime>
      </ResponseHeader>
   </soap:Header>
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Server</faultcode>
         <faultstring>[QuotaCheckError.DEVELOPER_TOKEN_NOT_APPROVED @ ; trigger:'&lt;null>']</faultstring>
         <detail>
               <ns2:message>[QuotaCheckError.DEVELOPER_TOKEN_NOT_APPROVED @ ; trigger:'&lt;null>']</ns2:message>
               <ns2:ApplicationException.Type>ApiException</ns2:ApplicationException.Type>
               <ns2:errors xsi:type="ns2:QuotaCheckError" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                  <ns2:fieldPath/>
                  <ns2:trigger>&lt;null></ns2:trigger>
                  <ns2:errorString>QuotaCheckError.DEVELOPER_TOKEN_NOT_APPROVED</ns2:errorString>
                  <ns2:ApiError.Type>QuotaCheckError</ns2:ApiError.Type>
                  <ns2:reason>DEVELOPER_TOKEN_NOT_APPROVED</ns2:reason>
               </ns2:errors>
            </ApiExceptionFault>
         </detail>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>

I am trying to do this kind of request:     <v20:requestedAttributeTypes>TARGETED_MONTHLY_SEARCHES</v20:requestedAttributeTypes>
          


If I do the request by an application I am getting this error:

AdWordsApiException: Exception of type 'Google.Api.Ads.AdWords.Lib.AdWordsApiException' was thrown. 
Developer token is not approved for production access, and the customer is attempting to access a production account.. (Error: QuotaCheckError.DEVELOPER_TOKEN_NOT_APPROVED, FieldPath: , Trigger: <null>)


What can I do?


Thanks!!!

Google Ads API Forum Advisor Prod

unread,
Oct 24, 2019, 12:22:13 PM10/24/19
to leonardo...@gmail.com, adwor...@googlegroups.com

Hi Leonardo,

Thank you for reaching out. Please see here for more information on the DEVELOPER_TOKEN_NOT_APPROVED error and tips for fixing it. What is the client customer ID of the account you're using to make the API call? Have you followed all the steps in this guide to set up your test account?

Regards,
Anthony
Google Ads API Team



ref:_00D1U1174p._5001UKONnw:ref
Message has been deleted
Message has been deleted
Message has been deleted

Leonardo Botta

unread,
Oct 25, 2019, 9:08:22 AM10/25/19
to AdWords API and Google Ads API Forum
We want to replicate what the metric history report of the keyword planner would be but doing it from a service

El viernes, 25 de octubre de 2019, 9:54:09 (UTC-3), Leonardo Botta escribió:
What we need to do is a service that consults the amount of google searches of a specific list of keywords, each with a corresponding geographical location.
Is this possible using the adwords api? Could you give us a link where we have an example code, since we could not find one. In addition to the account we have created, we are not able to make the request to the api since it gives us the error that we do not have access permissions to the production account when it is not what we want, we only need to access the data using the basic test account.

This are the settings we currently have

    <add key="DeveloperToken" value="jurL5AmCvuf7eZAItKME0w" />
    <add key="ClientCustomerId" value="433-094-7601" />
    <add key = 'OAuth2Mode' value = 'APPLICATION' />
    <add key = 'OAuth2ClientSecret' value = '5t198UVdGfoNP2airPzC_zBS' />
    <add key = 'OAuth2RefreshToken' value = '1//0hGOslnXKT2fuCgYIARAAGBESNwF-L9IrvmLVE8Q_cgVyyCZtH2s_lxa-RiTYVk2fqe_YLaYyW6rJ491Ap0QSDQcJa8BO71xAnMI' />

Thanks in advance

Google Ads API Forum Advisor Prod

unread,
Oct 25, 2019, 10:34:34 AM10/25/19
to leonardo...@gmail.com, adwor...@googlegroups.com

Hi Leonardo,

The account you provided is a production account, not a test account. You need to create a new test account with the developer token from the account you provided. Please see instructions here.

In order to replicate the keyword planner in the API, you can use the TargetingIdeaService. Please see this guide for more information.



Regards,
Anthony
Google Ads API Team



ref:_00D1U1174p._5001UKONnw:ref

Leonardo Botta

unread,
Oct 30, 2019, 3:21:37 PM10/30/19
to AdWords API and Google Ads API Forum

Hi, is it possible to retrieve data using the TargetingIdeaService from a test account?
I ask this because since the test account does not have real ads I suppose there is no date to retrieve, or am I wrong?

Thanks

Google Ads API Forum Advisor Prod

unread,
Oct 30, 2019, 4:02:10 PM10/30/19
to leonardo...@gmail.com, adwor...@googlegroups.com

Hi Leonardo,
 

When using the TargetingIdeaService with a test account, it will return dummy data.
 

Leonardo Botta

unread,
Oct 30, 2019, 6:23:47 PM10/30/19
to AdWords API and Google Ads API Forum
My problem here is I don't know where I can get the ADGROUP_ID from because the test account does not have real ads. So I don't have a adGroup

Here is the code I am testing

  GetKeywordIdeas GetKeywordIdeas = new GetKeywordIdeas();
            Console.WriteLine(GetKeywordIdeas.Description);
            try
            {
                  long adGroupId = long.Parse("INSERT_ADGROUP_ID_HERE");
                  GetKeywordIdeas.Run(new AdWordsUser(), adGroupId);
            }
            catch (Exception e)
            {
                Console.WriteLine("An exception occurred while running this code example. {0}",
                    ExampleUtilities.FormatException(e));
            }




  /// <summary>
    /// Runs the code example.
    /// </summary>
    /// <param name="user">The AdWords user.</param>
    /// <param name="adGroupId">ID of the ad group to use for generating ideas.</param>
    public void Run(AdWordsUser user, long? adGroupId) {
      using (TargetingIdeaService targetingIdeaService =
          (TargetingIdeaService) user.GetService(AdWordsService.v201809.TargetingIdeaService)) {
        // Create selector.
        TargetingIdeaSelector selector = new TargetingIdeaSelector {
          requestType = RequestType.STATS,
          ideaType = IdeaType.KEYWORD,
          requestedAttributeTypes = new AttributeType[] {
            AttributeType.KEYWORD_TEXT,
            AttributeType.SEARCH_VOLUME,
            AttributeType.AVERAGE_CPC,
            AttributeType.COMPETITION,
            AttributeType.CATEGORY_PRODUCTS_AND_SERVICES,
            AttributeType.TARGETED_MONTHLY_SEARCHES
          }
        };


        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);

        // Add a language search parameter (optional).
        // The ID can be found in the documentation:
        LanguageSearchParameter languageParameter = new LanguageSearchParameter();
        Language english = new Language {
          id = 1000
        };
        languageParameter.languages = new Language[] { english };
        searchParameters.Add(languageParameter);

        // Add network search parameter (optional).
        NetworkSetting networkSetting = new NetworkSetting {
          targetGoogleSearch = true,
          targetSearchNetwork = false,
          targetContentNetwork = false,
          targetPartnerSearchNetwork = false
        };

        NetworkSearchParameter networkSearchParameter = new NetworkSearchParameter {
          networkSetting = networkSetting
        };
        searchParameters.Add(networkSearchParameter);

        // Optional: Use an existing ad group to generate ideas.
        if (adGroupId != null) {
          SeedAdGroupIdSearchParameter seedAdGroupIdSearchParameter =
              new SeedAdGroupIdSearchParameter {
                adGroupId = adGroupId.Value
              };
          searchParameters.Add(seedAdGroupIdSearchParameter);
        }

        // Set the search parameters.
        selector.searchParameters = searchParameters.ToArray();

        // Set selector paging (required for targeting idea service).
        selector.paging = Paging.Default;

        TargetingIdeaPage page = new TargetingIdeaPage();

        try {
          int i = 0;
          do {
            // Get related keywords.
            page = targetingIdeaService.get(selector);

            // Display related keywords.
            if (page.entries != null && page.entries.Length > 0) {
              foreach (TargetingIdea targetingIdea in page.entries) {
                Dictionary<AttributeType, Google.Api.Ads.AdWords.v201809.Attribute> ideas =
                    targetingIdea.data.ToDict();

                string keyword = (ideas[AttributeType.KEYWORD_TEXT] as StringAttribute).value;
                IntegerSetAttribute categorySet =
                    ideas[AttributeType.CATEGORY_PRODUCTS_AND_SERVICES] as IntegerSetAttribute;

                string categories = "";

                if (categorySet != null && categorySet.value != null) {
                  categories = string.Join(", ", categorySet.value);
                }

                long averageMonthlySearches =
                    (ideas[AttributeType.SEARCH_VOLUME] as LongAttribute).value;

                Money averageCpc = (ideas[AttributeType.AVERAGE_CPC] as MoneyAttribute).value;
                double competition = (ideas[AttributeType.COMPETITION] as DoubleAttribute).value;
                Console.WriteLine("Keyword with text '{0}', average monthly search " +
                    "volume {1}, average CPC {2}, and competition {3:F2} was found with " +
                    "categories: {4}", keyword, averageMonthlySearches, averageCpc?.microAmount,
                    competition, categories);

                Console.WriteLine("Keyword with text '{0}', and average monthly search volume " +
                    "'{1}' was found with categories: {2}", keyword, averageMonthlySearches,
                    categories);
                i++;
              }
            }
            selector.paging.IncreaseOffset();
          } while (selector.paging.startIndex < page.totalNumEntries);
          Console.WriteLine("Number of related keywords found: {0}", page.totalNumEntries);
        } catch (Exception e) {
          throw new System.ApplicationException("Failed to retrieve related keywords.", e);
        }
      }
    }



Thanks!


   

Google Ads API Forum Advisor Prod

unread,
Oct 31, 2019, 9:27:17 AM10/31/19
to leonardo...@gmail.com, adwor...@googlegroups.com
Hi Leonardo,

Even though you are using a test account, you can still create ad groups and ads, even if they won't serve. You can grab the ad group ID as if you would in a real Ads account.
Reply all
Reply to author
Forward
0 new messages