Starter KitFumadocs

Buy museum tickets

Purchase museum tickets for general entry or special events.

POST
/tickets
AuthorizationBasic <token>

In: header

email?string

Email address for ticket purchaser.

Formatemail
ticketId?string

Unique identifier for museum ticket. Generated when purchased.

Formatuuid
ticketDatestring

Date when this ticket can be used for museum entry.

Formatdate
ticketTypestring

Type of ticket being purchased. Use general for regular museum entry and event for tickets to special events.

Value in"event" | "general"
eventId?string

Unique identifier for a special event. Required if purchasing tickets for the museum's special events.

Formatuuid

Response Body

curl -X POST "https://redocly.com/_mock/docs/openapi/museum-api/tickets" \
  -H "Content-Type: application/json" \
  -d '{
    "ticketType": "general",
    "ticketDate": "2023-09-07",
    "email": "todd@example.com"
  }'
const body = JSON.stringify({
  "ticketType": "general",
  "ticketDate": "2023-09-07",
  "email": "todd@example.com"
})

fetch("https://redocly.com/_mock/docs/openapi/museum-api/tickets", {
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://redocly.com/_mock/docs/openapi/museum-api/tickets"
  body := strings.NewReader(`{
    "ticketType": "general",
    "ticketDate": "2023-09-07",
    "email": "todd@example.com"
  }`)
  req, _ := http.NewRequest("POST", url, body)
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://redocly.com/_mock/docs/openapi/museum-api/tickets"
body = {
  "ticketType": "general",
  "ticketDate": "2023-09-07",
  "email": "todd@example.com"
}
response = requests.request("POST", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import java.time.Duration;
import java.net.http.HttpRequest.BodyPublishers;

var body = BodyPublishers.ofString("""{
  "ticketType": "general",
  "ticketDate": "2023-09-07",
  "email": "todd@example.com"
}""");
HttpClient client = HttpClient.newBuilder()
  .connectTimeout(Duration.ofSeconds(10))
  .build();

HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
  .uri(URI.create("https://redocly.com/_mock/docs/openapi/museum-api/tickets"))
  .header("Content-Type", "application/json")
  .POST(body)
  .build();

try {
  HttpResponse<String> response = client.send(requestBuilder.build(), BodyHandlers.ofString());
  System.out.println("Status code: " + response.statusCode());
  System.out.println("Response body: " + response.body());
} catch (Exception e) {
  e.printStackTrace();
}
using System;
using System.Net.Http;
using System.Text;

var body = new StringContent("""
{
  "ticketType": "general",
  "ticketDate": "2023-09-07",
  "email": "todd@example.com"
}
""", Encoding.UTF8, "application/json");

var client = new HttpClient();
var response = await client.PostAsync("https://redocly.com/_mock/docs/openapi/museum-api/tickets", body);
var responseBody = await response.Content.ReadAsStringAsync();

{
  "message": "Museum general entry ticket purchased",
  "ticketId": "382c0820-0530-4f4b-99af-13811ad0f17a",
  "ticketType": "general",
  "ticketDate": "2023-09-07",
  "confirmationCode": "ticket-general-e5e5c6-dce78"
}

{
  "type": "object",
  "title": "Validation failed"
}
{
  "type": "object",
  "title": "Validation failed"
}