添加服务

商家可以将他们提供的服务添加到商家资料的商家信息中。这可能包括在实体店内提供的服务或在客户营业地点提供的服务。

资格条件和格式

并非所有商家都可以向其商家资料中的商家信息添加服务。如需查看资格条件,请在元数据中检查 canModifyServiceList 的状态。

服务表示为 ServiceItem,支持以下两种格式:

按类别名称列出预定义服务

要按类别名称搜索某个类别下的预定义服务,请使用 categories.list。以下“请求”部分中显示了针对新加坡境内所有类别且包含名称“salon”的请求。

请求

CategoryView 必须设置为 FULL

<ph type="x-smartling-placeholder">
</ph> <ph type="x-smartling-placeholder">
</ph>
HTTP
GET https://mybusinessbusinessinformation.googleapis.com/v1/categories?regionCode=SG&languageCode=EN&filter=displayname=salon&view=FULL

响应

以下部分响应会返回所有受支持的 ServiceTypes

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

按类别 ID 列出预定义服务

要按特定类别 ID 搜索预定义服务,请使用 categories.batchGet。以下“请求”部分中显示了一项针对美国境内类别 ID gcid:electrician 下的详细信息的请求。

请求

CategoryView 必须设置为 FULL

<ph type="x-smartling-placeholder">
</ph> <ph type="x-smartling-placeholder">
</ph>
HTTP
GET https://mybusinessbusinessinformation.googleapis.com/v1/categories:batchGet?regionCode=US&languageCode=en&names=gcid:electrician&view=FULL

响应

响应包含 gcid:electrician 的所有受支持的 ServiceTypes

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

在商家信息中列出现有服务

如需获取当前的服务列表,请使用 locations.get 并设置 readMask=serviceItems

请求

<ph type="x-smartling-placeholder">
</ph> <ph type="x-smartling-placeholder">
</ph>
HTTP
GET https://mybusinessbusinessinformation.googleapis.com/v1/locations/{locationId}?readMask=serviceItems

响应

以下是示例响应

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

为商家信息设置服务

如需更新服务,请使用 locations.patchupdateMask=serviceItems。不支持更新个别服务。

如需使用 StructuredServiceItemFreeFormServiceItem 设置服务,请参阅以下示例:

<ph type="x-smartling-placeholder">
</ph> <ph type="x-smartling-placeholder">
</ph>
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"
            }
         }
      }
   ]
}