Batch Job (format xml Request body)

31 views
Skip to first unread message

Che Siri

unread,
Sep 7, 2017, 1:54:57 PM9/7/17
to AdWords API Forum
Hi, i am developing my app in node.js and  making the request to the services.
I can create a Batch Job service and get the uploadUrl. But i don´t know how to send the  xml body to the request  because i dont know the format of this xml.
I need send the Request body from my array of operations.

thanks! 

Uploading the Operations (Cont.)
● The next step is to send operations to the
uploadUrl
● uploadUrl is valid for one week
...
Uploading the Operations (Cont.)
● All libraries have utilities to help building
the request!
● BatchJobHelper for Java cl...
Polling the Job Status
● After uploading operations, the BatchJob
status will move to ACTIVE.
AWAITING_FILE
ACTIVE
CANCELE...
Polling the Job Status (Cont.)
● Check the job status
int pollAttempts = 0;
boolean isPending = true;
Selector selector =
...
Polling the Job Status (Cont.)
● Poll for completion of the batch job with
an exponential back off
● Check the job's statu...
Downloading Results
● At this stage the job status can be DONE
or CANCELED
● Let's check out the details...
Downloading Results - DONE
● Status: DONE
● Description: BatchJobService
successfully parsed and attempted each of
the upl...
Downloading Results - CANCELED
● Status: CANCELED
● Description: An unexpected error
occurred, or BatchJobService could no...
Downloading Results - CANCELED
● Some operations may still have been
attempted
● Always check the downloadUrl for the
resu...
Downloading Results (Cont.)
● downloadUrl returns mutateResults
● There is another utility to help!
if (batchJob.getDownlo...
Downloading Results (Cont.)
● A mutateResult will have either a
result or an errorList, but not both
○ result - The result...
Errors
BatchJob.processingErrors (per job)
● Errors encountered while parsing uploaded
operations - FILE_FORMAT_ERROR
● Un...
Temporary IDs
Temporary IDs
● Did you ever want to create a complete
campaign in a single batch job?
● New feature introduced with
Batch...
Common Use Case
Create a Campaign in a single BatchJob:
Campaign
● id = -1
AdGroup
● id = -2
● campaignId = -1
CampaignLab...
Important Notes
● The order of operations is very important!
● Keep this in mind when using temp IDs
● Create the parent o...
Incremental
Uploads
Introduction
● Allows multiple operation upload requests
to the same BatchJob
● Job will start after last set of operation...
Incremental Upload Use Cases
● You build your BatchJob operations in
phases or separate processes, so sending
all operatio...
Range of bytes in the request, followed by
total bytes. Total bytes will be * for the
first and intermediate requests.
The...
More on the Request Body...
● BatchJobService will concatenate all the
requests
● You just need to send the first and last...
More on the Request Body (Cont.)
● All requests will be parsed as a single
document
● The concatenation of all requests ha...
Request 1
Content-Range: 0-262143/*
<?xml version="1.0" encoding="UTF-8"?>
<ns1:mutate xmlns:ns1="https://adwords.google.c...
Request 3
Content-Range: 524288-524304/524305
rations></mutate>
● Content length without padding of 17 bytes,
where the cl...
Request 2
Content-Range: 262144-524287/*
ions>
<operations xsi:type="ns1:AdGroupOperation">
<operator xsi:type="ns1:Operat...
Use the Client Libraries!
● The client libraries have utilities to do all
the parsing
● No need to worry about size detail...
Best Practices
General Guidelines
Improve Throughput
● Fewer larger jobs over many smaller jobs
● Exponential back off when
polling
● Don't poll job status ...
Dealing with Same Client ID
● Avoid different jobs working on the same
objects
○ Might result in deadlocks, followed by ex...
One Last Tip...
● Avoid multiple mutates of the same object
in the same job
Limitations
Regarding Operations Size
● 1 Gb of unfinished operations per account
at any given time
○ Will throw DISK_QUOTA_EXCEEDED e...
Regarding Shopping Campaigns
● BJS similar to partialFailure = true
● Partial failure not supported for Shopping
campaign ...
Cancelling the Job
BatchJob status is read-only:
● You can't cancel a job before the
operations upload is finished
● You c...
Resources
● BatchJobService API reference
○ https://goo.gl/J35rCm
● Client libraries
○ https://goo.gl/Ck7qK4
● BatchJobOps...

Shwetha Vastrad (AdWords API Team)

unread,
Sep 7, 2017, 4:18:46 PM9/7/17
to AdWords API Forum
Hi, 

You can use the schema available here to construct batch job requests. If you are not using a client library utility, then please see the upload requirements section for more details on uploading operations to your BatchJobs.

Regards,
Shwetha, AdWords API Team.
Reply all
Reply to author
Forward
0 new messages