Read appointment-booking configuration
Read the appointment-booking configuration for a service to drive your own scheduling UI.
When to use this pattern
- You're building a scheduling front-end on ServiceNow's appointment-booking rules
- You need booking settings (active, acceptance, formats) before offering slots
Required values
| Value | Description |
|---|---|
| Service configuration | Identified via the request configuration's query parameters |
Example
package main
import (
"context"
"fmt"
"log"
servicenow "github.com/michaeldcanady/servicenow-sdk-go/v2"
"github.com/michaeldcanady/servicenow-sdk-go/v2/credentials"
)
func main() {
// Step 1: Authenticate and initialize the client
cred := credentials.NewBasicProvider("{username}", "{password}")
client, err := servicenow.NewServiceNowServiceClient(
servicenow.WithAuthenticationProvider(cred),
servicenow.WithInstance("{instance}"),
)
if err != nil {
log.Fatalf("failed to initialize client: %v", err)
}
ctx := context.Background()
// Step 2: Read the booking configuration for your service
response, err := client.AppointmentBooking().Configuration().Get(ctx, nil)
if err != nil {
log.Fatalf("configuration request failed: %v", err)
}
// Step 3: Read settings out of the result
result, err := response.GetResult()
if err != nil {
log.Fatal(err)
}
active, err := result.GetActive()
if err != nil {
log.Fatal(err)
}
if active != nil {
fmt.Printf("appointment booking active: %t\n", *active)
}
}
Tips
- The module also models
Availability()andAppointment()for checking slots and booking them — see the reference for the request shapes.