Batch Job Result detailed information

206 views
Skip to first unread message

Prototype.co

unread,
Mar 9, 2021, 8:26:33 AM3/9/21
to AdWords API and Google Ads API Forum
Hi all,

previously, the AdWords API allowed downlaoding the results of a BatchJob through a downloadUrl which had detailed information on the resulting items created by the batch job. This included, in the case of Ad Groups:
        $adGroup->getCampaignName(), $adGroup->getName(), $adGroup->getId()
the parent Campaign Name, the Ad Group Name, and the Ad Group Id.

In the Google Ads API, all we get in the response:
    foreach ($batchJobResults->iterateAllElements() as $batchJobResult) {
        /** @var BatchJobResult $batchJobResult */
        printf(
            "Batch job #%d has a status '%s' and response of type '%s'.%s",
            $batchJobResult->getOperationIndex(),
            $batchJobResult->getStatus()
                ? $batchJobResult->getStatus()->getMessage() : 'N/A',
            $batchJobResult->getMutateOperationResponse()
                ? $batchJobResult->getMutateOperationResponse()->getResponse()
                : 'N/A',
            PHP_EOL
        );
    }

is basically nothing else than only the resource name. However, as you do not know the resource name in advance, there is no way to check which item has actually been created. You would have to make a new request to query the API for the details of the resource name, or worse yet, get an entire report on the elements of the account, in this case, the Ad Groups.

Is there a way to get a more detailed batch job result response, like in the elder days?

Google Ads API Forum Advisor Prod

unread,
Mar 10, 2021, 12:56:49 AM3/10/21
to a...@prototype.co.hu, adwor...@googlegroups.com
Hi,

The information from the BatchJobResult should contain (and help you identify) which type of entities (ex. ad_group_ad_result) were created. That being said, could you provide more context on what other information from the batch jobs you wish to retrieve?

Best regards,

Google Logo
Peter Laurence Napa Oliquino
Google Ads API Team
 


ref:_00D1U1174p._5004Q2DMMx6:ref

Prototype.co

unread,
Mar 10, 2021, 3:32:05 AM3/10/21
to AdWords API and Google Ads API Forum
Hi,

in this case we are uploading ad groups, and would like to receive their Ad Group Names and Parent Campaign IDs (their Ad Group ID is already available as part of the resource name). Or do you think the best solution is to launch a query immediately after upload for this information where the resource_name is equal to the list of uploaded resource names?

Kind regards,
Balázs

Google Ads API Forum Advisor Prod

unread,
Mar 10, 2021, 9:22:52 PM3/10/21
to a...@prototype.co.hu, adwor...@googlegroups.com
Hi,

Yes, you can query the entities as you have described after creation. However, I would recommend that you wait for a brief period after creation before executing the follow up query. I hope this helps.

Julian Canada

unread,
Mar 29, 2022, 8:20:45 AM3/29/22
to Google Ads API and AdWords API Forum
I guess that what you were looking for was to set the ResponseContentType(MUTABLE_RESOURCE) in the ListBatchJobResultsRequest.
It took me a while to get to that setting because it was not in the MutateOperation but in the List Request .

Hope this helps !

Google Ads API Forum Advisor

unread,
Mar 30, 2022, 2:25:45 AM3/30/22
to julian...@quanticmind.com, adwor...@googlegroups.com
Hi Julian,

Thank you for the suggestion. I work with Peter, it appears that your suggestion is helpful and can be applied to the concern of the initial user of this post. Let me know if you have any concerns about Google Ads API and our team will be glad to address it.

Best regards,
Google Logo
Jinky
Google Ads API Team
 


ref:_00D1U1174p._5004Q2DMMx6:ref
Reply all
Reply to author
Forward
0 new messages