連結商家檔案

如要為 Merchant Center 提供店面商品目錄資料,您必須先指定 Merchant Center 負責的業務。您可以透過 Content API 從商家檔案取得可用的營業地點群組清單,但請先申請商家檔案的存取權。

要求商家檔案存取權

如要要求商家檔案存取權,請使用 liasettings.requestgmbaccess 方法:

POST https://shoppingcontent.googleapis.com/content/v2.1/12345/liasettings/67890/requestgmbaccess?gmbEmail=admin@example.com

在這個範例中,gmbEmail 查詢參數會指定商家檔案管理員的電子郵件地址。

呼叫此方法後,指定的管理員會收到一封電子郵件,要求他們接受或拒絕存取要求。如果管理員未採取任何行動,此要求會在 7 天後失效。

列出可用的營業地點群組

授予存取權後,您可以呼叫 liasettings.getaccessiblegmbaccounts 方法,查看可以使用哪些商家:

GET https://shoppingcontent.googleapis.com/content/v2.1/12345/liasettings/67890/accessiblegmbaccounts

Response:
200 OK
{
  "kind": "content#liasettingsGetAccessibleGmbAccountsResponse",
  "accountId": 67890,
  "gmbAccounts": [{
    "type" : "user",
    "email" : "admin@example.com",
    "name" : "admin@example.com",
    "listingCount": 82
  },
  {
    "type" : "business",
    "email" : "california@example.com",
    "name" : "Golden-State",
    "listingCount" : 20
  },
  {
    "type" : "business",
    "email" : "florida@example.com",
    "name" : "Sunshine-State",
    "listingCount" : 15
  },
  {
    "type" : "business",
    "email" : "newyork@example.com",
    "name" : "Empire-State",
    "listingCount" : 25
  }]
}

指定 Merchant Center 帳戶的營業地點群組

現在您已取得可能的營業地點群組清單,請在與 Merchant Center 帳戶相關聯的 Accounts 資源中,將 googleMyBusinessLink 欄位設為需要的群組。舉例來說,如果 Merchant Center 67890 包含加州商家的產品,您可以使用 Accounts.update 設定這些資訊:

PUT https://shoppingcontent.googleapis.com/content/v2/12345/accounts/67890
{
  "googleMyBusinessLink" : {
    "gmbEmail": "california@example.com"
  }
}

Response:
200 OK
{
  "kind": "content#account",
  "id": 67890,
  "googleMyBusinessLink" : {
    "gmbEmail": "california@example.com",
    "status" : "active"
  }
}

設定 googleMyBusinessLink 欄位不需要手動驗證,因此連結狀態會立即反映。

提交產品和商品目錄資料

Merchant Center 與營業地點群組建立關聯後,您就可以為這些商家提供店面產品和店面商品目錄資料。 針對這種情況,請使用與上傳線上產品和商品目錄資料相同的方法,例如 products.insert。針對 products.insert,您應指定 local 的管道,而非 online