BatchJobService - Using Temporary and standard IDs together

57 views
Skip to first unread message

Alan Coleman

unread,
Jul 26, 2016, 4:22:46 AM7/26/16
to AdWords API Forum
Hello everyone,

We've been testing the temporary IDs feature of the BatchJobService. The Add Complete Campaign script works and makes complete sense (great feature by the way!).

Is is possible to use this feature with an ID that has already been set? 

So for example, if we have a campaign that has already been created and for which we already have an ID, can we add AdGroups and Keywords using the temporary IDs feature of the BatchJobService?

So taking the sequence example form the documentation, our approach would look like this:

This sequence would:
  • Use a campaign that already exists with an ID of 12345678
  • Add an ad group with temporary ID -1 for campaign 12345678
  • Add an ad group ad for ad group -1
  • Add multiple ad group criteria (e.g., keywords) for ad group -1

The start of our operation would look something like this:


array (size=13)
  0 => 
    array (size=2)
      0 => 
        object(AdGroupOperation)[21]
          public 'operand' => 
            object(AdGroup)[11]
              public 'id' => int -1
              public 'campaignId' => int 12345678
              public 'campaignName' => null

We have tried this be get the following error:

errorType=BatchJobProcessingError, trigger=, errorString=BatchJobProcessingError.FILE_FORMAT_ERROR, fieldPath=, reason=FILE_FORMAT_ERROR

Any help would be appreciated.

Thanks 

Joyce Lava

unread,
Jul 26, 2016, 6:24:18 AM7/26/16
to AdWords API Forum
Hi Alan,

Could you please send to me the SOAP logs and the batch job ID to further investigate the case? Please make sure to use reply privately to author when sending these information.

Thanks,
Joyce, AdWords API Team

Alan Coleman

unread,
Aug 1, 2016, 5:21:17 AM8/1/16
to AdWords API Forum
The issue was with my use of the PHP Example. I got the following answer from the API Developers below...

Hello Alan,

In this line of your code, you're creating another layer of array, resulting in an array of array for ad group operations.
Instead, it's supposed to be just one layer of all types of operations together, so you have to change:
$operations = array($adGroupOperations);
to
$operations = array_merge(array(), $adGroupOperations);

Or more simply, just $operations = $adGroupOperations;

Hope this help.

Cheers,

Thanet Knack Praneenararat (AdWords API Team)

unread,
Aug 1, 2016, 5:24:12 AM8/1/16
to AdWords API Forum
Hello Alan,

Thanks for summarizing the solution again. :-)
Feel free to ask us if you have any questions or issues in the future.

Cheers,
Thanet, AdWords API Team
Reply all
Reply to author
Forward
0 new messages