Switching from MutateJobService to BulkJobService

25 views
Skip to first unread message

Kanan Farzali

unread,
Apr 12, 2016, 8:57:27 AM4/12/16
to AdWords API Forum
Hi,

I am trying to change the old 'MutateJobService' to 'BulkJobService' as the former service has been deprecated in the last version of the API. 
I use PHP, and my code currently looks like this:

    public function create_mutate_job($client_id, $operations) {

        $user = new AdWordsUser();
        $user->SetClientCustomerId($client_id);

        $mutateJobService = $user->GetService('MutateJobService ', ADWORDS_VERSION);

        $policy = new BulkMutateJobPolicy();
        $policy->prerequisiteJobIds = array();

        $job = $mutateJobService->mutate($operations, $policy);

        if (!empty($job->id)) {
            $job_details = new stdClass();
            $job_details->job_id = $job->id;
            $job_details->client_id = $client_id;

            return $job_details;
        }
    }

I tried to change the service name to 'BatchJobService', however that doesn't work (just fails silently). There is an 'uploadurl' property which needs to be used and that is where I need a help. 

How could I change the code above so it works with 'BatchJobService'?

Cheers,

Kanan

Yin Niu

unread,
Apr 12, 2016, 9:53:55 AM4/12/16
to AdWords API Forum
Hi Kanan, 

You can take a look at AddCompleteCampaignsUsingBatchJob.php example. 

Thanks,
Yin, AdWords API Team. 
Reply all
Reply to author
Forward
0 new messages