更新 bookingservice
命名空间:microsoft.graph
重要
Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
更新指定 bookingBusiness 中 bookingService 对象的属性。
下面是可以为服务自定义的一些示例:
- 价格
- 约会的典型长度
- Reminders
- 在服务之前或在服务后完成设置的任何时间缓冲区
- 计划策略 参数,例如预订或取消的最小通知,以及客户是否可以选择特定员工进行约会。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限。
| 权限类型 |
权限(从最低特权到最高特权) |
| 委派(工作或学校帐户) |
Bookings.ReadWrite.All、Bookings.Manage.All |
| 委派(个人 Microsoft 帐户) |
不支持。 |
| Application |
不支持。 |
HTTP 请求
PATCH /bookingBusinesses/{id}/services/{id}
| 名称 |
说明 |
| Authorization |
持有者 {code}。必需。 |
请求正文
在请求正文中,提供应更新的相关字段的值。 请求正文中不包括的现有属性将保留其以前的值,或根据对其他属性值的更改重新计算。 为了获得最佳性能,请勿加入尚未更改的现有值。
| 属性 |
类型 |
Description |
| defaultDuration |
期限 |
服务的默认长度,以天数、小时数、分钟数和秒数表示。 例如,P11D23H59M59.99999999999999999S。 |
| defaultLocation |
location |
服务的默认物理位置。 |
| defaultPrice |
双精度 |
服务的默认货币价格。 |
| defaultPriceType |
bookingPriceType |
服务收费的默认方式。 可取值为:undefined、fixedPrice、startingAt、hourly、free、priceVaries、callUs、notSet、unknownFutureValue。 |
| defaultReminders |
bookingReminder 集合 |
此服务的约会的默认提醒集。 仅当按其 ID 读取此 bookingService 时,此属性的值才可用。 |
| description |
String |
服务的文本说明。 |
| displayName |
String |
服务名称。 |
| id |
String |
只读。 |
| languageTag |
String |
自助预订页的语言。 |
| isHiddenFromCustomers |
布尔 |
True 表示此服务不可供客户预订。 |
| isLocationOnline |
布尔 |
True 表示服务的约会将联机进行。 默认值为 false。 |
| notes |
String |
有关此服务的其他信息。 |
| postBuffer |
期限 |
此服务的约会结束后和下一个客户约会可以预订之前的缓冲时间。 |
| preBuffer |
期限 |
此服务的约会开始之前的缓冲时间。 |
| schedulePolicy |
bookingSchedulingPolicy |
一组策略,用于确定应如何创建和管理此类服务的约会。 |
| smsNotificationsEnabled |
布尔 |
True 表示可以向客户发送短信通知以进行服务的约会。 默认值为 false。 |
| staffMemberIds |
字符串集合 |
表示提供此服务 的员工 。 |
| customQuestions |
bookingQuestionAssignment 集合 |
这包含与特定服务关联的一组自定义问题。 可选。 |
| maximumAttendeesCount |
Int32 |
服务中允许的最大客户数。 |
响应
如果成功,此方法返回 204 No content 响应代码。它不在响应正文中返回任何内容。
示例
请求
以下示例更新指定服务的持续时间。
PATCH https://graph.microsoft.com/beta/bookingBusinesses/Contosolunchdelivery@contoso.onmicrosoft.com/services/57da6774-a087-4d69-b0e6-6fb82c339976
Content-type: application/json
{
"@odata.type":"#microsoft.graph.bookingService",
"defaultDuration":"PT30M"
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var bookingService = new BookingService
{
DefaultDuration = new Duration("PT30M")
};
await graphClient.BookingBusinesses["{bookingBusiness-id}"].Services["{bookingService-id}"]
.Request()
.UpdateAsync(bookingService);
const options = {
authProvider,
};
const client = Client.init(options);
const bookingService = {
'@odata.type':'#microsoft.graph.bookingService',
defaultDuration: 'PT30M'
};
await client.api('/bookingBusinesses/Contosolunchdelivery@contoso.onmicrosoft.com/services/57da6774-a087-4d69-b0e6-6fb82c339976')
.version('beta')
.update(bookingService);
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/bookingBusinesses/Contosolunchdelivery@contoso.onmicrosoft.com/services/57da6774-a087-4d69-b0e6-6fb82c339976"]]];
[urlRequest setHTTPMethod:@"PATCH"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphBookingService *bookingService = [[MSGraphBookingService alloc] init];
[bookingService setDefaultDuration:@"PT30M"];
NSError *error;
NSData *bookingServiceData = [bookingService getSerializedDataWithError:&error];
[urlRequest setHTTPBody:bookingServiceData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
BookingService bookingService = new BookingService();
bookingService.defaultDuration = DatatypeFactory.newInstance().newDuration("PT30M");
graphClient.bookingBusinesses("Contosolunchdelivery@contoso.onmicrosoft.com").services("57da6774-a087-4d69-b0e6-6fb82c339976")
.buildRequest()
.patch(bookingService);
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.NewBookingService()
defaultDuration := "PT30M"
requestBody.SetDefaultDuration(&defaultDuration)
requestBody.SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.bookingService",
}
bookingBusinessId := "bookingBusiness-id"
bookingServiceId := "bookingService-id"
graphClient.BookingBusinessesById(&bookingBusinessId).ServicesById(&bookingServiceId).Patch(requestBody)
Import-Module Microsoft.Graph.Bookings
$params = @{
"@odata.type" = "#microsoft.graph.bookingService"
DefaultDuration = "PT30M"
}
Update-MgBookingBusinessService -BookingBusinessId $bookingBusinessId -BookingServiceId $bookingServiceId -BodyParameter $params
响应
下面展示了示例响应。
HTTP/1.1 204 No Content