Field 'resource_name' cannot be modified by 'CREATE' operation

41 views
Skip to first unread message

Брат Серёга

unread,
Jun 25, 2019, 6:15:46 AM6/25/19
to AdWords API and Google Ads API Forum
I try to create campaign with GoogleAdsService.Mutate and mutations like these:
[
 
{
   
"Operation": {
     
"CampaignBudgetOperation": {
       
"Operation": {
         
"Create": {
           
"resource_name": "customers/809xxxx186/campaignBudgets/-1",
           
"amount_micros": {
             
"value": 100500000
           
},
           
"delivery_method": 2,
           
"explicitly_shared": {},
           
"period": 2,
           
"type": 2
         
}
       
}
     
}
   
}
 
},
 
{
   
"Operation": {
     
"LabelOperation": {
       
"Operation": {
         
"Create": {
           
"resource_name": "customers/809xxxx186/labels/-2",
           
"name": {
             
"value": "yyy:zzz:777"
           
},
           
"text_label": {
             
"background_color": {
               
"value": "#940CFE"
             
},
             
"description": {
               
"value": "generated label"
             
}
           
}
         
}
       
}
     
}
   
}
 
},
 
{
   
"Operation": {
     
"CampaignOperation": {
       
"Operation": {
         
"Create": {
           
"resource_name": "customers/809xxxx186/campaigns/-3",
           
"name": {
             
"value": "Test Campaign"
           
},
           
"status": 3,
           
"advertising_channel_type": 4,
           
"shopping_setting": {
             
"merchant_id": {
               
"value": 121868788
             
},
             
"sales_country": {
               
"value": "RU"
             
},
             
"campaign_priority": {}
           
},
           
"campaign_budget": {
             
"value": "customers/809xxxx186/campaignBudgets/-1"
           
},
           
"bidding_strategy_type": 9,
           
"CampaignBiddingStrategy": {
             
"TargetSpend": {
               
"cpc_bid_ceiling_micros": {
                 
"value": 10000000
               
}
             
}
           
}
         
}
       
}
     
}
   
}
 
},
 
{
   
"Operation": {
     
"CampaignLabelOperation": {
       
"Operation": {
         
"Create": {
           
"campaign": {
             
"value": "customers/809xxxx186/campaigns/-3"
           
},
           
"label": {
             
"value": "customers/809xxxx186/labels/-2"
           
}
         
}
       
}
     
}
   
}
 
}
]

But it fails with error:
{
 
"errors": [
   
{
     
"error_code": {
       
"ErrorCode": {
         
"RequestError": 11
       
}
     
},
     
"message": "Field 'resource_name' cannot be modified by 'CREATE' operation.",
     
"location": {
       
"field_path_elements": [
         
{
           
"field_name": "mutate_operations",
           
"index": {
             
"value": 1
           
}
         
},
         
{
           
"field_name": "label_operation"
         
},
         
{
           
"field_name": "create"
         
},
         
{
           
"field_name": "resource_name"
         
}
       
]
     
}
   
},
   
{
     
"error_code": {
       
"ErrorCode": {
         
"NewResourceCreationError": 4
       
}
     
},
     
"message": "Parent resource with specified temp ID failed validation, so no validation will be done for this child resource.",
     
"trigger": {
       
"Value": {
         
"Int64Value": -2
       
}
     
},
     
"location": {
       
"field_path_elements": [
         
{
           
"field_name": "mutate_operations",
           
"index": {
             
"value": 3
           
}
         
}
       
]
     
}
   
}
 
]
}

It looks like a bug.
Reply all
Reply to author
Forward
0 new messages