Create bookingBusiness
Article
09/27/2023
7 contributors
Feedback
In this article
Namespace: microsoft.graph
Create a new Microsoft Bookings business in a tenant.
This is the first step in setting up a Bookings business where you must specify the business display name. You can include other information such as business address, web site address, and scheduling policy, or set that information later by updating the bookingBusiness .
This API is supported in the following national cloud deployments .
Global service
US Government L4
US Government L5 (DOD)
China operated by 21Vianet
✅
❌
❌
❌
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions .
Permission type
Permissions (from least to most privileged)
Delegated (work or school account)
Bookings.Manage.All
Delegated (personal Microsoft account)
Not supported.
Application
Not supported.
HTTP request
POST /solutions/bookingBusinesses
Name
Description
Authorization
Bearer {code}
Request body
In the request body, supply a JSON representation of a bookingBusiness object.
Response
If successful, this method returns a 201 Created
response code and a bookingBusiness object in the response body.
Example
Request
The following is an example of the request.
POST https://graph.microsoft.com/v1.0/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
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new BookingBusiness
{
DisplayName = "Fourth Coffee",
Address = new PhysicalAddress
{
Street = "4567 Main Street",
City = "Buffalo",
State = "NY",
CountryOrRegion = "USA",
PostalCode = "98052",
AdditionalData = new Dictionary<string, object>
{
{
"postOfficeBox" , "P.O. Box 123"
},
},
},
Phone = "206-555-0100",
Email = "manager@fourthcoffee.com",
WebSiteUrl = "https://www.fourthcoffee.com",
DefaultCurrencyIso = "USD",
};
var result = await graphClient.Solutions.BookingBusinesses.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc 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"\
}\
'
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestBody := graphmodels.NewBookingBusiness()
displayName := "Fourth Coffee"
requestBody.SetDisplayName(&displayName)
address := graphmodels.NewPhysicalAddress()
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)
additionalData := map[string]interface{}{
"postOfficeBox" : "P.O. Box 123",
}
address.SetAdditionalData(additionalData)
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)
bookingBusinesses, err := graphClient.Solutions().BookingBusinesses().Post(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
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')
.post(bookingBusiness);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?php
// THIS SNIPPET IS A PREVIEW VERSION OF THE SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new BookingBusiness();
$requestBody->setDisplayName('Fourth Coffee');
$address = new PhysicalAddress();
$address->setStreet('4567 Main Street');
$address->setCity('Buffalo');
$address->setState('NY');
$address->setCountryOrRegion('USA');
$address->setPostalCode('98052');
$additionalData = [
'postOfficeBox' => 'P.O. Box 123',
];
$address->setAdditionalData($additionalData);
$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();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Import-Module Microsoft.Graph.Bookings
$params = @{
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"
}
New-MgBookingBusiness -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
# THE PYTHON SDK IS IN PREVIEW. FOR NON-PRODUCTION USE ONLY
graph_client = GraphServiceClient(request_adapter)
request_body = BookingBusiness(
display_name = "Fourth Coffee",
address = PhysicalAddress(
street = "4567 Main Street",
city = "Buffalo",
state = "NY",
country_or_region = "USA",
postal_code = "98052",
additional_data = {
"post_office_box" : "P.O. Box 123",
}
),
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(body = request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
The following is an example of the response. Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Content-type: application/json
{
"@odata.context":"https://graph.microsoft.com/v1.0/solutions/$metadata#bookingBusinesses/$entity",
"id":"fourthcoffee@contoso.onmicrosoft.com",
"displayName":"Fourth Coffee",
"businessType":"",
"phone":"206-555-0100",
"email":"manager@fourthcoffee.com",
"webSiteUrl":"https://www.fourthcoffee.com",
"languageTag":"en-US",
"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":[
{
"startTime":"08:00:00.0000000",
"endTime":"17:00:00.0000000"
}
]
},
{
"day":"tuesday",
"timeSlots":[
{
"startTime":"08:00:00.0000000",
"endTime":"17:00:00.0000000"
}
]
},
{
"day":"wednesday",
"timeSlots":[
{
"startTime":"08:00:00.0000000",
"endTime":"17:00:00.0000000"
}
]
},
{
"day":"thursday",
"timeSlots":[
{
"startTime":"08:00:00.0000000",
"endTime":"17:00:00.0000000"
}
]
},
{
"day":"friday",
"timeSlots":[
{
"startTime":"08:00:00.0000000",
"endTime":"17:00:00.0000000"
}
]
},
{
"day":"saturday",
"timeSlots":[
]
},
{
"day":"sunday",
"timeSlots":[
]
}
],
"schedulingPolicy":{
"timeSlotInterval":"PT30M",
"minimumLeadTime":"P1D",
"maximumAdvance":"P365D",
"sendConfirmationsToOwner":true,
"allowStaffSelection":true
}
}