Do AdGroupCriteria support temporary IDs?

250 views
Skip to first unread message

Dorian Kind

unread,
Nov 18, 2016, 9:32:24 AM11/18/16
to AdWords API Forum
Hey there,

in the batch job processing guide, we can see that it's possible to create campaigns and ad groups with temporary (negative) IDs, so that we can populate them without having to create a new batch job.

Is the same possible for AdGroupCriteria? The use case for us would be to create keywords and label them in the same batch job.

Thanks for your feedback and best regards,
Dorian

Vishal Vinayak (Adwords API Team)

unread,
Nov 18, 2016, 3:16:44 PM11/18/16
to AdWords API Forum
Hi Dorian,

That is indeed possible. You can use the AdGroupCriterionService in conjugation with BatchJobService to create/edit criteria for multiple ad groups all at once. A list of all operations supported by the BatchJobService is available here

Regards,
Vishal, AdWords API Team 

Dorian Kind

unread,
Jun 15, 2017, 4:36:36 PM6/15/17
to AdWords API Forum
Hi Vishal,

I only now got around to trying this. Unfortunately the described scenario (using temporary IDs for ad group criterions or ad group ads) does not work with the batch job service. If I submit a job with operations to create an ad group, one ad and criterion each contained in the ad group and label operations to attach one label each to the ad group, the ad and the criterion as follows:

[{'operand': {'biddingStrategyConfiguration': {'bids': [{'bid': {'microAmount': '2560000'},
                                                         'xsi_type': 'CpcBid'}]},
              'campaignId': 857289266,
              'id': -1,
              'name': 'Some Ad Group Name',
              'status': 'ENABLED',
              'xsi_type': 'AdGroup'},
  'operator': 'ADD',
  'xsi_type': 'AdGroupOperation'},
 {'operand': {'ad': {'description': 'Some description line',
                     'finalUrls': ('https://example.com/',),
                     'headlinePart1': 'Headline Part 1',
                     'headlinePart2': 'Headline Part 2',
                     'id': -2,
                     'path1': 'path1',
                     'path2': 'path2',
                     'xsi_type': 'ExpandedTextAd'},
              'adGroupId': -1,
              'status': 'ENABLED',
              'xsi_type': 'AdGroupAd'},
  'operator': 'ADD',
  'xsi_type': 'AdGroupAdOperation'},
 {'operand': {'adGroupId': -1,
              'biddingStrategyConfiguration': {'bids': [{'bid': {'microAmount': '500000'},
                                                         'xsi_type': 'CpcBid'}]},
              'criterion': {'id': -3,
                            'matchType': 'BROAD',
                            'text': 'some keyword',
                            'xsi_type': 'Keyword'},
              'userStatus': 'ENABLED',
              'xsi_type': 'BiddableAdGroupCriterion'},
  'operator': 'ADD',
  'xsi_type': 'AdGroupCriterionOperation'},
 {'operand': {'adGroupId': -1,
              'labelId': 1255811636,
              'xsi_type': 'AdGroupLabel'},
  'operator': 'ADD',
  'xsi_type': 'AdGroupLabelOperation'},
 {'operand': {'adGroupId': -1,
              'adId': -2,
              'labelId': 1255811636,
              'xsi_type': 'AdGroupAdLabel'},
  'operator': 'ADD',
  'xsi_type': 'AdGroupAdLabelOperation'},
 {'operand': {'adGroupId': -1,
              'criterionId': -3,
              'labelId': 1255811639,
              'xsi_type': 'AdGroupCriterionLabel'},
  'operator': 'ADD',
  'xsi_type': 'AdGroupCriterionLabelOperation'}]

Then the AdGroupAdLabelOperation and the AdGroupCriterionLabelOperation will fail with an EntityNotFound.INVALID_ID error, the triggers being "TempAdId: 2" and "TempCriterionId{id=3}" respectively.

EIther I'm doing something wrong or temporary IDs are indeed only supported on the campaign and ad group level. If it's the latter, it'd be great if the BatchJobService documentation could be amended accordingly.

Best regards,
Dorian

Peter Oliquino

unread,
Jun 16, 2017, 3:04:57 AM6/16/17
to AdWords API Forum
Hi Dorian,

I will be providing support for now in place of Vishal. Looking at the code, it appears you are also adding temporary IDs to the dependent object itself (Ad and Criterion IDs). As discussed here, all child objects will only require temporary IDs set for their parent objects. Let me know if this helps and should you have any further questions, please create a new thread as this one is already old.

Best regards,
Peter
AdWords API Team

Dorian Kind

unread,
Jun 16, 2017, 3:16:10 AM6/16/17
to AdWords API Forum
Hi Peter,

I think there is a misunderstanding, my original question was exactly about using temporary IDs for criteria and ads so that we can apply labels to them in the same batch job. From what I can tell, this does not seem to be possible, is that correct?

Thanks and best regards,
Dorian

Peter Oliquino

unread,
Jun 16, 2017, 4:12:08 AM6/16/17
to AdWords API Forum
Hi Dorian,

My apologies for not being clear. But yes, what I meant in my previous response was that ads, and criteria no longer require temporary IDs (as seen also in this example) only the parent objects (campaign and adgroup). As for the AdGroupLabel, your ads should be created first before you can assign their IDs to the AdId field. 

ax...@turo.com

unread,
Sep 19, 2017, 7:01:52 PM9/19/17
to AdWords API Forum
@Dorian, Did you get a final answer on this. I am trying to do EXACTLY what you are trying to do and does not seem to be able to use temporaryID on the AdgroupAd entity to apply a label. 

Did you find a workaround by any chance? 

Thanks,

Axel

Dorian Kind

unread,
Sep 20, 2017, 3:23:34 AM9/20/17
to AdWords API Forum
Hi Axel,

as far as I could tell (and what seems to be confirmed be Peter's answer), setting temporary IDs on AdgroupAds is not supported, so setting up a single or multiple complete campaigns in one large bulk job can't be done. We ended up just doing two passes, the first one to create the entity structure and the second one to apply all the corresponding labels. Hope this helps.

Cheers,
Dorian

Peter Oliquino

unread,
Sep 20, 2017, 3:55:24 AM9/20/17
to AdWords API Forum
Hi Everyone,

Good thing there was a bump for this old thread. To update my previous response, all operations should go in the order of the parent object being created first before the child object. Meaning, temporary IDs should still be applicable for ads and criterion as long as the operations creating them are called first before operations such as those for labels are called within the batch process.

Agnel Waghela

unread,
Nov 23, 2017, 3:02:11 AM11/23/17
to AdWords API Forum
Hi Peter,

I have tried exactly the same what you have said. But I have received the EntityNotFound.INVALID_ID error for the corresponding label operations

According to the Google Adwords API Documentation, the AdGroupCriterionLabelOperation and AdGroupAdLabelOperation are supported in BatchJobService.

But when I'm trying to create a Keyword or an Ad and assign a label alongside with it in the same BatchJob request, the Keyword or Ad creation succeeds whereas the LabelOperation fails.

Below is a sample request and response for a Keyword

Request -
Here a TempId is assigned to the AdGroupCriterionOperation since the AdGroupCriterionLabelOperation requires the id of the AdGroupCriterion to associate a label to it.


[{:xsi_type=>"AdGroupCriterionOperation",
 
:operator=>"ADD",
 
:operand=>
   
{:xsi_type=>"BiddableAdGroupCriterion",
   
:ad_group_id=>"50208085678",
   
:criterion=>
     
{:xsi_type=>"Keyword",
     
:text=>"+1 +BHK +Apartment",
     
:match_type=>"BROAD",
     
:id=>-1},
   
:bidding_strategy_configuration=>
     
{:bids=>[{:xsi_type=>"CpcBid", :bid=>{:micro_amount=>13000000}}]}}},
 
{:xsi_type=>"AdGroupCriterionLabelOperation",
 
:operator=>"ADD",
 
:operand=>
   
{:ad_group_id=>"50208085678", :criterion_id=>-1, :label_id=>"2131330045"}}]


Response -

[{:result=>
   
{:ad_group_criterion=>
     
{:ad_group_id=>"50208085678",
     
:criterion=>
       
{:id=>"296137713990",
       
:type=>"KEYWORD",
       
:criterion_type=>"Keyword",
       
:text=>"+1 +BHK +Apartment",
       
:match_type=>"BROAD"},
     
:ad_group_criterion_type=>"BiddableAdGroupCriterion",
     
:user_status=>"ENABLED",
     
:system_serving_status=>"ELIGIBLE",
     
:approval_status=>"PENDING_REVIEW",
     
:bidding_strategy_configuration=>
       
{:bidding_strategy_type=>"MANUAL_CPC",
       
:bidding_strategy_source=>"CAMPAIGN",
       
:bidding_scheme=>
         
{:bidding_scheme_type=>"ManualCpcBiddingScheme",
         
:enhanced_cpc_enabled=>"false"},
       
:bids=>
         
[{:bids_type=>"CpcBid",
           
:bid=>{:comparable_value_type=>"Money", :micro_amount=>"13000000"},
           
:cpc_bid_source=>"CRITERION",
           
:"@xsi:type"=>"CpcBid"},
         
{:bids_type=>"CpmBid",
           
:bid=>{:comparable_value_type=>"Money", :micro_amount=>"10000"},
           
:cpm_bid_source=>"ADGROUP",
           
:"@xsi:type"=>"CpmBid"}]}}},
 
:index=>"0"},
 
{:error_list=>
   
{:errors=>
     
{:field_path=>"operations[1].operand.criterionId",
     
:field_path_elements=>
       
[{:field=>"operations", :index=>"1"},
       
{:field=>"operand"},
       
{:field=>"criterionId"}],
     
:trigger=>"TempCriterionId{id=1}",
     
:error_string=>"EntityNotFound.INVALID_ID",
     
:api_error_type=>"EntityNotFound",
     
:reason=>"INVALID_ID"}},
 
:index=>"1"}]


Peter Oliquino

unread,
Nov 23, 2017, 4:23:50 AM11/23/17
to AdWords API Forum
Hi Agnel,

Could you send to me privately (using the Reply privately to author option) your clientCustomerId and the batch job IDs so I can have a better look at the issue?

Thanks and regards,
Peter
AdWords API Team

Agnel Waghela

unread,
Nov 24, 2017, 7:56:57 AM11/24/17
to AdWords API Forum
Hi Peter,

Today I tried to assign label after all the labels and ads were created.

I sent the following request to the BatchJob. Here are only AdGroupAdLabelOperations.

{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"45832500421", :ad_id=>"235012322853", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"45832500421", :ad_id=>"235012322856", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"57535515348", :ad_id=>"235012322859", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"57535515348", :ad_id=>"235012322862", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"51784901471", :ad_id=>"235012322865", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"51784901471", :ad_id=>"235012322868", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"51784799951", :ad_id=>"235012322871", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"51784799951", :ad_id=>"235012322874", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"50586572113", :ad_id=>"235012322877", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"50586572113", :ad_id=>"235012323000", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"51784901711", :ad_id=>"235012323003", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"51784901711", :ad_id=>"235012323006", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"51784902431", :ad_id=>"235012323009", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"51784902431", :ad_id=>"235012323012", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"47866534926", :ad_id=>"235012323015", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"47866534926", :ad_id=>"235012323018", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"48508472389", :ad_id=>"235012323021", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"48508472389", :ad_id=>"235012323024", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"45832388301", :ad_id=>"235012323027", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"45832388301", :ad_id=>"235012323030", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"51784884631", :ad_id=>"235012323033", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"51784884631", :ad_id=>"235012323036", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"48269892959", :ad_id=>"235012323039", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"48269892959", :ad_id=>"235012323042", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"51784907431", :ad_id=>"235012323045", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"51784907431", :ad_id=>"235012323048", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"48269893119", :ad_id=>"235012323051", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"48269893119", :ad_id=>"235012323054", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"51784909391", :ad_id=>"235012323057", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"51784909391", :ad_id=>"235012323060", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"50624763738", :ad_id=>"235012323063", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"50624763738", :ad_id=>"235012323066", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"50624763778", :ad_id=>"235012323069", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"50624763778", :ad_id=>"235012323072", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"49769424940", :ad_id=>"235012323075", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"49769424940", :ad_id=>"235012323078", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"51784914431", :ad_id=>"235012323081", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"51784914431", :ad_id=>"235012323084", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"48625499266", :ad_id=>"235012323087", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"48625499266", :ad_id=>"235012323090", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"49769441180", :ad_id=>"235012323093", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"49769441180", :ad_id=>"235012323096", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"51784915111", :ad_id=>"235012323099", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"51784915111", :ad_id=>"235012323102", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"51784915591", :ad_id=>"235012323105", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"51784915591", :ad_id=>"235012323108", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"51784915911", :ad_id=>"235012323111", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"51784915911", :ad_id=>"235012323114", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"51784884951", :ad_id=>"235012323117", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"51784884951", :ad_id=>"235012323240", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"50664874762", :ad_id=>"235012323243", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"50664874762", :ad_id=>"235012323246", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"53036741950", :ad_id=>"235012323249", :label_id=>"1568522900"}}
{:xsi_type=>"AdGroupAdLabelOperation ", :operator=>"ADD", :operand=>{:ad_group_id=>"53036741950", :ad_id=>"235012323252", :label_id=>"1568522900"}}

But this time I got an AdwordsApi::Errors::ApiException saying Unknown operation type: AdGroupAdLabelOperation
 

I believe the AdGroupAdLabelOperation is not yet support in BatchJob. Kindly Confirm.

Regards,
Agnel

Thanet Knack Praneenararat (AdWords API Team)

unread,
Nov 27, 2017, 1:19:30 AM11/27/17
to AdWords API Forum
Hello Agnel,

Engineering are aware of this issue and working on the fix.
I'll update this thread when this gets fixed.

Best,
Thanet, AdWords API Team

Bryan

unread,
Dec 4, 2017, 12:39:36 AM12/4/17
to AdWords API Forum
Hi Thanet, can you please clarify the scope of this issue and fix? Does this apply to ADD operations for AdGroupCriterionLabels? I am trying to associate labels to newly created ad groups using BatchJobService, all in one batch job, and getting EntityNotFound errors:

type=EntityNotFound,path=operations[1544].operand.criterionId,trigger=TempCriterionId{id=1795},desc=EntityNotFound.INVALID_ID

Thanks 

Thanet Knack Praneenararat (AdWords API Team)

unread,
Dec 4, 2017, 11:35:52 AM12/4/17
to AdWords API Forum
Hello Bryan,

Temporary IDs do not work in both AdGroupCriterionLabelOperation and AdGroupCriterionOperation now. 
Engineering is fixing this issue currently but we don't have ETAs yet.

Best,
Thanet, AdWords API Team

lukaskell...@gmail.com

unread,
Mar 28, 2018, 6:21:01 PM3/28/18
to AdWords API Forum
Hi Thanet,

any updates on using temporary IDs with AdGroupCriterionOperation in a batch job?

I run into a similar issue when trying to set temporary IDs with AdGroupAdOperation with BatchJobService.

Just for context: I am trying to apply labels to ads and adgroup criteria (which is why I need to set temporary IDs for those operations, in order to reference them). I am uploading ads, adgroup criteria and apply labels to them all in one BatchJob, with the labels being applied as the last operations. I receive a "Type not found: 'id'" error when setting temporary IDs in the AdGroupCriteriaOperation & AdGroupAdOperation operations.

Best,
Lukas

Thanet Knack Praneenararat (AdWords API Team)

unread,
Mar 29, 2018, 2:57:51 AM3/29/18
to AdWords API Forum
Hello Lukas,

Unfortunately, the fix is complicated than we thought so it's taking time.
I'll update this thread once this is completed.

Best,
Thanet, AdWords API Team

Bas Vernooij

unread,
Oct 15, 2018, 7:02:52 PM10/15/18
to AdWords API and Google Ads API Forum
Hey Thanet,

I'm trying to the same thing as described in this thread: create an ad (AdGroupAdOperation), then apply an existing label to it within the same batch job (AdGroupAdLabelOperation).

Could you please update me on wether this should be possible now or if it's still in development?

Kind regards,

Bas
Reply all
Reply to author
Forward
0 new messages