Hi
i am trying to write a program to get related keywords from google
adwords api
using TargetingIdeaService
i am getting following error
{"AuthenticationError.NOT_ADS_USER @ ; trigger:'321144698089'
Service[TargetingIdeaService.getbulkkeywordideas]"}
the following is the code
Public Overrides Sub Run(ByVal user As AdWordsUser)
' Get the TargetingIdeaService.
Dim targetingIdeaService As TargetingIdeaService =
user.GetService( _
AdWordsService.v201109.TargetingIdeaService)
Dim keywordText As String = mfrmKeywords.TextBox1.Text
Dim keyword As New Keyword
keyword.text = keywordText
keyword.matchType = KeywordMatchType.BROAD
' Create the selector.
Dim selector As New TargetingIdeaSelector
selector.requestType = RequestType.IDEAS
selector.ideaType = IdeaType.KEYWORD
selector.requestedAttributeTypes = New AttributeType()
{AttributeType.CRITERION, _
AttributeType.AVERAGE_TARGETED_MONTHLY_SEARCHES}
' Define paging to limit results.
Dim paging As New Paging
paging.startIndex = 0
paging.numberResults = 10
selector.paging = paging
' Create related to keyword search parameter.
Dim relatedToKeywordSearchParameter As New
RelatedToKeywordSearchParameter
relatedToKeywordSearchParameter.keywords = New Keyword()
{keyword}
' Create keyword match type search parameter to ensure
unique results.
Dim keywordMatchTypeSearchParameter As New
KeywordMatchTypeSearchParameter
keywordMatchTypeSearchParameter.keywordMatchTypes = _
New KeywordMatchType() {KeywordMatchType.BROAD}
selector.searchParameters = New SearchParameter()
{relatedToKeywordSearchParameter, _
keywordMatchTypeSearchParameter}
Try
targetingIdeaService.AllowAutoRedirect = True
Dim page As TargetingIdeaPage =
targetingIdeaService.getBulkKeywordIdeas(selector)
If ((Not page Is Nothing) AndAlso (Not page.entries Is
Nothing)) Then
MessageBox.Show("There are a total of " +
page.totalNumEntries + " keywords related to '" + keywordText + "'.
The first " + page.entries.Length + " entries are displayed below:
\n")
For Each idea As TargetingIdea In page.entries
For Each entry As Type_AttributeMapEntry In
idea.data
If (entry.key = AttributeType.CRITERION)
Then
Dim kwdAttribute As CriterionAttribute
= entry.value
Dim relatedKeyword As Keyword =
kwdAttribute.value
Console.WriteLine("Related keyword
with text = '" + relatedKeyword.text + "' and match type = '" +
relatedKeyword.matchType + "' " & _
"was found.")
End If
Next
Next
Else
MessageBox.Show("No related keywords were found
for your keyword.")
End If
Catch ex As Exception
MessageBox.Show("Failed to retrieve related keywords.
Exception says """ + ex.Message + """")
End Try
End Sub
App.config file
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="AdWordsApi"
type="System.Configuration.DictionarySectionHandler"/>
</configSections>
<AdWordsApi>
<!-- Change the appropriate flags to turn on SOAP logging. -->
<add key="LogPath" value="C:\Logs\"/>
<add key="LogToConsole" value="false"/>
<add key="LogToFile" value="false"/>
<add key="MaskCredentials" value="true"/>
<add key="LogErrorsOnly" value="false"/>
<!-- Set the service timeout in milliseconds. -->
<!-- <add key="Timeout" value="100000"/> -->
<!-- Fill the following values if you plan to use a proxy server.--
>
<add key="ProxyServer" value=""/>
<add key="ProxyUser" value=""/>
<add key="ProxyPassword" value=""/>
<add key="ProxyDomain" value=""/>
<!-- Use this key to change the default timeout for Ads services
(in milliseconds.)-->
<add key="Timeout" value="100000"/>
<!-- Use this key to enable or disable gzip compression in SOAP
requests.-->
<add key="EnableGzipCompression" value="true"/>
<!-- Fill the header values. -->
<add key="UserAgent" value="harinath reddy"/>
<!--<add key="ClientEmail" value="client_1+
[email protected]"/>-->
<add key="DeveloperToken" value="[email protected]++INR"/>
<!-- Uncomment this key and comment ClientEmail if you want to
specify
customer id instead of customer email. -->
<add key="ClientCustomerId" value="241-198-6642"/>
<!-- Application token is now optional and will be ignored by the
server.-->
<!-- <add key="ApplicationToken"
value="INSERT_YOUR_APPLICATION_TOKEN_HERE"/> -->
<!-- Set the Authorization method to be used with the client
library. -->
<!-- To use ClientLogin as authentication mechanism, uncomment the
following
section and comment the OAuth section below. -->
<add key="AuthorizationMethod" value="ClientLogin"/>
<add key="Email" value="[email protected]"/>
<add key="Password" value="h9849502881"/>
<!-- Optional: uncomment this if you want to reuse an authToken
multiple
times. -->
<!-- <add key="AuthToken" value="INSERT_YOUR_AUTH_TOKEN_HERE"/> --
>
<!-- To use OAuth as authentication mechanism, uncomment the
following
section and comment the AuthToken section above. -->
<!-- Note: For testing purposes, you can use the OAuth consumer
key/secret
as anonymous/anonymous.-->
<!--
<add key="AuthorizationMethod" value="OAuth" />
<add key="OAuthConsumerKey"
value="INSERT_YOUR_OAUTH_CONSUMER_KEY_HERE" />
<add key="OAuthConsumerSecret"
value="INSERT_YOUR_OAUTH_CONSUMER_SECRET_HERE" />
-->
<!-- Uncomment this key if you want to use v13 sandbox.-->
<add key="LegacyAdWordsApi.Server" value="https://
sandbox.google.com"/>
<!-- Uncomment this key if you want to use AdWords API sandbox. --
>
<add key="AdWordsApi.Server" value="https://adwords-
sandbox.google.com"/>
</AdWordsApi>
<system.web>
<webServices>
<soapExtensionTypes>
<add type="Google.Api.Ads.Common.Lib.SoapListenerExtension,
AdWords"
priority="1" group="0"/>
</soapExtensionTypes>
</webServices>
</system.web>
<system.net>
<settings>
<httpWebRequest maximumErrorResponseLength="-1" />
</settings>
</system.net>
</configuration>
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en