Hi Shreya,
The requested IDs are now published
at
https://developers.google.com/adwords/api/docs/appendix/codes-formats#income-ranges.
Let me know if that works for you.
Cheers
Anash P. Oommen,
AdWords API Advisor.
On Tuesday, January 2, 2018 at 11:47:59 PM UTC-5, Shreya Dama wrote:
>
> *My code :*
>
> from googleads import adwords
>
> ADGROUP_ID = 'xxxxxxxxxxxxx'
>
> def main(client, adgroup_id):
> adgroup_criterion_service = client.GetService(
> 'AdGroupCriterionService', version='v201710')
>
> income = {
> 'xsi_type': 'NegativeAdGroupCriterion',
> 'adGroupId': adgroup_id,
> 'criterion': {
> 'xsi_type': 'IncomeRange',
> 'incomeRangeType':'INCOME_RANGE_70_80'
> #'id':i
> }}
>
> # Construct operations and add ad group criteria.
> operations = [
> {
> 'operator': 'ADD',
> 'operand': income
> }
> ]
> ad_group_criteria = adgroup_criterion_service.mutate(
> operations)['value']
>
> for response in ad_group_criteria['value']:
> print ('campaign criterion with campaign ID %s and ID "%s" '
> 'type "%s" was added.' %
> (response['campaignId'],
> response['criterion']['id'],
> response['criterion']['incomeRangeType']))
>
> if __name__ == '__main__':
> adwords_client = adwords.AdWordsClient.LoadFromStorage()
>
> main(adwords_client, ADGROUP_ID)
>
> *The response i Get is:*
>
> Response summary - {'operations': 1, 'serviceName':
> AdGroupCriterionService, 'faultMessage': '[RequiredError.REQUIRED @
> operations[0].operand.criterion.id]', 'responseTime': 236, 'requestId':
> 000561d7e03503f80a622745910dd0b1, 'methodName': mutate, 'isFault': True}
>
> Traceback (most recent call last):
>
>
> File "<ipython-input-1-2565dba4436a>", line 1, in <module>
>
> runfile('/xxxxxxx/income range.py', wdir='/xxxxxxx')
>
>
> File
> "/xxxxxxx/lib/python3.5/site-packages/spyder/utils/site/sitecustomize.py",
> line 866, in runfile
>
> execfile(filename, namespace)
>
>
> File
> "/xxxxxxx/lib/python3.5/site-packages/spyder/utils/site/sitecustomize.py",
> line 102, in execfile
>
> exec(compile(f.read(), filename, 'exec'), namespace)
>
>
> File "/xxxxxxx/income range.py", line 45, in <module>
>
> main(adwords_client, ADGROUP_ID)
>
>
> File "/xxxxxxx/income range.py", line 33, in main
>
> operations)['value']
>
>
> File "/xxxxxxx/.local/lib/python3.5/site-packages/googleads/common.py",
> line 767, in MakeSoapRequest
>
> self._packer) for arg in args])
>
>
> File "/xxxxxxx/.local/lib/python3.5/site-packages/suds/client.py", line
> 521, in __call__
>
> return client.invoke(args, kwargs)
>
>
> File "/xxxxxxx/.local/lib/python3.5/site-packages/suds/client.py", line
> 581, in invoke
>
> result = self.send(soapenv)
>
>
> File "/xxxxxxx/.local/lib/python3.5/site-packages/suds/client.py", line
> 619, in send
>
> description=tostr(e), original_soapenv=original_soapenv)
>
>
> File "/xxxxxxx/.local/lib/python3.5/site-packages/suds/client.py", line
> 670, in process_reply
>
> raise WebFault(fault, replyroot)
>
>
> WebFault: Server raised fault: '[RequiredError.REQUIRED @ operations[0].
> operand.criterion.id]'
>
>
>
>
> On Thursday, December 28, 2017 at 1:53:00 PM UTC+5:30, Shreya Dama wrote:
>>
>> When I use Google Adwords to target IncomeRange, I got an error saying
>> "*criterion
>> ID required*", but there are no constant codes for IncomeRange. Could
>> you please help me with it.
>>
>> Thanks in advance.
>>
>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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
---
You received this message because you are subscribed to the Google Groups
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/036099ba-dc11-475e-b446-8c36a6165138%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.