Hi Ben.

the issue here is that one of the AdGroupCriterion in your request needs to 
> have a case_value field that is not set

Sorry, but I thought I already tried that. Here are my protobuf messages 
and 
responses https://groups.google.com/d/msg/adwords-api/MKoKH8xVn-k/0q3JVm2nAgAJ 
(I don't have a lot of experiences with Google Groups so I hope that tрe 
link will be correct. In case it is not, this is the link to my 3rd message 
in this thread from August 20th)
First 2 attempts in this message are errors which I get if I try to use 
`listing_custom_attribute` 
without `index` field. In the 3rd attempt I tried to use `listing_brand` 
field to match the Java examples from Bharani's messages. But still I've 
got an error.

it's not very clear on how to do that in the Python 

In order to set empty protobuf message I just use these methods:
SetInParent 
<https://developers.google.com/protocol-buffers/docs/reference/python/google.protobuf.message.Message-class.html#SetInParent>
, ClearField 
<https://developers.google.com/protocol-buffers/docs/reference/python/google.protobuf.message.Message-class.html#ClearField>
 and 
the like. For example:
ad_group_criterion.listing_group.case_value.listing_brand.SetInParent()

This set of documentation 
> <https://developers.google.com/google-ads/api/docs/client-libs/python/empty-message-fields>
>  shows 
> how to set an empty message field in Python.
>
Just to be sure, if my string representations of protobuf messages (which 
I've been posting in previous messages) are correct, then the protobuf 
messages they were created from are also correct. Right? I mean, is it 
possible that I am somehow creating incorrect messages which are causing 
the error but still getting correct string representation? 
For example, I didn't use `CopyFrom` to create messages, I am creating them 
using this code:
ad_group_criterion_operation = client.get_service('
AdGroupCriterionOperation',  version=GADS_API_V)
ad_group_criterion = ad_group_criterion_operation.create
and then just filling value of the `ad_group_criterion` using standard 
protobuf methods.



On Thursday, August 22, 2019 at 2:31:47 AM UTC+3, adsapiforumadvisor wrote:
>
> Hi Inillien - 
>
> Thanks for this question and for sending over all of this detailed 
> information. I'm the maintainer of our Python client library so should be 
> able to help with this issue. Unfortunately we don't have an example for 
> adding a product listing group tree in Python, but that will hopefully 
> change soon.
>
> I believe the issue here is that one of the AdGroupCriterion in your 
> request needs to have a case_value field that is not set. The problem is 
> it's not very clear on how to do that in the Python interface for Protobuf 
> message classes because it seems like the only way to add a field to a 
> message is to give it a value.
>
> If you look closely at the request Bharani shared you'll noticed that one 
> of the criterion has a listing group with a case_value that looks like this:
>
> case_value {
>     product_condition {
>     }
> }
>
> That represents an empty case_value field.
>
> This set of documentation 
> <https://developers.google.com/google-ads/api/docs/client-libs/python/empty-message-fields>
>  
> shows how to set an empty message field in Python. On one of your 
> AdGroupCriterion objects you'll need to do something like this: 
>
> ad_group_criterion.listing_group.case_value.CopyFrom(client.get_type('ListingDimensionInfo'))
> Hope this helps, please let me know if you have any further questions.
>
> Best,
> Ben Karl, Google Ads API Team
>
>
>
> ref:_00D1U1174p._5001UEJA9R:ref

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads 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
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/bc43b02d-b8ff-47af-93b4-56c0163adc2c%40googlegroups.com.

Reply via email to