# Multiple ticket types

Create a reservation for multiple tickettypes

## Description:

With this functionality you can create a reservation

**Note**\
Reservations are by default valid for 15 minutes. Please use “reservationValidUntil” to prevent errors at the completeReservation method.

**HMAC calculation:**

<br />

Base64 encode - SHA256(apiKey + ticketDate + tickets)

<br />

HMAC key calculation of tickets array is as follows

Example:

```php
$array = \[
  '321' => [ 'ticketNumber' => 2, 'ticketTime' => '10:00' ],
  '123' => [ 'ticketTime' => '12:00', 'ticketNumber' => 3 ],
];
```

ticketTypeId sorted ascending, and data array keys are sorted alphabetically, values are concatenated:

```php
$result = '123312:00321210:00';
```

<br />

*only include optional params in the HMAC if you are using those params*.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Scan API",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://globalticket.com/webservices/scanapi"
    }
  ],
  "security": [
    {}
  ],
  "paths": {
    "/  createReservation": {
      "post": {
        "summary": "Multiple ticket types",
        "description": "Create a reservation for multiple tickettypes",
        "operationId": "createreservation-multiple",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "apiKey",
                  "HMACKey"
                ],
                "properties": {
                  "apiKey": {
                    "type": "string",
                    "description": "Your public apiKey needs to be included in every request"
                  },
                  "ticketDate": {
                    "type": "string",
                    "description": "Date of the tickets that the reservation has to be created for",
                    "default": "YYYY-MM-DD",
                    "format": "date"
                  },
                  "tickets": {
                    "properties": {
                      "ticketTypeId": {
                        "properties": {
                          "ticketNumber": {
                            "type": "integer",
                            "description": "The number of ticket for a ticket type",
                            "format": "int32"
                          },
                          "ticketTime": {
                            "type": "string",
                            "description": "The timeslot for a ticket type"
                          }
                        },
                        "required": [],
                        "type": "object"
                      }
                    },
                    "required": [],
                    "type": "object"
                  },
                  "HMACKey": {
                    "type": "string",
                    "description": "The HMACKey is calculated based on the input fields"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n\t\"success\": true,\n\t\"reservationId\": 1,\n\t\"reservationValidUntil\": \"2026-05-29 10:00:00\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true,
                      "default": true
                    },
                    "reservationId": {
                      "type": "integer",
                      "example": 1,
                      "default": 0
                    },
                    "reservationValidUntil": {
                      "type": "string",
                      "example": "2026-05-29 10:00:00"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n\t\"success\":false,\n\t\"errorMessage\":\"No tickets available.\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false,
                      "default": true
                    },
                    "errorMessage": {
                      "type": "string",
                      "example": "No tickets available."
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true,
  "_id": "62b1d31f161f1601e7ec3d31:6a197c0b27b0545870897cdc"
}
```