Search code examples
google-apps-scriptgoogle-api-js-clientgoogle-apps-script-api

How can I call Google CM360 API from Apps-script editor?


I see the Apps Script API doc for calling Google CM360 API is much slimmer than the gapi REST API API doc.

Is there a way to call gapi/Google CM360 API from Apps Script Editor?


Solution

  • Use the Advanced Service:

    The docs referring to the Advanced Service don't usually include all the methods available; that doesn't mean they are not available. All methods from Campaign Manager 360 API v3.4 should be available to DoubleClickCampaigns Service.

    How to use it:

    In the Apps Script service, the names of the API resources will be typically the same as in the API, but with the first letter capitalized, and the method name will be the same as in the API.

    For example, if you wanted to call accountActiveAdSummaries.get, you would do something like this (after enabling the service for your project):

    DoubleClickCampaigns.AccountActiveAdSummaries.get(profileId, summaryAccountId);
    

    Also, the autocomplete feature can be useful for checking the available methods and writing them.