Thuộc tính cho phép doanh nghiệp thêm thông tin bổ sung, chẳng hạn như các lựa chọn hỗ trợ tiếp cận và tiện nghi.
Liệt kê các thuộc tính (siêu dữ liệu) hiện có
Để khám phá những thuộc tính được hỗ trợ cho một danh mục kinh doanh và quốc gia, hãy yêu cầu attributes.list.
Các thuộc tính là động và cần được truy xuất thường xuyên. Hãy xem ví dụ trong phần sau.
Yêu cầu
Cách liệt kê các thuộc tính có sẵn cho một danh mục, mã khu vực và mã ngôn ngữ cụ thể:
GET https://mybusinessbusinessinformation.googleapis.com/v1/attributes?regionCode=US&languageCode=EN&categoryName=gcid:restaurant
Cách liệt kê các thuộc tính có sẵn cho một trang thông tin cụ thể bằng mã vị trí của trang thông tin đó:
GET https://mybusinessbusinessinformation.googleapis.com/v1/attributes?parent=locations/{locationId}Phản hồi
Phản hồi một phần sau đây trả về các định nghĩa thuộc tính có nhiều giá trị
AttributeValueType
khác nhau. Xin lưu ý rằng valueMetadata mô tả các giá trị được phép và tên hiển thị của các giá trị đó, chứ không phải giá trị đã chọn của vị trí.
{ "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" } } ] }
Lấy thuộc tính cho một trang thông tin
Để truy xuất các thuộc tính và giá trị được định cấu hình cho một vị trí cụ thể, hãy sử dụng locations.getAttributes.
Thuộc tính do người bán quản lý
Cách lấy các thuộc tính do người bán thiết lập:
GET https://mybusinessbusinessinformation.googleapis.com/v1/locations/{locationId}/attributesPhản hồi trả về các giá trị thực tế được đặt cho vị trí:
{
"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"
]
}
]
}Thuộc tính do Google cập nhật (chế độ xem trực tiếp)
Để truy xuất các thuộc tính khi chúng xuất hiện trực tiếp trên Google Tìm kiếm và Maps (có thể bao gồm nội dung cập nhật của Google hoặc nội dung do người dùng tạo), hãy sử dụng locations.attributes.getGoogleUpdated:
GET https://mybusinessbusinessinformation.googleapis.com/v1/locations/{locationId}/attributes:getGoogleUpdatedThuộc tính mở rộng có trạng thái chỉnh sửa (v1alpha)
Để truy xuất cả thuộc tính do người bán cung cấp và thuộc tính dành cho người tiêu dùng, cùng với các giai đoạn trong vòng đời chỉnh sửa của từng thuộc tính (chẳng hạn như EDIT_LIFECYCLE_STAGE_PENDING hoặc EDIT_LIFECYCLE_STAGE_REJECTED), nguồn chỉnh sửa (SOURCE_API hoặc SOURCE_UI) và lý do vi phạm chính sách trong một lệnh gọi, hãy sử dụng locations.attributes.getExtended trong v1alpha:
GET https://mybusinessbusinessinformation.googleapis.com/v1alpha/locations/{locationId}/attributes:getExtendedĐể xem các ví dụ đầy đủ về phản hồi và thông tin chi tiết về cách diễn giải trạng thái chỉnh sửa thuộc tính và lỗi vi phạm chính sách, hãy xem bài viết Kiểm tra trạng thái chỉnh sửa cho các vị trí và thuộc tính.
Đặt thuộc tính cho trang thông tin
Để đặt thuộc tính bằng locations.updateAttributes, hãy đặt tham số attributeMask bằng các thuộc tính mà bạn muốn cập nhật.
Ví dụ sau đây đặt các loại thẻ tín dụng được chấp nhận và thuộc tính lựa chọn giao hàng cho một trang thông tin.
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" ] } } ] }