AdWordsUser user = new AdWordsUser();
TargetingIdeaService targetingIdeaService =
(TargetingIdeaService)user.GetService(AdWordsService.v200909.TargetingIdeaService);
int counter = tbKeyWordList.Lines.Length ;
Keyword[] kwa = new Keyword[counter];
for (int a = 0; a < counter; a++)
{
if (!string.IsNullOrEmpty(tbKeyWordList.Lines[a]))
{
kwa[a] = new Keyword();
kwa[a].text = tbKeyWordList.Lines[a].ToString();
kwa[a].matchType = KeywordMatchType.EXACT;
kwa[a].matchTypeSpecified = true;
}
}
//Create Target language for search stats
LanguageTarget lt = new LanguageTarget();
lt.languageCode = "en";
CountryTarget ct = new CountryTarget();
ct.countryCode = "US";
//create selector
TargetingIdeaSelector selector = new
TargetingIdeaSelector();
selector.requestType = RequestType.STATS;
selector.ideaType = IdeaType.KEYWORD;
selector.localeCode = "en_US";
selector.currencyCode = "USD";
selector.ideaTypeSpecified = true;
selector.requestedAttributeTypes = new AttributeType[]
{
AttributeType.KEYWORD,
AttributeType.COMPETITION,
AttributeType.TARGETED_MONTHLY_SEARCHES,
AttributeType.AVERAGE_TARGETED_MONTHLY_SEARCHES,
AttributeType.GLOBAL_MONTHLY_SEARCHES,
};
// Set selector paging (required for targeting idea
serivce).
Paging paging = new Paging();
paging.startIndex = 0;
paging.numberResults = 1;
paging.numberResultsSpecified = true;
selector.pa[TargetingIdeaError.INVALID_SEARCH_PARAMETERS @
selector.selector.searchParameters[0];
trigger:'LanguageTargetSearchParameter'; errorDetails:Unsupported
RequestType: null, TargetingIdeaError.INVALID_SEARCH_PARAMETERS @
selector.selector.searchParameters[1];
trigger:'ServerRelatedToKeywordSearchParameter';
errorDetails:Unsupported RequestType: null,
TargetingIdeaError.INVALID_SEARCH_PARAMETERS @
selector.selector.searchParameters[2];
trigger:'CountryTargetSearchParameter'; errorDetails:Unsupported
RequestType: null, RequiredError.REQUIRED @ selector.requestType,
NotEmptyError.EMPTY_LIST @ selector.searchParameters[1].keywords]ging
= paging;
soap error
-----------------BEGIN API CALL---------------------
Request
-------
POST /api/adwords/o/v200909/TargetingIdeaService
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client
Protocol 2.0.50727.3603)
VsDebuggerCausalityData:
uIDPo19pfHDX7AJIhbghnE3WGb0AAAAA5LRaXY1LKkiFIsXmlXvri0kH3T32iAhKp2SYyc2pngAACQAA
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
Host: adwords.google.com
Content-Length: 2032
Accept-Encoding: gzip
Connection: Keep-Alive
<?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/v200909"><authToken xmlns="https://
adwords.google.com/api/adwords/cm/v200909">********</
authToken><clientEmail xmlns="https://adwords.google.com/api/adwords/
cm/v200909">[email protected]</clientEmail><developerToken
xmlns="https://adwords.google.com/api/adwords/cm/
v200909">********tzww</developerToken><userAgent xmlns="https://
adwords.google.com/api/adwords/cm/v200909">AWAPI DotNetLib 9.0.0 - not
any </userAgent></RequestHeader></soap:Header><soap:Body><get
xmlns="https://adwords.google.com/api/adwords/o/
v200909"><selector><searchParameters
xsi:type="RelatedToKeywordSearchParameter" /><searchParameters
xsi:type="LanguageTargetSearchParameter"><languageTargets><languageCode
xmlns="https://adwords.google.com/api/adwords/cm/v200909">en</
languageCode></languageTargets></searchParameters><searchParameters
xsi:type="CountryTargetSearchParameter"><countryTargets><countryCode
xmlns="https://adwords.google.com/api/adwords/cm/v200909">US</
countryCode></countryTargets></searchParameters><ideaType>KEYWORD</
ideaType><requestedAttributeTypes>KEYWORD</
requestedAttributeTypes><requestedAttributeTypes>COMPETITION</
requestedAttributeTypes><requestedAttributeTypes>TARGETED_MONTHLY_SEARCHES</
requestedAttributeTypes><requestedAttributeTypes>AVERAGE_TARGETED_MONTHLY_SEARCHES</
requestedAttributeTypes><requestedAttributeTypes>GLOBAL_MONTHLY_SEARCHES</
requestedAttributeTypes><paging><numberResults xmlns="https://
adwords.google.com/api/adwords/cm/v200909">1</numberResults></
paging><localeCode>en_US</localeCode><currencyCode>USD</currencyCode></
selector></get></soap:Body></soap:Envelope>
Response
--------
Content-Encoding:
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=UTF-8
Date: Tue, 06 Jul 2010 20:36:52 GMT
Expires: Tue, 06 Jul 2010 20:36:52 GMT
Server: GSE
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/
envelope/"><soap:Header><ns2:ResponseHeader xmlns:ns2="https://
adwords.google.com/api/adwords/o/v200909" xmlns="https://
adwords.google.com/api/adwords/cm/
v200909"><requestId>32835f6e3d8fcf3a9ef2d87d189cf99f</
requestId><operations>1</operations><responseTime>126</
responseTime><units>6</units></ns2:ResponseHeader></
soap:Header><soap:Body><soap:Fault><faultcode>soap:Server</
faultcode><faultstring>[TargetingIdeaError.INVALID_SEARCH_PARAMETERS @
selector.selector.searchParameters[0];
trigger:'LanguageTargetSearchParameter'; errorDetails:Unsupported
RequestType: null, TargetingIdeaError.INVALID_SEARCH_PARAMETERS @
selector.selector.searchParameters[1];
trigger:'ServerRelatedToKeywordSearchParameter';
errorDetails:Unsupported RequestType: null,
TargetingIdeaError.INVALID_SEARCH_PARAMETERS @
selector.selector.searchParameters[2];
trigger:'CountryTargetSearchParameter'; errorDetails:Unsupported
RequestType: null, RequiredError.REQUIRED @ selector.requestType,
NotEmptyError.EMPTY_LIST @ selector.searchParameters[1].keywords]</
faultstring><detail><ns2:ApiExceptionFault xmlns="https://
adwords.google.com/api/adwords/cm/v200909" xmlns:ns2="https://
adwords.google.com/api/adwords/o/
v200909"><message>[TargetingIdeaError.INVALID_SEARCH_PARAMETERS @
selector.selector.searchParameters[0];
trigger:'LanguageTargetSearchParameter'; errorDetails:Unsupported
RequestType: null, TargetingIdeaError.INVALID_SEARCH_PARAMETERS @
selector.selector.searchParameters[1];
trigger:'ServerRelatedToKeywordSearchParameter';
errorDetails:Unsupported RequestType: null,
TargetingIdeaError.INVALID_SEARCH_PARAMETERS @
selector.selector.searchParameters[2];
trigger:'CountryTargetSearchParameter'; errorDetails:Unsupported
RequestType: null, RequiredError.REQUIRED @ selector.requestType,
NotEmptyError.EMPTY_LIST @ selector.searchParameters[1].keywords]</
message><ApplicationException.Type>ApiException</
ApplicationException.Type><errors xmlns:xsi="http://www.w3.org/2001/
XMLSchema-instance"
xsi:type="ns2:TargetingIdeaError"><fieldPath>selector.selector.searchParameters[0]</
fieldPath><trigger>LanguageTargetSearchParameter</
trigger><ApiError.Type>TargetingIdeaError</
ApiError.Type><ns2:reason>INVALID_SEARCH_PARAMETERS</ns2:reason></
errors><errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="ns2:TargetingIdeaError"><fieldPath>selector.selector.searchParameters[1]</
fieldPath><trigger>ServerRelatedToKeywordSearchParameter</
trigger><ApiError.Type>TargetingIdeaError</
ApiError.Type><ns2:reason>INVALID_SEARCH_PARAMETERS</ns2:reason></
errors><errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="ns2:TargetingIdeaError"><fieldPath>selector.selector.searchParameters[2]</
fieldPath><trigger>CountryTargetSearchParameter</
trigger><ApiError.Type>TargetingIdeaError</
ApiError.Type><ns2:reason>INVALID_SEARCH_PARAMETERS</ns2:reason></
errors><errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="RequiredError"><fieldPath>selector.requestType</
fieldPath><trigger></trigger><ApiError.Type>RequiredError</
ApiError.Type><reason>REQUIRED</reason></errors><errors
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="NotEmptyError"><fieldPath>selector.searchParameters[1].keywords</
fieldPath><trigger></trigger><ApiError.Type>NotEmptyError</
ApiError.Type><reason>EMPTY_LIST</reason></errors></
ns2:ApiExceptionFault></detail></soap:Fault></soap:Body></
soap:Envelope>
-----------------END API CALL-----------------------
my goal is to provide a list of keywords and get keyword variation for
each and number of targeted local monthly search.
//Create LanguageTargetSearchParameter
LanguageTargetSearchParameter oLTSP = new
LanguageTargetSearchParameter();
oLTSP.languageTargets = new LanguageTarget[] { lt };
oLTSP.SearchParameterType = null; //this may need to be
null
//Create CountryTargetSearchParameter
CountryTargetSearchParameter oCTSP = new
CountryTargetSearchParameter();
oCTSP.countryTargets = new CountryTarget[] { ct };
oCTSP.SearchParameterType = null; //this may need to be
null
// Create related to keyword search parameter.
RelatedToKeywordSearchParameter
relatedToKeywordSearchParameter = new
RelatedToKeywordSearchParameter();
relatedToKeywordSearchParameter.keywords = kwa;
selector.searchParameters = new SearchParameter[]
{ relatedToKeywordSearchParameter, oLTSP, oCTSP };
//NOW GET THE STUFF
TargetingIdeaPage page =
targetingIdeaService.get(selector);
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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