What's the url to call AdWords and BigQuery from ads script with a service account?

69 Views Asked by At

I want to modify these API calls to use a GCP service account instead of my identity.

var report = AdsApp.search(searchQuery);
  
var table = BigQuery.Tables.insert(table, projectId, dataSetId);

BigQuery.Jobs.insert(job, BIGQUERY_PROJECT_ID);

I read this article but wasn't sure how to find the url for AdsApp and BigQuery.

I searched this post, but still haven't been sure.

Hi,

I want to write an Ads-script to call GoogleAds url nad BQ url using a service account.

I saw this code. Are my urls to the GAds and BQ api correct?

Thanks!

=====================

  // Natural Language API Sentiment URL
  var url =
      'https://language.googleapis.com/v1beta1/documents:analyzeEntities';

  var options = {
    method: 'POST',
    contentType: 'application/json',
    payload: JSON.stringify(body)
  };
  var response = authUrlFetchApp.fetch(url, options);
  var result = JSON.parse(response.getContentText());
  Logger.log(result);
  if (result.entities) {
    // return a list of identified entities
    return result.entities;
  }
  throw Error('No entities response returned');
}
1

There are 1 best solutions below

0
On

I think these are the urls:

  var url =...;
  
  
  //https://adwords.google.com/cm/CampaignMgmt?authuser=1&__u=%param_one%&__c=%param_two%#c.%param_three%.create&app=cm
  //https://bigquery.googleapis.com
  //https://adwords.google.com/cm/CampaignMgmt?
  
  
  var options = {
    method: 'POST',
    contentType: 'application/json',
    payload: JSON.stringify(body)
  };
  var response = authUrlFetchApp.fetch(url, options);
  var result = JSON.parse(response.getContentText());
  Logger.log(result);
  if (result.entities) {
    // return a list of identified entities
    return result.entities;
  }
  throw Error('No entities response returned');
}