Namespace: microsoft.graph
Crie um novo objeto bookingCustomQuestion .
Essa API está disponível nas seguintes implantações nacionais de nuvem.
Serviço global |
Governo dos EUA L4 |
GOVERNO DOS EUA L5 (DOD) |
China operada pela 21Vianet |
✅ |
✅ |
✅ |
❌ |
Permissões
Escolha a permissão ou as permissões marcadas como menos privilegiadas para essa API. Use uma permissão ou permissões privilegiadas mais altas somente se o aplicativo exigir. Para obter detalhes sobre permissões delegadas e de aplicativo, consulte Tipos de permissão. Para saber mais sobre essas permissões, consulte a referência de permissões.
Tipo de permissão |
Permissões menos privilegiadas |
Permissões privilegiadas mais altas |
Delegado (conta corporativa ou de estudante) |
BookingsAppointment.ReadWrite.All |
Bookings. Manage.All, Bookings. ReadWrite.All |
Delegado (conta pessoal da Microsoft) |
Sem suporte. |
Sem suporte. |
Application |
Bookings.ReadWrite.All |
Bookings.Manage.All |
Solicitação HTTP
POST /solutions/bookingBusinesses/{bookingBusinessesId}/customQuestions
Nome |
Descrição |
Autorização |
{token} de portador. Obrigatório. Saiba mais sobre autenticação e autorização. |
Content-Type |
application/json. Obrigatório. |
Corpo da solicitação
No corpo da solicitação, forneça uma representação JSON de um objeto bookingCustomQuestion .
Você pode especificar as propriedades a seguir ao criar uma bookingCustomQuestion.
Propriedade |
Tipo |
Descrição |
answerInputType |
answerInputType |
O tipo de resposta esperado. Os valores possíveis são: text , radioButton , unknownFutureValue . Opcional. |
answerOptions |
Coleção de cadeias de caracteres |
Lista de possíveis valores de resposta. Opcional. |
displayName |
Cadeia de caracteres |
A pergunta. Obrigatório. |
Resposta
Se for bem-sucedido, esse método retornará um 201 Created
código de resposta e um objeto bookingCustomQuestion no corpo da resposta.
Exemplos
Solicitação
POST https://graph.microsoft.com/v1.0/solutions/bookingBusinesses/Contosolunchdelivery@contoso.com/customQuestions
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.bookingCustomQuestion",
"displayName": "What is your age?",
"answerInputType": "text",
"answerOptions" : []
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new BookingCustomQuestion
{
OdataType = "#microsoft.graph.bookingCustomQuestion",
DisplayName = "What is your age?",
AnswerInputType = AnswerInputType.Text,
AnswerOptions = new List<string>
{
},
};
// 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["{bookingBusiness-id}"].CustomQuestions.PostAsync(requestBody);
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider, consulte a documentação do SDK.
mgc solutions booking-businesses custom-questions create --booking-business-id {bookingBusiness-id} --body '{\
"@odata.type": "#microsoft.graph.bookingCustomQuestion",\
"displayName": "What is your age?",\
"answerInputType": "text",\
"answerOptions" : []\
}\
'
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider, consulte a documentação do SDK.
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewBookingCustomQuestion()
displayName := "What is your age?"
requestBody.SetDisplayName(&displayName)
answerInputType := graphmodels.TEXT_ANSWERINPUTTYPE
requestBody.SetAnswerInputType(&answerInputType)
answerOptions := []string {
}
requestBody.SetAnswerOptions(answerOptions)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
customQuestions, err := graphClient.Solutions().BookingBusinesses().ByBookingBusinessId("bookingBusiness-id").CustomQuestions().Post(context.Background(), requestBody, nil)
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider, consulte a documentação do SDK.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
BookingCustomQuestion bookingCustomQuestion = new BookingCustomQuestion();
bookingCustomQuestion.setOdataType("#microsoft.graph.bookingCustomQuestion");
bookingCustomQuestion.setDisplayName("What is your age?");
bookingCustomQuestion.setAnswerInputType(AnswerInputType.Text);
LinkedList<String> answerOptions = new LinkedList<String>();
bookingCustomQuestion.setAnswerOptions(answerOptions);
BookingCustomQuestion result = graphClient.solutions().bookingBusinesses().byBookingBusinessId("{bookingBusiness-id}").customQuestions().post(bookingCustomQuestion);
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider, consulte a documentação do SDK.
const options = {
authProvider,
};
const client = Client.init(options);
const bookingCustomQuestion = {
'@odata.type': '#microsoft.graph.bookingCustomQuestion',
displayName: 'What is your age?',
answerInputType: 'text',
answerOptions: []
};
await client.api('/solutions/bookingBusinesses/Contosolunchdelivery@contoso.com/customQuestions')
.post(bookingCustomQuestion);
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider, consulte a documentação do SDK.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\BookingCustomQuestion;
use Microsoft\Graph\Generated\Models\AnswerInputType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new BookingCustomQuestion();
$requestBody->setOdataType('#microsoft.graph.bookingCustomQuestion');
$requestBody->setDisplayName('What is your age?');
$requestBody->setAnswerInputType(new AnswerInputType('text'));
$requestBody->setAnswerOptions([ ]);
$result = $graphServiceClient->solutions()->bookingBusinesses()->byBookingBusinessId('bookingBusiness-id')->customQuestions()->post($requestBody)->wait();
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider, consulte a documentação do SDK.
Import-Module Microsoft.Graph.Bookings
$params = @{
"@odata.type" = "#microsoft.graph.bookingCustomQuestion"
displayName = "What is your age?"
answerInputType = "text"
answerOptions = @(
)
}
New-MgBookingBusinessCustomQuestion -BookingBusinessId $bookingBusinessId -BodyParameter $params
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider, consulte a documentação do SDK.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.booking_custom_question import BookingCustomQuestion
from msgraph.generated.models.answer_input_type import AnswerInputType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = BookingCustomQuestion(
odata_type = "#microsoft.graph.bookingCustomQuestion",
display_name = "What is your age?",
answer_input_type = AnswerInputType.Text,
answer_options = [
],
)
result = await graph_client.solutions.booking_businesses.by_booking_business_id('bookingBusiness-id').custom_questions.post(request_body)
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider, consulte a documentação do SDK.
Resposta
Observação: o objeto de resposta mostrado aqui pode ser encurtado para legibilidade.
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.bookingCustomQuestion",
"id": "3bc6fde0-4ad3-445d-ab17-0fc15dba0774",
"displayName": "What is your age?",
"answerInputType": "text",
"answerOptions": [],
}