【问题标题】:Listing Business Accounts under Google My Business API在 Google My Business API 下列出企业帐户
【发布时间】:2021-10-27 18:24:56
【问题描述】:

我已通过 Google 帐户进行身份验证,并尝试使用 Google My Business API 获取该帐户中的商家。

我似乎找不到任何关于如何使用 Google NodeJS 客户端库来做到这一点的示例。

这是我尝试过的:

async fetchGoogleMyBusinessAccounts() {
    console.log(`Fetching GMB Accounts`);
    let authCredentials= ...
    const oauth2Client = initOAuth2Client(platform, authCredentials);
    google.options({ auth: oauth2Client });
    let gmbAccountManagement = google.mybusinessaccountmanagement(); //There seems to be an issue on this line
    try {
        let myBusinessAccounts = await gmbAccountManagement.accounts.list();
        console.log(`Connected Accounts = ${JSON.stringify(myBusinessAccounts, null, 2)}`);
    } catch (e) {
        console.log(`Error Listing GMB Accounts`);
    }
}

但我不断收到的错误是:

参数错误:只接受字符串或对象

我似乎无法弄清楚可能出了什么问题以及如何最好地解决这个问题。

任何见解都将不胜感激。

【问题讨论】:

    标签: node.js google-api google-oauth google-my-business-api


    【解决方案1】:

    我认为您可能缺少 API 版本:

    const mybusinessaccountmanagement = google.mybusinessaccountmanagement('v1');
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-08-05
      • 1970-01-01
      • 2017-04-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多