Helo Danial, thanks for the answer!
First of all I'm coding in C sharp. I want simply to get some keywords 
ideas using Adwords service when a button in my GUI is clicked. I used the 
code provided by the sample "GetKeywordsIdeas.cs" 
(here<http://code.google.com/p/google-api-adwords-dotnet/source/browse/trunk/examples/adwords/csharp/v201109/Optimization/GetKeywordIdeas.cs>)
 
but my application closes when the get method of TargetingIdeaService is 
called.
Here there's my code(it's the same of the sample):

        private void keywordButton_Click(object sender, EventArgs e)
        {
            AdWordsUser user = new AdWordsUser();
            // Get the TargetingIdeaService.
            TargetingIdeaService targetingIdeaService =
                
(TargetingIdeaService)user.GetService(AdWordsService.v201109.TargetingIdeaService);

            string keywordText = "mars cruise";

            // Create seed keyword.
            Keyword keyword = new Keyword();
            keyword.text = keywordText;
            keyword.matchType = KeywordMatchType.BROAD;

            // Create the selector.
            TargetingIdeaSelector selector = new TargetingIdeaSelector();
            selector.requestType = RequestType.IDEAS;
            selector.ideaType = IdeaType.KEYWORD;
            selector.requestedAttributeTypes = new AttributeType[] 
{AttributeType.CRITERION,
          AttributeType.AVERAGE_TARGETED_MONTHLY_SEARCHES};

            // Create related to keyword search parameter.
            RelatedToKeywordSearchParameter relatedToKeywordSearchParameter 
=
                new RelatedToKeywordSearchParameter();
            relatedToKeywordSearchParameter.keywords = new Keyword[] { 
keyword };

            // Create keyword match type search parameter to ensure unique 
results.
            KeywordMatchTypeSearchParameter keywordMatchTypeSearchParameter 
=
                new KeywordMatchTypeSearchParameter();
            keywordMatchTypeSearchParameter.keywordMatchTypes = new 
KeywordMatchType[] {
          KeywordMatchType.BROAD};

            selector.searchParameters =
                new SearchParameter[] { relatedToKeywordSearchParameter, 
keywordMatchTypeSearchParameter };

            // Set selector paging.
            selector.paging = new Paging();

            int offset = 0;
            int pageSize = 500;

            TargetingIdeaPage page = new TargetingIdeaPage();

            try
            {
                do
                {
                    selector.paging.startIndex = offset;
                    selector.paging.numberResults = pageSize;

                    // Get related keywords.
                    page = targetingIdeaService.get(selector);  // Here my 
application closes

                    // Display the results.
                    if (page != null && page.entries != null)
                    {
                        int i = offset;
                        foreach (TargetingIdea idea in page.entries)
                        {
                            foreach (Type_AttributeMapEntry entry in 
idea.data)
                            {
                                if (entry.key == AttributeType.CRITERION)
                                {
                                    CriterionAttribute kwdAttribute = 
entry.value as CriterionAttribute;
                                    Keyword relatedKeyword = 
(Keyword)kwdAttribute.value;
                                    Console.Out.WriteLine("{0}) Related 
keyword with text = '{0}' and match type = " +
                                        "'{1}' was found.", 
relatedKeyword.text, relatedKeyword.matchType);
                                }
                            }
                        }
                        i++;
                    }
                    offset += pageSize;
                } while (offset < page.totalNumEntries);
                Console.Out.WriteLine("Number of related keywords found: 
{0}", page.totalNumEntries);
            }
            catch (Exception ex)
            {
                throw new System.ApplicationException("Failed to retrieve 
related keywords.", ex);
            }
        }

Please help me, I'm a newbie :)
Thanks in advance

Il giorno lunedì 9 aprile 2012 17:19:56 UTC+2, Danial Klimkin ha scritto:
>
> Hello Angelo,
>
>
> Please see out examples for sample code. For example, for java you can 
> find it here:
>
>   
> http://code.google.com/p/google-api-adwords-java/source/browse/trunk/examples/v201109/GetRelatedKeywords.java
>
> See this page for the list of the libraries:
>
>   http://code.google.com/apis/adwords/docs/clientlibraries.html
>
>
> -Danial, AdWords API Team.
>
> On Tuesday, April 3, 2012 11:01:25 PM UTC+4, Angelo Santoro wrote:
>>
>> Hi guys, it's the first time that I use Adwords API and I need a little 
>> help.
>> I'd like to get a list of keyword ideas using this service 
>> https://adwords.google.it/o/Targeting/Explorer?__c=6000659957&__u=5558715197&__o=cues&ideaRequestType=KEYWORD_IDEAS...
>>  and I'd like to save the first 50 results in a .txt .. can u help me 
>> please?
>> Thanks in advance
>>
>

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en

Reply via email to