Developer docs

.NET quickstart

Install BookDinePlay.Sdk, register the typed client with a secret key and make a first booking from C# — find a free table and reserve it in one method.

You will add the SDK to a .NET 10 application, register the client and book a table from code. You need a secret API key and a venue slug.

1. Get a secret key

In the console open Venue → API keys and create a key of type Secret. It is shown once: copy it into your configuration right away, for local work with dotnet user-secrets:

dotnet user-secrets set "BookDinePlay:ApiKey" "<your secret key>"

A secret key is valid for every route of its venue, so it lives in configuration or a secret store, never in source and never in a client application. A publishable key does not work in the SDK: the API refuses one without a browser Origin.

2. Install and register

dotnet add package BookDinePlay.Sdk

In Program.cs:

builder.Services.AddBookDinePlayClient(
    new Uri("https://api.bookdineplay.com"),
    builder.Configuration["BookDinePlay:ApiKey"]!);

This registers IBookDinePlayClient for injection. Every request carries the key as X-BookDinePlay-Key, and reservation creates get an Idempotency-Key for you so a transport retry can never book twice.

3. Make the first booking

Inject IBookDinePlayClient wherever you need it and call it. This looks at the next two weeks for the first day with a free table for four, then books it at the demo venue:

using BookDinePlay.Domain;
using BookDinePlay.Sdk;
using BookDinePlay.Shared.Contracts;

var today = DateOnly.FromDateTime(DateTime.Today);

// Look at the next two weeks for the first day with a free table for four.
AvailabilityResponse? day = null;
AvailabilitySlotDto? slot = null;
for (var offset = 1; offset <= 14 && slot is null; offset++)
{
    day = await client.GetAvailabilityAsync(
        "demo-sportsbar",
        today.AddDays(offset),
        partySize: 4,
        BookableResourceType.RestaurantTable,
        cancellationToken: cancellationToken);
    slot = day?.Slots.FirstOrDefault(s => s.Available);
}

if (day is null || slot is null)
{
    Console.WriteLine("Nothing free in the next two weeks.");
    return;
}

var reservation = await client.CreateReservationAsync("demo-sportsbar", new CreateReservationRequest
{
    ResourceType = BookableResourceType.RestaurantTable,
    ResourceId = slot.ResourceId,
    Date = day.Date,
    Start = slot.Start,
    PartySize = 4,
    CustomerName = "Jana Berger",
    Email = "jana@example.com",
}, Guid.NewGuid().ToString(), cancellationToken);

Console.WriteLine($"Booked {reservation.Reference} on {reservation.Date} at {reservation.Start} ({reservation.Status})");

Replace demo-sportsbar with your own slug once your key belongs to your venue. Date is yyyy-MM-dd and Start is HH:mm, both in the venue's local time, exactly as the availability answered. The key passed as the fourth argument is the idempotency key: reuse the same value for a retry of the same attempt and the API returns the original reservation instead of a second one.

Check that it worked

The program prints a reference such as BDP-7Q2M4K and Confirmed. The reservation is also in the console's reservation list; cancel it there to free the slot. A Pending status means the venue asks for a deposit first (Deposits).

If it does not work

  • BookDinePlayApiException with status 401. The key is missing, mistyped or revoked, or the configuration path BookDinePlay:ApiKey is empty.
  • Status 403 and origin-not-allowed. You used a publishable key on a server. Use a secret one.
  • Status 409 on the booking. Someone took the slot between your two calls. Ask for availability again.
  • Nothing free in the next two weeks. The demo venue is closed on some days; try your own venue, or widen the loop.

Next steps

  • .NET SDK — every call: events, vouchers, QR ordering, specials and the exceptions they throw.
  • Reservations — what the API does with each field.
  • Deposits — take a deposit when a table is booked.