// Create a new Batch jobval session = GoogleCredentials.buildSession(accessToken, "########")val batchJobService = new AdWordsServices().get(session, classOf[BatchJobServiceInterface])val jobOperation = new BatchJobOperation()jobOperation.setOperator(Operator.ADD) jobOperation.setOperand(new BatchJob())val batchJobReturnValue = batchJobService.mutate(Array[BatchJobOperation](jobOperation)).getValue(0)
Thread.sleep(2000)
// Remove the above batch jobval removeOperation = new BatchJobOperation()removeOperation.setOperator(Operator.REMOVE)val batchJob = new BatchJob()batchJob.setId(batchJobReturnValue.getId)removeOperation.setOperand(batchJob)val batchOpResult = batchJobService.mutate(Array[BatchJobOperation](removeOperation)).getValue(0)println(batchOpResult.getStatus)<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Header> <ns1:RequestHeader xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201509" soapenv:mustUnderstand="0"> <ns1:clientCustomerId>#######</ns1:clientCustomerId> <ns1:developerToken>##########</ns1:developerToken> <ns1:userAgent>#######</ns1:userAgent> <ns1:validateOnly>false</ns1:validateOnly> <ns1:partialFailure>false</ns1:partialFailure> </ns1:RequestHeader> </soapenv:Header> <soapenv:Body> <mutate xmlns="https://adwords.google.com/api/adwords/cm/v201509"> <operations> <operator>REMOVE</operator> <operand> <id>1235132</id> </operand> </operations> </mutate> </soapenv:Body></soapenv:Envelope>
16:53:59.816 [testremovebatch-akka.actor.default-dispatcher-4] WARN c.g.a.a.a.l.c.A.soapXmlLogger - SOAP Response:<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header> <ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201509"> <requestId>00052bf3640c99e00abf36819d0be28f</requestId> <serviceName>BatchJobService</serviceName> <methodName>mutate</methodName> <operations>1</operations> <responseTime>206</responseTime> </ResponseHeader> </soap:Header> <soap:Body> <soap:Fault> <faultcode>soap:Server</faultcode> <faultstring>[InternalApiError.UNEXPECTED_INTERNAL_API_ERROR @ com.google.ads.api.services.common.error.InternalApiError.<init>(InternalApiErro]</faultstring> <detail> <ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/cm/v201509"> <message>[InternalApiError.UNEXPECTED_INTERNAL_API_ERROR @ com.google.ads.api.services.common.error.InternalApiError.<init>(InternalApiErro]</message> <ApplicationException.Type>ApiException</ApplicationException.Type> <errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="InternalApiError"> <fieldPath/> <trigger/> <errorString>InternalApiError.UNEXPECTED_INTERNAL_API_ERROR</errorString> <ApiError.Type>InternalApiError</ApiError.Type> <reason>UNEXPECTED_INTERNAL_API_ERROR</reason> </errors> </ApiExceptionFault> </detail> </soap:Fault> </soap:Body></soap:Envelope>