创建 bookingBusiness
本文内容
命名空间:microsoft.graph
重要
Microsoft Graph /beta
版本下的 API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
在租户中创建新的Microsoft Bookings业务。
这是设置Bookings业务的第一步,必须在其中指定业务显示名称。 可以包括其他信息,例如业务地址、网站地址和计划策略,或者稍后通过 更新 bookingBusiness 来设置该信息。
此 API 可用于以下国家级云部署 。
全局服务
美国政府 L4
美国政府 L5 (DOD)
由世纪互联运营的中国
✅
✅
✅
❌
权限
为此 API 选择标记为最低特权的权限。
只有在应用需要它时 ,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型 。 要了解有关这些权限的详细信息,请参阅 权限参考 。
权限类型
最低特权权限
更高特权权限
委派(工作或学校帐户)
Bookings.Manage.All
不可用。
委派(个人 Microsoft 帐户)
不支持。
不支持。
应用程序
不支持。
不支持。
HTTP 请求
POST /solutions/bookingbusinesses
名称
说明
Authorization
Bearer {code}
请求正文
在请求正文中,提供 bookingBusiness 对象的 JSON 表示形式。
响应
如果成功,此方法在 201, Created
响应正文中返回响应代码和 bookingBusiness 对象。
示例
请求
以下示例显示了一个请求。
POST https://graph.microsoft.com/beta/solutions/bookingbusinesses
Content-type: application/json
{
"displayName":"Fourth Coffee",
"address":{
"postOfficeBox":"P.O. Box 123",
"street":"4567 Main Street",
"city":"Buffalo",
"state":"NY",
"countryOrRegion":"USA",
"postalCode":"98052"
},
"phone":"206-555-0100",
"email":"manager@fourthcoffee.com",
"webSiteUrl":"https://www.fourthcoffee.com",
"defaultCurrencyIso":"USD"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new BookingBusiness
{
DisplayName = "Fourth Coffee",
Address = new PhysicalAddress
{
PostOfficeBox = "P.O. Box 123",
Street = "4567 Main Street",
City = "Buffalo",
State = "NY",
CountryOrRegion = "USA",
PostalCode = "98052",
},
Phone = "206-555-0100",
Email = "manager@fourthcoffee.com",
WebSiteUrl = "https://www.fourthcoffee.com",
DefaultCurrencyIso = "USD",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Solutions.BookingBusinesses.PostAsync(requestBody);
mgc-beta solutions booking-businesses create --body '{\
"displayName":"Fourth Coffee",\
"address":{\
"postOfficeBox":"P.O. Box 123",\
"street":"4567 Main Street",\
"city":"Buffalo",\
"state":"NY",\
"countryOrRegion":"USA",\
"postalCode":"98052"\
},\
"phone":"206-555-0100",\
"email":"manager@fourthcoffee.com",\
"webSiteUrl":"https://www.fourthcoffee.com",\
"defaultCurrencyIso":"USD"\
}\
'
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewBookingBusiness()
displayName := "Fourth Coffee"
requestBody.SetDisplayName(&displayName)
address := graphmodels.NewPhysicalAddress()
postOfficeBox := "P.O. Box 123"
address.SetPostOfficeBox(&postOfficeBox)
street := "4567 Main Street"
address.SetStreet(&street)
city := "Buffalo"
address.SetCity(&city)
state := "NY"
address.SetState(&state)
countryOrRegion := "USA"
address.SetCountryOrRegion(&countryOrRegion)
postalCode := "98052"
address.SetPostalCode(&postalCode)
requestBody.SetAddress(address)
phone := "206-555-0100"
requestBody.SetPhone(&phone)
email := "manager@fourthcoffee.com"
requestBody.SetEmail(&email)
webSiteUrl := "https://www.fourthcoffee.com"
requestBody.SetWebSiteUrl(&webSiteUrl)
defaultCurrencyIso := "USD"
requestBody.SetDefaultCurrencyIso(&defaultCurrencyIso)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
bookingBusinesses, err := graphClient.Solutions().BookingBusinesses().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
BookingBusiness bookingBusiness = new BookingBusiness();
bookingBusiness.setDisplayName("Fourth Coffee");
PhysicalAddress address = new PhysicalAddress();
address.setPostOfficeBox("P.O. Box 123");
address.setStreet("4567 Main Street");
address.setCity("Buffalo");
address.setState("NY");
address.setCountryOrRegion("USA");
address.setPostalCode("98052");
bookingBusiness.setAddress(address);
bookingBusiness.setPhone("206-555-0100");
bookingBusiness.setEmail("manager@fourthcoffee.com");
bookingBusiness.setWebSiteUrl("https://www.fourthcoffee.com");
bookingBusiness.setDefaultCurrencyIso("USD");
BookingBusiness result = graphClient.solutions().bookingBusinesses().post(bookingBusiness);
const options = {
authProvider,
};
const client = Client.init(options);
const bookingBusiness = {
displayName: 'Fourth Coffee',
address: {
postOfficeBox: 'P.O. Box 123',
street: '4567 Main Street',
city: 'Buffalo',
state: 'NY',
countryOrRegion: 'USA',
postalCode: '98052'
},
phone: '206-555-0100',
email: 'manager@fourthcoffee.com',
webSiteUrl: 'https://www.fourthcoffee.com',
defaultCurrencyIso: 'USD'
};
await client.api('/solutions/bookingbusinesses')
.version('beta')
.post(bookingBusiness);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\BookingBusiness;
use Microsoft\Graph\Beta\Generated\Models\PhysicalAddress;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new BookingBusiness();
$requestBody->setDisplayName('Fourth Coffee');
$address = new PhysicalAddress();
$address->setPostOfficeBox('P.O. Box 123');
$address->setStreet('4567 Main Street');
$address->setCity('Buffalo');
$address->setState('NY');
$address->setCountryOrRegion('USA');
$address->setPostalCode('98052');
$requestBody->setAddress($address);
$requestBody->setPhone('206-555-0100');
$requestBody->setEmail('manager@fourthcoffee.com');
$requestBody->setWebSiteUrl('https://www.fourthcoffee.com');
$requestBody->setDefaultCurrencyIso('USD');
$result = $graphServiceClient->solutions()->bookingBusinesses()->post($requestBody)->wait();
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.booking_business import BookingBusiness
from msgraph_beta.generated.models.physical_address import PhysicalAddress
graph_client = GraphServiceClient(credentials, scopes)
request_body = BookingBusiness(
display_name = "Fourth Coffee",
address = PhysicalAddress(
post_office_box = "P.O. Box 123",
street = "4567 Main Street",
city = "Buffalo",
state = "NY",
country_or_region = "USA",
postal_code = "98052",
),
phone = "206-555-0100",
email = "manager@fourthcoffee.com",
web_site_url = "https://www.fourthcoffee.com",
default_currency_iso = "USD",
)
result = await graph_client.solutions.booking_businesses.post(request_body)
在请求正文中,提供 bookingBusiness 对象的 JSON 表示形式。
响应
以下示例显示了相应的响应。 注意:为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 201 Created
Content-type: application/json
{
"@odata.context":"https://graph.microsoft.com/beta/$metadata#solutions/bookingBusinesses/$entity",
"id":"fourthcoffee@contoso.com",
"displayName":"Fourth Coffee",
"businessType":"",
"phone":"206-555-0100",
"email":"manager@fourthcoffee.com",
"webSiteUrl":"https://www.fourthcoffee.com",
"defaultCurrencyIso":"USD",
"isPublished":false,
"publicUrl":null,
"address":{
"postOfficeBox":"P.O. Box 123",
"street":"4567 Main Street",
"city":"Buffalo",
"state":"NY",
"countryOrRegion":"USA",
"postalCode":"98052"
},
"businessHours":[
{
"day":"monday",
"timeSlots":[
{
"start":"08:00:00.0000000",
"end":"17:00:00.0000000"
}
]
},
{
"day":"tuesday",
"timeSlots":[
{
"start":"08:00:00.0000000",
"end":"17:00:00.0000000"
}
]
},
{
"day":"wednesday",
"timeSlots":[
{
"start":"08:00:00.0000000",
"end":"17:00:00.0000000"
}
]
},
{
"day":"thursday",
"timeSlots":[
{
"start":"08:00:00.0000000",
"end":"17:00:00.0000000"
}
]
},
{
"day":"friday",
"timeSlots":[
{
"start":"08:00:00.0000000",
"end":"17:00:00.0000000"
}
]
},
{
"day":"saturday",
"timeSlots":[
]
},
{
"day":"sunday",
"timeSlots":[
]
}
],
"languageTag":"en-US",
"schedulingPolicy":{
"timeSlotInterval":"PT30M",
"minimumLeadTime":"P1D",
"maximumAdvance":"P365D",
"sendConfirmationsToOwner":true,
"allowStaffSelection":true
}
}