連結商家檔案

如要將店面商品目錄資料提供給 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