Thêm thuộc tính

Các thuộc tính giúp doanh nghiệp cung cấp thêm thông tin, chẳng hạn như các phương án hỗ trợ người khuyết tật và tiện nghi.

Thuộc tính trang thông tin

Để xem danh sách các thuộc tính cho một danh mục chính và quốc gia, hãy yêu cầu attributes.list. Thuộc tính có tính linh động và cần được truy xuất thường xuyên. Hãy xem ví dụ ở phần sau đây.

Yêu cầu

Để liệt kê các thuộc tính cho một trang thông tin cụ thể dựa trên danh mục, mã vùng và mã ngôn ngữ của trang thông tin, hãy tham khảo yêu cầu mẫu dưới đây:

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

Để liệt kê các thuộc tính cho một trang thông tin cụ thể bằng mã vị trí của trang thông tin đó, hãy tham khảo yêu cầu mẫu ở bên dưới:

HTTP
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 thuộc tính có nhiều giá trị AttributeValueType.

{
    {
      "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"
      }
    }
  ]
}

Đặt thuộc tính cho một trang thông tin

Để thiết lập 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 tùy chọn giao hàng cho một trang thông tin.

HTTP
PATCH
https://mybusinessbusinessinformation.googleapis.com/v1/locations/{locationId}?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"
        ]
      }
    }
  ]
}