Thêm dịch vụ

Doanh nghiệp có thể thêm các dịch vụ mà họ cung cấp vào trang thông tin trên Trang doanh nghiệp. Trong đó có thể bao gồm các dịch vụ được cung cấp tại cửa hàng hoặc các dịch vụ được cung cấp tại địa điểm của khách hàng.

Điều kiện sử dụng và định dạng

Không phải doanh nghiệp nào cũng có thể thêm dịch vụ vào Trang doanh nghiệp của mình. Để kiểm tra trạng thái đủ điều kiện, hãy kiểm tra trạng thái của canModifyServiceList trong Siêu dữ liệu.

Dịch vụ được biểu thị dưới dạng ServiceItem, hỗ trợ hai định dạng sau:

  • StructuredServiceItem: Các dịch vụ được xác định trước của Google có thể được trình bày dưới dạng StructuredServiceItem, có chứa serviceTypeId.
  • FreeFormServiceItem: Để cung cấp các dịch vụ tuỳ chỉnh, hãy sử dụng FreeFormServiceItem có chứa Nhãn.

Liệt kê các dịch vụ được xác định trước theo tên danh mục

Để tìm kiếm các dịch vụ được xác định trước trong một danh mục theo tên danh mục, hãy sử dụng categories.list. Một yêu cầu đối với tất cả danh mục có tên salon ở Singapore sẽ xuất hiện trong phần Yêu cầu sau đây.

Yêu cầu

Bạn phải đặt CategoryView thành FULL.

HTTP
GET https://mybusinessbusinessinformation.googleapis.com/v1/categories?regionCode=SG&languageCode=EN&filter=displayname=salon&view=FULL

Phản hồi

Phản hồi một phần sau đây trả về tất cả các ServiceTypes được hỗ trợ.

{
    "categories": [
        {
            "name": "gcid:hair_salon",
            "displayName": "Hairdresser",
            "serviceTypes": [
                {
                    "serviceTypeId": "job_type_id:body_waxing",
                    "displayName": "Body Waxing"
                },
                {
                    "serviceTypeId": "job_type_id:hair_coloring",
                    "displayName": "Hair coloring"
                },
                {
                    "serviceTypeId": "job_type_id:hair_extensions",
                    "displayName": "Hair extensions"
                },
                {
                    "serviceTypeId": "job_type_id:hair_styling",
                    "displayName": "Hair styling"
                },
                {
                    "serviceTypeId": "job_type_id:manicures",
                    "displayName": "Manicures"
                },
                {
                    "serviceTypeId": "job_type_id:pedicures",
                    "displayName": "Pedicures"
                }
            ]
        }
}

Liệt kê các dịch vụ được xác định trước theo mã danh mục

Để tìm kiếm các dịch vụ được xác định trước theo mã danh mục cụ thể, hãy sử dụng categories.batchGet. Một yêu cầu cung cấp thông tin chi tiết thuộc mã danh mục gcid:electrician ở Hoa Kỳ sẽ xuất hiện trong phần Yêu cầu sau đây.

Yêu cầu

Bạn phải đặt CategoryView thành FULL.

HTTP
GET https://mybusinessbusinessinformation.googleapis.com/v1/categories:batchGet?regionCode=US&languageCode=en&names=gcid:electrician&view=FULL

Phản hồi

Phản hồi chứa tất cả các ServiceTypes (Loại dịch vụ) được hỗ trợ cho gcid:electrician.

{
    "categories": [
        {
            "name": "gcid:electrician",
            "displayName": "Electrician",
            "serviceTypes": [
                {
                    "serviceTypeId": "job_type_id:construction",
                    "displayName": "Construction"
                },
                {
                    "serviceTypeId": "job_type_id:electric_car_charger",
                    "displayName": "Install electric car charger"
                },
                {
                    "serviceTypeId": "job_type_id:electrician_remodeling",
                    "displayName": "Remodeling"
                },
                {
                    "serviceTypeId": "job_type_id:general_repairs",
                    "displayName": "General repairs"
                },
                {
                    "serviceTypeId": "job_type_id:install_fan",
                    "displayName": "Install fan"
                },
                {
                    "serviceTypeId": "job_type_id:install_ground_wire",
                    "displayName": "Install ground wire"
                },
                {
                    "serviceTypeId": "job_type_id:install_light_fixtures",
                    "displayName": "Install light fixtures"
                },
                {
                    "serviceTypeId": "job_type_id:install_outdoor_lighting",
                    "displayName": "Install outdoor lighting"
                },
                {
                    "serviceTypeId": "job_type_id:install_outlets_switches",
                    "displayName": "Install outlets or switches"
                },
                {
                    "serviceTypeId": "job_type_id:install_security_system",
                    "displayName": "Install security system"
                },
                {
                    "serviceTypeId": "job_type_id:installation",
                    "displayName": "Installation"
                },
                {
                    "serviceTypeId": "job_type_id:relocate_outlets_switches",
                    "displayName": "Relocate outlets or switches"
                },
                {
                    "serviceTypeId": "job_type_id:repair_fan",
                    "displayName": "Repair fan"
                },
                {
                    "serviceTypeId": "job_type_id:repair_light_fixtures",
                    "displayName": "Repair light fixtures"
                },
                {
                    "serviceTypeId": "job_type_id:repair_outlets_switches",
                    "displayName": "Repair outlets or switches"
                },
                {
                    "serviceTypeId": "job_type_id:repair_panel",
                    "displayName": "Repair panel"
                },
                {
                    "serviceTypeId": "job_type_id:replace_upgrade_panel",
                    "displayName": "Replace or upgrade panel"
                },
                {
                    "serviceTypeId": "job_type_id:restore_power",
                    "displayName": "Restore power"
                }
            ]
        }
    ]
}

Liệt kê các dịch vụ hiện có trong một trang thông tin

Để xem danh sách các dịch vụ hiện tại, hãy dùng locations.get và đặtreadMask=serviceItems

Yêu cầu

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

Phản hồi

Dưới đây là câu trả lời mẫu

{
    "serviceItems": [
        {
            "structuredServiceItem": {
                "serviceTypeId": "job_type_id:hair_coloring"
            }
        },
        {
            "isOffered": true,
            "structuredServiceItem": {
                "serviceTypeId": "job_type_id:hair_styling"
            }
        },
        {
            "isOffered": true,
            "freeFormServiceItem": {
                "categoryId": "gcid:barber_shop",
                "label": {
                    "displayName": "Student Cuts"
                }
            }
        }
    ]
}

Đặt dịch vụ cho trang thông tin

Để cập nhật các dịch vụ, hãy sử dụng locations.patchupdateMask=serviceItems. Không hỗ trợ cập nhật các dịch vụ riêng lẻ.

Để đặt các dịch vụ có thuộc tính StructuredServiceItemFreeFormServiceItem, hãy xem ví dụ sau:

HTTP
PATCH
https://mybusinessbusinessinformation.googleapis.com/v1/locations/{locationId}?updateMask=serviceItems
{
   "serviceItems":[
      {
         "isOffered":false,
         "structuredServiceItem":{
            "serviceTypeId":"job_type_id:hair_coloring"
         }
      },
      {
         "isOffered":true,
         "structuredServiceItem":{
            "serviceTypeId":"job_type_id:hair_styling"
         }
      },
      {
         "isOffered":true,
         "freeFormServiceItem":{
            "categoryId":"gcid:hair_salon",
            "label":{
               "displayName":"Student Cuts"
            }
         }
      }
   ]
}