使用 Microsoft Graph 中的 Microsoft Bookings APIUse the Microsoft Bookings API in Microsoft Graph

重要

Microsoft Graph 中/beta的版本下的 api 可能会发生更改。APIs under the /beta version in Microsoft Graph are subject to change. 在生产应用程序中不支持使用这些 API。Use of these APIs in production applications is not supported.

Microsoft Bookings 可让小型企业所有者以最少量的设置管理客户预订和信息。Microsoft Bookings lets small business owners manage customer bookings and information with minimal setup. 企业所有者可以创建一个或多个企业,每个企业都提供一组服务。A business owner can create one or more businesses, with each business offering a set of services. 所有者可以设置员工,并指定每名员工执行的服务。The owner can set up staff members, and specify the services that each staff member performs. 客户可以通过在线或移动应用预约该企业中的特定服务。A customer can book an appointment for a specific service in that business in an online or mobile app. Bookings 可确保为企业、员工和相关客户保持最新的约会时间。Bookings ensures that the appointment time is kept up-to-date for the business, staff members, and customers involved.

就编程而言,Bookings API 中的 bookingBusiness 涉及以下对象:Programmatically, a bookingBusiness in the Bookings API involves the following objects:

使用 Bookings REST APIUsing the Bookings REST API

第一次客户预约之前,请完成以下步骤。Walk through the following steps before booking customer appointments for a business the first time. 确保为相应的操作提供适当的访问令牌Make sure you provide the appropriate access tokens for the corresponding operations.

  1. 确保企业具有 Office 365 商业高级版订阅。Make sure the business has an Office 365 Business Premium subscription.
  2. 通过向实体集发送 POST 操作来创建新的 bookingBusinessCreate a new bookingBusiness by sending a POST operation to the entity set. 至少应为新企业指定客户将看到的名称:At minimum, you should specify a name for the new business that customers will see:
POST https://graph.microsoft.com/beta/bookingBusinesses
Authorization: Bearer {access token}
Content-Type: application/json

{
    "displayName":"Contoso"
}

使用 POST 响应中返回的新 bookingBusinessid 属性继续自定义企业设置,并为企业添加员工和服务。Use the id property of the new bookingBusiness returned in the POST response to continue to customize business settings, and add staff members and services for the business.

  1. 为企业添加各个员工:Add individual staff members for the business:
POST https://graph.microsoft.com/beta/bookingBusinesses/{id}/staffMembers
Authorization: Bearer {access token}
Content-Type: application/json

{
    "displayName":"Dana Swope",
    "emailAddress": "danas@contoso.com",
    "role": "externalGuest"
}
  1. 定义企业提供的每项服务:Define each service offered by the business:
POST https://graph.microsoft.com/beta/bookingBusinesses/{id}/services
Authorization: Bearer {access token}
Content-Type: application/json

{
    "displayName":"Bento"
}
  1. 发布企业的日程安排页面,让客户和企业经营者开始预约:Publish the scheduling page for the business, to let customers and business operators start booking appointments:
POST https://graph.microsoft.com/beta/bookingBusinesses/{id}/publish
Authorization: Bearer {access token}

通常,若要列出 Office 365 租户中的所有预订企业:In general, to list all the booking businesses in the Office 365 tenant:

GET https://graph.microsoft.com/beta/bookingBusinesses
Authorization: Bearer {access token}

常见用例Common use cases

下表列出了 Bookings API 中的常见企业操作。The following table lists the common operations for a business in the Bookings API.

用例Use cases REST 资源REST resources 另请参阅See also
创建、获取、更新或删除企业Create, get, update, or delete a business bookingBusinessbookingBusiness bookingBusiness 的方法Methods of bookingBusiness
更新日程安排策略Update the scheduling policy bookingSchedulingPolicybookingSchedulingPolicy 更新 bookingBusinessUpdate a bookingBusiness
添加、获取、更新或删除员工Add, get, update, or delete staff members bookingStaffMemberbookingStaffMember bookingStaffMember 的方法Methods of bookingStaffMember
添加、获取、更新或删除服务Add, get, update, or delete services bookingServicebookingService bookingService 的方法Methods of bookingService
发布或取消发布日程安排页面Publish or unpublish the scheduling page bookingBusinessbookingBusiness 发布publish
取消发布unpublish
创建、获取、更新、删除或取消约会Create, get, update, delete, or cancel an appointment bookingAppointmentbookingAppointment bookingAppointment 的方法Methods of bookingAppointment
获取某个日期范围内的约会Get appointments in a date range bookingBusinessbookingBusiness 列出 Bookings 日历视图List Bookings calendarView
获取货币Get currency bookingCurrencybookingCurrency bookingCurrency 的方法Methods of bookingCurrency

另请参阅See also