Hi Google,

I have recently updated my code to the new API - v 201705 now being used 
and the code has been updated respectively.

The new code looks like this (php):

function createBatchJob($clientId, $operations) {
 $oAuth2Credential = (new OAuth2TokenBuilder())
 ->fromFile()
 ->build();

 // Construct an API session configured from a properties file and the OAuth2
 // credentials above.
 $session = (new AdWordsSessionBuilder())
 ->fromFile()
 ->withOAuth2Credential($oAuth2Credential)
 ->withClientCustomerId($clientId)
 ->build();

 $adWordsServices = new AdWordsServices();
 $batchJobService = $adWordsServices->get($session, BatchJobService::class);

 // Create a BatchJob.
 $addOp = new BatchJobOperation();
 $addOp->setOperator(Operator::ADD);
 $addOp->setOperand(new BatchJob());

 $result = $batchJobService->mutate([$addOp]);
 $batchJob = $result->getValue()[0];

 $uploadUrl = $batchJob->getUploadUrl()->getUrl();

 $batchJobs = new BatchJobs($session);

 $batchJobs->uploadBatchJobOperations($operations, $uploadUrl);

 if (!empty($batchJob->getUploadUrl()->getUrl())) {
 $jobDetails = new stdClass();
 $jobDetails->job_id = $batchJob->getId();
 $jobDetails->client_id = $clientId;

 return $jobDetails;
 }
}



The code creates a btach job and gives response but unfortunately campaigns are 
not getting paused in the account. Basically it gives back 'AWAITING FILE' 
response which is not what exactly I want.

I feel like something is missing in my code. Please help.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/36e0aa2b-a538-4068-9319-823dc410cf3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • Creating Bath J... Kanan Farzali
    • Re: Creati... 'Shwetha Vastrad (AdWords API Team)' via AdWords API Forum

Reply via email to