C# program like https://adwords.google.com/select/KeywordToolExternal

244 views
Skip to first unread message

myry2000

unread,
Feb 7, 2011, 9:14:54 AM2/7/11
to AdWords API Forum
Hi all
Anyone help me please ?

How can I get kewords like on the site https://adwords.google.com/select/KeywordToolExternal

My button has method :

private void button6_Click(object sender, EventArgs e)
{
TargetingIdeaService targetingIdeaService;
long adGroupId;
long campaignId;
//TestUtils utils = new TestUtils();

targetingIdeaService =
(TargetingIdeaService)mccUser.GetService(AdWordsService.v200909.TargetingIdeaService);
//campaignId = utils.CreateCampaign(user, true);

TargetingIdeaSelector selector = new
TargetingIdeaSelector();
RelatedToKeywordSearchParameter
relatedToKeywordSearchParam = new RelatedToKeywordSearchParameter();
com.google.api.adwords.v200909.Keyword keyword = new
com.google.api.adwords.v200909.Keyword();

keyword.text = "kapiszon";
keyword.matchTypeSpecified = true;
keyword.matchType =
com.google.api.adwords.v200909.KeywordMatchType.EXACT;

relatedToKeywordSearchParam.keywords = new
com.google.api.adwords.v200909.Keyword[] { keyword };

selector.searchParameters = new SearchParameter[]
{ relatedToKeywordSearchParam };
selector.ideaTypeSpecified = true;
selector.ideaType = IdeaType.KEYWORD;

selector.requestTypeSpecified = true;
selector.requestType = RequestType.IDEAS;

selector.paging = new Paging();
selector.paging.startIndexSpecified = true;
selector.paging.startIndex = 0;
selector.paging.numberResultsSpecified = true;
selector.paging.numberResults = 1;

try
{
TargetingIdeaPage page =
targetingIdeaService.get(selector);
if (page != null && page.entries != null)
{
textBox3.AppendText(String.Format("There are a
total of {0} keywords related to '{1}'. The first {2}" +
" entries are displayed below: \n",
page.totalNumEntries, textBox4.Text, page.entries.Length));

foreach (TargetingIdea idea in page.entries)
{
foreach (Type_AttributeMapEntry entry in
idea.data)
{
if (entry.key == AttributeType.KEYWORD)
{
KeywordAttribute kwdAttribute =
entry.value as KeywordAttribute;

textBox3.AppendText(String.Format("Related keyword with text = '{0}'
and match type = '{1}'" + " was found.\n\n",
kwdAttribute.value.text,
kwdAttribute.value.matchType));
}
}
}
}
else
{
textBox3.AppendText("No related keywords were
found for your keyword.\n");
}
}
catch (Exception ex)
{
textBox3.AppendText(String.Format("Failed to retrieve
related keywords. Exception says \"{0}\"", ex.Message));
}
}


On the screen I get a message :

There are a total of 300 keywords related to 'kapiszon'. The first 8
entries are displayed below:
Related keyword with text = 'sample keyword 2129313374 0' and match
type = 'EXACT' was found.

Related keyword with text = 'sample keyword 2129313374 0' and match
type = 'PHRASE' was found.

Related keyword with text = 'sample keyword 2129313374 0' and match
type = 'BROAD' was found.

Related keyword with text = 'Red Herring 1' and match type = 'EXACT'
was found.

Related keyword with text = 'Red Herring 1' and match type = 'PHRASE'
was found.

Related keyword with text = 'Red Herring 1' and match type = 'BROAD'
was found.

Related keyword with text = 'sample keyword 2129313374 2' and match
type = 'EXACT' was found.

Related keyword with text = 'sample keyword 2129313374 2' and match
type = 'PHRASE' was found.


How ca I get a list of the keywords : kapiszon, kapiszon, kapiszon
sklep etc.

Thanks fo help.

myry2000

unread,
Feb 8, 2011, 2:06:51 AM2/8/11
to AdWords API Forum
file soap_xml.log :

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

Request
-------

POST /api/adwords/o/v201008/TargetingIdeaService
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client
Protocol 2.0.50727.4927)
VsDebuggerCausalityData: uIDPo16wY+899mVHn0m3fnCJ/
hEAAAAAap46HNEzWkmv7iABZyo1Z9CHmpP2QsFAmwhrXCzSjgAACQAA
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
Host: adwords-sandbox.google.com
Content-Length: 1637
Connection: Keep-Alive
TimeStamp: Mon, 07 Feb 2011 22:30:51 GMT

<?xml version="1.0" encoding="utf-8"?><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/
XMLSchema"><soap:Header><RequestHeader xmlns="https://
adwords.google.com/api/adwords/o/v201008"><applicationToken
xmlns="https://adwords.google.com/api/adwords/cm/v201008">******</
applicationToken><authToken xmlns="https://adwords.google.com/api/
adwords/cm/v201008">******</authToken><clientEmail xmlns="https://
adwords.google.com/api/adwords/cm/v201008">client_...@onet.eu</
clientEmail><developerToken xmlns="https://adwords.google.com/api/
adwords/cm/v201008">******</developerToken><userAgent xmlns="https://
adwords.google.com/api/adwords/cm/v201008">AwApi-DotNet-11.2.0|C# Demo
Application</userAgent></RequestHeader></soap:Header><soap:Body><get
xmlns="https://adwords.google.com/api/adwords/o/
v201008"><selector><searchParameters
xsi:type="RelatedToKeywordSearchParameter"><keywords><text
xmlns="https://adwords.google.com/api/adwords/cm/v201008">space
cruise</text><matchType xmlns="https://adwords.google.com/api/adwords/
cm/v201008">EXACT</matchType></keywords></
searchParameters><ideaType>KEYWORD</ideaType><requestType>IDEAS</
requestType><paging><startIndex xmlns="https://adwords.google.com/api/
adwords/cm/v201008">0</startIndex><numberResults xmlns="https://
adwords.google.com/api/adwords/cm/v201008">10</numberResults></
paging></selector></get></soap:Body></soap:Envelope>

Response
--------

SOAPAction: ""
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Transfer-Encoding: chunked
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=UTF-8
Date: Mon, 07 Feb 2011 21:30:50 GMT
Expires: Mon, 07 Feb 2011 21:30:50 GMT
Server: GSE
TimeStamp: Mon, 07 Feb 2011 22:30:51 GMT

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/
envelope/"><soap:Header><ResponseHeader xmlns:ns2="https://
adwords.google.com/api/adwords/cm/v201008" xmlns="https://
adwords.google.com/api/adwords/o/
v201008"><ns2:requestId>3a522604b58943f4958e405efa2d2113</
ns2:requestId><ns2:operations>10</
ns2:operations><ns2:responseTime>204</ns2:responseTime><ns2:units>10</
ns2:units></ResponseHeader></soap:Header><soap:Body><getResponse
xmlns="https://adwords.google.com/api/adwords/o/v201008"
xmlns:ns2="https://adwords.google.com/api/adwords/cm/
v201008"><rval><totalNumEntries>300</
totalNumEntries><entries><data><key>KEYWORD</key><value
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="KeywordAttribute"><Attribute.Type>KeywordAttribute</
Attribute.Type><value><ns2:Criterion.Type>Keyword</
ns2:Criterion.Type><ns2:text>sample keyword 1425346868 0</
ns2:text><ns2:matchType>EXACT</ns2:matchType></value></value></
data><data><key>IDEA_TYPE</key><value xmlns:xsi="http://www.w3.org/
2001/XMLSchema-instance"
xsi:type="IdeaTypeAttribute"><Attribute.Type>IdeaTypeAttribute</
Attribute.Type><value>KEYWORD</value></value></data></
entries><entries><data><key>KEYWORD</key><value xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance"
xsi:type="KeywordAttribute"><Attribute.Type>KeywordAttribute</
Attribute.Type><value><ns2:Criterion.Type>Keyword</
ns2:Criterion.Type><ns2:text>sample keyword 1425346868 0</
ns2:text><ns2:matchType>PHRASE</ns2:matchType></value></value></
data><data><key>IDEA_TYPE</key><value xmlns:xsi="http://www.w3.org/
2001/XMLSchema-instance"
xsi:type="IdeaTypeAttribute"><Attribute.Type>IdeaTypeAttribute</
Attribute.Type><value>KEYWORD</value></value></data></
entries><entries><data><key>KEYWORD</key><value xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance"
xsi:type="KeywordAttribute"><Attribute.Type>KeywordAttribute</
Attribute.Type><value><ns2:Criterion.Type>Keyword</
ns2:Criterion.Type><ns2:text>sample keyword 1425346868 0</
ns2:text><ns2:matchType>BROAD</ns2:matchType></value></value></
data><data><key>IDEA_TYPE</key><value xmlns:xsi="http://www.w3.org/
2001/XMLSchema-instance"
xsi:type="IdeaTypeAttribute"><Attribute.Type>IdeaTypeAttribute</
Attribute.Type><value>KEYWORD</value></value></data></
entries><entries><data><key>KEYWORD</key><value xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance"
xsi:type="KeywordAttribute"><Attribute.Type>KeywordAttribute</
Attribute.Type><value><ns2:Criterion.Type>Keyword</
ns2:Criterion.Type><ns2:text>Red Herring 1</
ns2:text><ns2:matchType>EXACT</ns2:matchType></value></value></
data><data><key>IDEA_TYPE</key><value xmlns:xsi="http://www.w3.org/
2001/XMLSchema-instance"
xsi:type="IdeaTypeAttribute"><Attribute.Type>IdeaTypeAttribute</
Attribute.Type><value>KEYWORD</value></value></data></
entries><entries><data><key>KEYWORD</key><value xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance"
xsi:type="KeywordAttribute"><Attribute.Type>KeywordAttribute</
Attribute.Type><value><ns2:Criterion.Type>Keyword</
ns2:Criterion.Type><ns2:text>Red Herring 1</
ns2:text><ns2:matchType>PHRASE</ns2:matchType></value></value></
data><data><key>IDEA_TYPE</key><value xmlns:xsi="http://www.w3.org/
2001/XMLSchema-instance"
xsi:type="IdeaTypeAttribute"><Attribute.Type>IdeaTypeAttribute</
Attribute.Type><value>KEYWORD</value></value></data></
entries><entries><data><key>KEYWORD</key><value xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance"
xsi:type="KeywordAttribute"><Attribute.Type>KeywordAttribute</
Attribute.Type><value><ns2:Criterion.Type>Keyword</
ns2:Criterion.Type><ns2:text>Red Herring 1</
ns2:text><ns2:matchType>BROAD</ns2:matchType></value></value></
data><data><key>IDEA_TYPE</key><value xmlns:xsi="http://www.w3.org/
2001/XMLSchema-instance"
xsi:type="IdeaTypeAttribute"><Attribute.Type>IdeaTypeAttribute</
Attribute.Type><value>KEYWORD</value></value></data></
entries><entries><data><key>KEYWORD</key><value xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance"
xsi:type="KeywordAttribute"><Attribute.Type>KeywordAttribute</
Attribute.Type><value><ns2:Criterion.Type>Keyword</
ns2:Criterion.Type><ns2:text>sample keyword 1425346868 2</
ns2:text><ns2:matchType>EXACT</ns2:matchType></value></value></
data><data><key>IDEA_TYPE</key><value xmlns:xsi="http://www.w3.org/
2001/XMLSchema-instance"
xsi:type="IdeaTypeAttribute"><Attribute.Type>IdeaTypeAttribute</
Attribute.Type><value>KEYWORD</value></value></data></
entries><entries><data><key>KEYWORD</key><value xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance"
xsi:type="KeywordAttribute"><Attribute.Type>KeywordAttribute</
Attribute.Type><value><ns2:Criterion.Type>Keyword</
ns2:Criterion.Type><ns2:text>sample keyword 1425346868 2</
ns2:text><ns2:matchType>PHRASE</ns2:matchType></value></value></
data><data><key>IDEA_TYPE</key><value xmlns:xsi="http://www.w3.org/
2001/XMLSchema-instance"
xsi:type="IdeaTypeAttribute"><Attribute.Type>IdeaTypeAttribute</
Attribute.Type><value>KEYWORD</value></value></data></
entries><entries><data><key>KEYWORD</key><value xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance"
xsi:type="KeywordAttribute"><Attribute.Type>KeywordAttribute</
Attribute.Type><value><ns2:Criterion.Type>Keyword</
ns2:Criterion.Type><ns2:text>sample keyword 1425346868 2</
ns2:text><ns2:matchType>BROAD</ns2:matchType></value></value></
data><data><key>IDEA_TYPE</key><value xmlns:xsi="http://www.w3.org/
2001/XMLSchema-instance"
xsi:type="IdeaTypeAttribute"><Attribute.Type>IdeaTypeAttribute</
Attribute.Type><value>KEYWORD</value></value></data></
entries><entries><data><key>KEYWORD</key><value xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance"
xsi:type="KeywordAttribute"><Attribute.Type>KeywordAttribute</
Attribute.Type><value><ns2:Criterion.Type>Keyword</
ns2:Criterion.Type><ns2:text>Red Herring 3</
ns2:text><ns2:matchType>EXACT</ns2:matchType></value></value></
data><data><key>IDEA_TYPE</key><value xmlns:xsi="http://www.w3.org/
2001/XMLSchema-instance"
xsi:type="IdeaTypeAttribute"><Attribute.Type>IdeaTypeAttribute</
Attribute.Type><value>KEYWORD</value></value></data></entries></rval></
getResponse></soap:Body></soap:Envelope>
-----------------END API CALL-----------------------

AdWords API Advisor

unread,
Feb 9, 2011, 1:57:44 PM2/9/11
to AdWords API Forum
Hi,

Your code example is just fine, but you need to send your request to
the production server (https://adwords.google.com) instead of sending
it to the sandbox (https://adwords-sandbox.google.com). The
TargetingIdeaService will only give you test results in the sandbox.

Cheers,
Anash P. Oommen,
AdWords API Advisor.
> adwords.google.com/api/adwords/cm/v201008">client_1+mym...@onet.eu</
> entries><entries><data><key>KEYWORD</key><value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:type="KeywordAttribute"><Attribute.Type>KeywordAttribute</
> Attribute.Type><value><ns2:Criterion.Type>Keyword</
> ns2:Criterion.Type><ns2:text>sample keyword 1425346868 0</
> ns2:text><ns2:matchType>PHRASE</ns2:matchType></value></value></
> data><data><key>IDEA_TYPE</key><value xmlns:xsi="http://www.w3.org/
> 2001/XMLSchema-instance"
> xsi:type="IdeaTypeAttribute"><Attribute.Type>IdeaTypeAttribute</
> Attribute.Type><value>KEYWORD</value></value></data></
> entries><entries><data><key>KEYWORD</key><value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:type="KeywordAttribute"><Attribute.Type>KeywordAttribute</
> Attribute.Type><value><ns2:Criterion.Type>Keyword</
> ns2:Criterion.Type><ns2:text>sample keyword 1425346868 0</
> ns2:text><ns2:matchType>BROAD</ns2:matchType></value></value></
> data><data><key>IDEA_TYPE</key><value xmlns:xsi="http://www.w3.org/
> 2001/XMLSchema-instance"
> xsi:type="IdeaTypeAttribute"><Attribute.Type>IdeaTypeAttribute</
> Attribute.Type><value>KEYWORD</value></value></data></
> entries><entries><data><key>KEYWORD</key><value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:type="KeywordAttribute"><Attribute.Type>KeywordAttribute</
> Attribute.Type><value><ns2:Criterion.Type>Keyword</
> ns2:Criterion.Type><ns2:text>Red Herring 1</
> ns2:text><ns2:matchType>EXACT</ns2:matchType></value></value></
> data><data><key>IDEA_TYPE</key><value xmlns:xsi="http://www.w3.org/
> 2001/XMLSchema-instance"
> xsi:type="IdeaTypeAttribute"><Attribute.Type>IdeaTypeAttribute</
> Attribute.Type><value>KEYWORD</value></value></data></
> entries><entries><data><key>KEYWORD</key><value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:type="KeywordAttribute"><Attribute.Type>KeywordAttribute</
> Attribute.Type><value><ns2:Criterion.Type>Keyword</
> ns2:Criterion.Type><ns2:text>Red Herring 1</
> ns2:text><ns2:matchType>PHRASE</ns2:matchType></value></value></
> data><data><key>IDEA_TYPE</key><value xmlns:xsi="http://www.w3.org/
> 2001/XMLSchema-instance"
> xsi:type="IdeaTypeAttribute"><Attribute.Type>IdeaTypeAttribute</
> Attribute.Type><value>KEYWORD</value></value></data></
> entries><entries><data><key>KEYWORD</key><value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:type="KeywordAttribute"><Attribute.Type>KeywordAttribute</
> Attribute.Type><value><ns2:Criterion.Type>Keyword</
> ns2:Criterion.Type><ns2:text>Red Herring 1</
> ns2:text><ns2:matchType>BROAD</ns2:matchType></value></value></
> data><data><key>IDEA_TYPE</key><value xmlns:xsi="http://www.w3.org/
> 2001/XMLSchema-instance"
> xsi:type="IdeaTypeAttribute"><Attribute.Type>IdeaTypeAttribute</
> Attribute.Type><value>KEYWORD</value></value></data></
> entries><entries><data><key>KEYWORD</key><value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:type="KeywordAttribute"><Attribute.Type>KeywordAttribute</
> Attribute.Type><value><ns2:Criterion.Type>Keyword</
> ns2:Criterion.Type><ns2:text>sample keyword 1425346868 2</
> ns2:text><ns2:matchType>EXACT</ns2:matchType></value></value></
> data><data><key>IDEA_TYPE</key><value xmlns:xsi="http://www.w3.org/
> 2001/XMLSchema-instance"
> xsi:type="IdeaTypeAttribute"><Attribute.Type>IdeaTypeAttribute</
> Attribute.Type><value>KEYWORD</value></value></data></
> entries><entries><data><key>KEYWORD</key><value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:type="KeywordAttribute"><Attribute.Type>KeywordAttribute</
> Attribute.Type><value><ns2:Criterion.Type>Keyword</
> ns2:Criterion.Type><ns2:text>sample keyword 1425346868 2</
> ns2:text><ns2:matchType>PHRASE</ns2:matchType></value></value></
> data><data><key>IDEA_TYPE</key><value xmlns:xsi="http://www.w3.org/
> 2001/XMLSchema-instance"
> xsi:type="IdeaTypeAttribute"><Attribute.Type>IdeaTypeAttribute</
> Attribute.Type><value>KEYWORD</value></value></data></
> entries><entries><data><key>KEYWORD</key><value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:type="KeywordAttribute"><Attribute.Type>KeywordAttribute</
> Attribute.Type><value><ns2:Criterion.Type>Keyword</
> ns2:Criterion.Type><ns2:text>sample keyword 1425346868 2</
> ns2:text><ns2:matchType>BROAD</ns2:matchType></value></value></
> data><data><key>IDEA_TYPE</key><value xmlns:xsi="http://www.w3.org/
> 2001/XMLSchema-instance"
> xsi:type="IdeaTypeAttribute"><Attribute.Type>IdeaTypeAttribute</
> Attribute.Type><value>KEYWORD</value></value></data></
> entries><entries><data><key>KEYWORD</key><value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:type="KeywordAttribute"><Attribute.Type>KeywordAttribute</
> Attribute.Type><value><ns2:Criterion.Type>Keyword</
Reply all
Reply to author
Forward
0 new messages