Hi Eric,

I am using awapi_python_lib_7.2.0 for python. It works fine for
posting keywords where I don't set 'negative': True.

The method looks like this
============BEGIN CODE
    def add_keywords(self, ad_group_id, keyword_list, match_type):
        neg_criteria = []
        print match_type
        if match_type == mt_broad:
            one_type = 'Broad'
            neg_criteria.extend([{'negative': True,
                                  'adGroupId':ad_group_id,
                                  'text':x,
                                  'type':'Phrase'} for x in
keyword_list.keys()])
            neg_criteria.extend([{'negative': True,
                                  'adGroupId':ad_group_id,
                                  'text':x,
                                  'type':'Exact'} for x in
keyword_list.keys()])
        elif match_type == mt_phrase:
            one_type = 'Phrase'
            neg_criteria.extend([{'negative': True,
                                  'adGroupId':ad_group_id,
                                  'text':x,
                                  'type':'Exact'} for x in
keyword_list.keys()])
        elif match_type == mt_exact:
            one_type = 'Exact'


        criteria = [{'adGroupId':ad_group_id,
                     'criterionType':'Keyword',
                     'destinationUrl':v['keyword_url'],
                     'maxCpc': str(round_micro_to_cent(v
['keyword_max_cpc'])),
                     'text':x,
                     'type':one_type,
                     } for x,v in keyword_list.items()]
        criteria.extend(neg_criteria)
        res = self._criterion_service.AddCriteria(criteria)

        return res
==================END CODE

keyword_list is a dictionary that looks something like this:
=============BEGIN DICT
{
              'race ny': {'keyword_id': 4604L,
                          'keyword_max_cpc': '175000',
                          'keyword_url': 'http://qwobl.com/<SNIP>
0f9e8%26sid%3Dqwobl_google_3019&dkw=x',
                          'match_type': 'http://sem.rdf.qwobl.com/
matchtype/phrase#phrase'},
              'race ny tickets': {'keyword_id': 4622L,
                                  'keyword_max_cpc': '245000',
                                  'keyword_url': 'http://qwobl.com/
<SNIP>',
                                  'match_type': 'http://
sem.rdf.qwobl.com/matchtype/phrase#phrase'}
}
=============END DICT

_criterion_service is defined like this:
===============BEGIN CODE
        self._apiclient = Client(path=config.google.pickle_path)
        self._criterion_service = self._apiclient.GetCriterionService
('https://sandbox.google.com')
===============END CODE

Thanks for your help!

-Travis

On Nov 16, 11:06 am, AdWords API Advisor
<[email protected]> wrote:
> Hi Travis,
>
> Are you using a client library for these requests?  If so, which
> language and version?  What does the code look like that leads to this
> error?
>
> Best,
> - Eric Koleda, AdWords API Team
>
> On Nov 13, 10:22 am, Travis B <[email protected]> wrote:
>
> > Hi,
>
> > I'm trying to set negative criteria for an adgroup (along with non-
> > negative ones) in a call to CriterionService.AddCriteria. I get the
> > following error message:
>
> > aw_api.Errors.ValidationError: Given API version, v13, is not
> > compatible with 'Phrase' class.
>
> > However the error appears for every value of Keyword type ('Broad',
> > 'Phrase' and 'Exact'). Can I simply not set ad group negative criteria
> > in version 13 of the API?
>
> > Thanks,
> > -Travis

--

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=.


Reply via email to