管理屬性

商家可透過屬性加入其他資訊,例如無障礙選項和設施。

列出可用屬性 (中繼資料)

如要瞭解業務類別和國家/地區支援哪些屬性,請要求 attributes.list。屬性是動態的,應經常擷取。請參閱下一節的範例。

要求

如要列出特定類別、區域代碼和語言代碼的可用屬性,請按照下列步驟操作:

HTTP
GET https://mybusinessbusinessinformation.googleapis.com/v1/attributes?regionCode=US&languageCode=EN&categoryName=gcid:restaurant

如要使用地點 ID 列出特定商家資訊的可用屬性,請按照下列步驟操作:

HTTP
GET https://mybusinessbusinessinformation.googleapis.com/v1/attributes?parent=locations/{locationId}

回應

下列部分回應會傳回具有各種 AttributeValueType 值的屬性定義。請注意,valueMetadata 描述的是允許的值及其顯示名稱,而非位置的所選值。

{
  "attributes": [
    {
      "attributeId": "has_live_music",
      "valueType": "BOOL",
      "displayName": "Live music",
      "groupDisplayName": "Highlights",
      "valueMetadata": [
        {
          "value": true,
          "displayName": "Live music"
        }
      ],
      "displayStrings": {
        "uiText": "Live music",
        "standaloneText": "Has live music",
        "negativeText": "No live music"
      }
    },
    {
      "attributeId": "has_wheelchair_accessible_entrance",
      "valueType": "BOOL",
      "displayName": "Wheelchair accessible entrance",
      "groupDisplayName": "Accessibility",
      "valueMetadata": [
        {
          "value": true,
          "displayName": "Wheelchair accessible entrance"
        },
        {
          "value": false,
          "displayName": "No wheelchair accessible entrance"
        }
      ],
      "displayStrings": {
        "uiText": "Wheelchair accessible entrance",
        "standaloneText": "Has wheelchair accessible entrance",
        "negativeText": "No wheelchair accessible entrance"
      }
    },
    {
      "attributeId": "has_braille_menu",
      "valueType": "BOOL",
      "displayName": "Braille menu",
      "groupDisplayName": "Offerings",
      "valueMetadata": [
        {
          "value": true,
          "displayName": "Braille menu"
        }
      ],
      "displayStrings": {
        "uiText": "Braille menu",
        "standaloneText": "Has braille menu",
        "negativeText": "No braille menu"
      }
    },
    {
      "attributeId": "has_no_contact_delivery",
      "valueType": "BOOL",
      "displayName": "No-contact delivery",
      "groupDisplayName": "Offerings",
      "valueMetadata": [
        {
          "value": true,
          "displayName": "No-contact delivery"
        }
      ],
      "displayStrings": {
        "uiText": "No-contact delivery",
        "standaloneText": "Has no-contact delivery",
        "negativeText": "No no-contact delivery"
      }
    },
    {
      "attributeId": "welcomes_lgbtq",
      "valueType": "BOOL",
      "displayName": "LGBTQ friendly",
      "groupDisplayName": "Planning",
      "valueMetadata": [
        {
          "value": true,
          "displayName": "LGBTQ friendly"
        }
      ],
      "displayStrings": {
        "uiText": "LGBTQ friendly",
        "standaloneText": "LGBTQ friendly",
        "negativeText": "Not showing LGBT friendly"
      }
    },
    {
      "attributeId": "wi_fi",
      "valueType": "ENUM",
      "displayName": "Wi-Fi",
      "groupDisplayName": "Amenities",
      "valueMetadata": [
        {
          "value": "free_wi_fi",
          "displayName": "Free"
        },
        {
          "value": "paid_wi_fi",
          "displayName": "Paid"
        }
      ],
      "displayStrings": {
        "uiText": "Wi-Fi",
        "standaloneText": "Has Wi-Fi",
        "negativeText": "No Wi-Fi"
      }
    },
    {
      "attributeId": "pay_credit_card_types_accepted",
      "valueType": "REPEATED_ENUM",
      "displayName": "Credit cards",
      "groupDisplayName": "Payments",
      "isRepeatable": true,
      "valueMetadata": [
        {
          "value": "american_express",
          "displayName": "American Express"
        },
        {
          "value": "china_union_pay",
          "displayName": "China Union Pay"
        },
        {
          "value": "diners_club",
          "displayName": "Diners Club"
        },
        {
          "value": "discover",
          "displayName": "Discover"
        },
        {
          "value": "jcb",
          "displayName": "JCB"
        },
        {
          "value": "mastercard",
          "displayName": "MasterCard"
        },
        {
          "value": "visa",
          "displayName": "VISA"
        }
      ],
      "displayStrings": {
        "uiText": "Credit cards",
        "standaloneText": "Credit cards accepted",
        "negativeText": "Credit cards not accepted"
      }
    }
  ]
}

取得產品資訊的屬性

如要擷取特定位置設定的屬性和值,請使用 locations.getAttributes。

商家管理的屬性

如要取得商家設定的屬性,請按照下列步驟操作:

HTTP
GET https://mybusinessbusinessinformation.googleapis.com/v1/locations/{locationId}/attributes

回應會傳回為位置設定的實際值:

{
  "name": "locations/{locationId}/attributes",
  "attributes": [
    {
      "name": "attributes/has_wheelchair_accessible_seating",
      "valueType": "BOOL",
      "values": [
        false
      ]
    },
    {
      "name": "attributes/wi_fi",
      "valueType": "ENUM",
      "values": [
        "free_wi_fi"
      ]
    }
  ]
}

Google 更新的屬性 (即時檢視)

如要擷取 Google 搜尋和地圖上顯示的屬性 (可能包含 Google 資訊更新或使用者原創內容),請使用 locations.attributes.getGoogleUpdated:

HTTP
GET https://mybusinessbusinessinformation.googleapis.com/v1/locations/{locationId}/attributes:getGoogleUpdated

含編輯狀態的擴充屬性 (v1alpha)

如要擷取商家提供的屬性和面向消費者的屬性,以及每個屬性的編輯生命週期階段 (例如 EDIT_LIFECYCLE_STAGE_PENDING 或 EDIT_LIFECYCLE_STAGE_REJECTED)、編輯來源 (SOURCE_API 或 SOURCE_UI) 和違反政策的原因,請在單一呼叫中使用 v1alpha 中的 locations.attributes.getExtended:

HTTP
GET https://mybusinessbusinessinformation.googleapis.com/v1alpha/locations/{locationId}/attributes:getExtended

如需完整的回應範例,以及解讀屬性編輯狀態和違反政策的詳細資訊,請參閱「查看地點和屬性的編輯狀態」。

設定產品資訊的屬性

如要使用 locations.updateAttributes 設定屬性,請使用要更新的屬性設定 attributeMask 參數。

以下範例會設定商家資訊接受的信用卡類型和運送選項屬性。

HTTP
PATCH
https://mybusinessbusinessinformation.googleapis.com/v1/locations/{locationId}/attributes?attributeMask=pay_credit_card_types_accepted,has_no_contact_delivery
{
  "name": "locations/{locationId}/attributes",
  "attributes": [
    {
      "name": "has_no_contact_delivery",
      "values": [ true ]
    },
    {
      "name": "pay_credit_card_types_accepted",
      "repeatedEnumValue": {
        "setValues": [
          "american_express",
          "visa"
        ]
      }
    }
  ]
}