So I believe, I'm getting very close but now I'm stuck again.

This is my JSON:
{
    "operations": [

        {
            "create": {
                "type": "LISTING_GROUP",
                "status":"ENABLED",
                "adGroup": "customers/7803661715/adGroups/151093305002",
                
"resourceName":"customers/7803661715/adGroups/151093305002~-1",
                "listingGroup": {
                    "type": "SUBDIVISION"
                }
            }
        },


        {
            "create": {
                "type": "LISTING_GROUP",
                "status": "ENABLED",
                "adGroup": "customers/7803661715/adGroups/151093305002",
                "cpcBidMicros": "10000",
                "listingGroup": {
                    "type": "UNIT",
                    "caseValue": {
                        "productItemId": {}
                    },
                    "parentAdGroupCriterion": 
"customers/7803661715/adGroups/151093305002~-1"
                }

            }
        },


        {
            "create": {
                "type": "LISTING_GROUP",
                "status": "ENABLED",
                "adGroup": "customers/7803661715/adGroups/151093305002",
                "cpcBidMicros": "10000",
                "listingGroup": {
                    "type": "UNIT",
                    "caseValue": {
                        "productItemId": {
                            "value": 
"shopify_fr_8211946045734_4473156881642"
                        }
                    },
                    "parentAdGroupCriterion": 
"customers/7803661715/adGroups/151093305002~-1"  
                }
            }
        }
    ]
}
######################################
######################################
######################################

Now I'm getting:
*◉ Resource name 'customers/7803661715/adGroups/151093305002~-1' is 
malformed: expected 
'customers/{customer_id}/adGroupCriteria/{ad_group_id}~{criterion_id}'. *

I've seen multiple posts where people would use the* "~-1" *trick while 
doing multiple operations at once but it was always in a different language 
(Java, Python etc.). 

How can I replicate the "~-1" the trick in the rest API? I see no mentions 
in the REST documentation.

I've also tried running the first operation to create root (the SUBDIVISION 
part in my code) to get the parentAdGroupCriterion for the two remaining 
*create 
*operations but that's not working either. When creating the SUBDIVISION, 
I'm getting error an error saying that "other group must be created" so it 
feels like I really need to do everything in one API call. 

DZ




On Tuesday, May 23, 2023 at 11:16:20 PM UTC+2 ma...@danzrust.cz wrote:

> So I believe I'm getting close after recycling some of the older posts but 
> something is still wrong.
>
> Here is my currrent JSON:
>
> {
>     "operations": [
>         {
>             "create": {
>                 "type": "LISTING_GROUP",
>                 "status": "ENABLED",
>                 "adGroup": "customers/7803661715 <(780)%20366-1715>
> /adGroups/149870319335",
>                 "resourceName": "customers/7803661715 <(780)%20366-1715>
> /adGroups/149870319335~-1",
>                 "listingGroup": {
>                     "type": "SUBDIVISION"
>                 }
>             }
>         },
>
>         {
>             "create": {
>                 "type": "LISTING_GROUP",
>                 "status": "ENABLED",
>                 "adGroup": "customers/7803661715 <(780)%20366-1715>
> /adGroups/149870319335",
>                 "cpcBidMicros": "10000",
>                 "listingGroup": {
>                     "type": "UNIT",
>                     "caseValue": {
>                         "productItemId": {
>                             "value": 
> "shopify_fr_8211946045734_4473156881642"
>                         }
>                     },
>                     "parentAdGroupCriterion": "customers/7803661715 
> <(780)%20366-1715>/adGroups/149870319335~-1"
>                 }
>             }
>         },
>
>         {
>             "create": {
>                 "type": "LISTING_GROUP",
>                 "status": "ENABLED",
>                 "adGroup": "customers/7803661715 <(780)%20366-1715>
> /adGroups/149870319335",
>                 "cpcBidMicros": "10000",
>                 "listingGroup": {
>                     "type": "UNIT",
>                     "caseValue": {
>                         "productCondition": {}
>                     }
>                 },
>                 "parentAdGroupCriterion": "customers/7803661715 
> <(780)%20366-1715>/adGroups/149870319335~-1"
>             }
>         }
>     ]
> }
>
>
> ==> My understanding is that first I need to create a subdivision and then 
> create the one product I want to have + all other products, however when I 
> ran this JSON,  I've been getting:
>
> {
>     "error": {
>         "code": 400,
>         "message": "Invalid JSON payload received. Unknown name 
> \"parentAdGroupCriterion\" at 'operations[2].create': Cannot find field.",
>         "status": "INVALID_ARGUMENT",
>         "details": [
>             {
>                 "@type": "type.googleapis.com/google.rpc.BadRequest",
>                 "fieldViolations": [
>                     {
>                         "field": "operations[2].create",
>                         "description": "Invalid JSON payload received. 
> Unknown name \"parentAdGroupCriterion\" at 'operations[2].create': Cannot 
> find field."
>                     }
>                 ]
>             }
>         ]
>     }
> }
>
>
> ################
>
> Any ideas?
>
> DZ
> On Tuesday, May 23, 2023 at 8:57:48 PM UTC+2 ma...@danzrust.cz wrote:
>
>> Hi guys,
>> I'm trying to create new single product listing groups via Rest API but 
>> I'm just stuck - I don't know what mandatory information I need to provide. 
>>
>> At this point, I am creating a new *ad_group_criterion:*
>> POST 
>> https://googleads.googleapis.com/v12/customers/7803661715/adGroupCriteria:mutate
>>
>> {
>>     "operations": [
>>         {
>>             "create": {
>>                 "type": "LISTING_GROUP",
>>                 "status": "ENABLED",
>>                 "ad_group": "customers/7803661715 <(780)%20366-1715>
>> /adGroups/149520355436",
>>                 "cpc_bid_micros": 1000,
>>                 "listing_group": {
>>                     "case_value": {
>>                         "product_item_id": {
>>                             "value": 
>> "shopify_fr_8211946045734_4473156881642"
>>                         }
>>                     }
>>                 }
>>             }
>>         }
>>     ]
>> }
>>
>> And I keep get back
>> {
>>     "type": "error",
>>     "array": "INVALID_ARGUMENT (400) Request contains an invalid 
>> argument. \n◉ The required field was not present."
>> }
>>
>> Basically, my goal is to create the hierarchy shown in the attachment. 
>>
>> Cam you pls advise?
>>
>>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 
"Google Ads API and AdWords 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/94cf58af-8df4-4a1c-aee0-c26174883f71n%40googlegroups.com.
  • Cr... ma...@danzrust.cz
    • ... ma...@danzrust.cz
      • ... ma...@danzrust.cz
        • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum
          • ... ma...@danzrust.cz
        • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum
          • ... ma...@danzrust.cz
            • ... ma...@danzrust.cz
              • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum
                • ... ma...@danzrust.cz
                • ... Punit Pushkar

Reply via email to