Reservations
Before you can buy a ticket
, it first needs to be reserved in the ​OpenTicket system. Only when a ticket has been reserved, it can be added to an order. This system has two benefits. Firstly, reservations allow you to finish their order in a reasonable time without being rushed. Secondly, by requiring a ticket to be reserved before it can be added to an order
, it will never happen that more tickets are ordered than that there are available.
Reservations last for 8 minutes, and have to be made for every ticket that need to be part of an order
. After the 8 minutes have passed, a reservation will automatically drop, and a ticket had to be reserved again before the process of creating an order can continue.
Creating reservations​
Thus, you first need to reserve a ticket
. For this, you need the following information:
shopGUID
: the GUID of the shop through which the ticket will be sold.ticketGUID
: the GUID of the ticket which is being ordered.
Use the required information to make a GET request to https://shop.api.openticket.tech/:shopGUID/reserve/ticket/:ticketGUID
. All the required information is embedded in the endpoint URL. See the following code blocks for examples of such requests.
- PHP
- GO
- Node
- Shell
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $accessToken"
],
CURLOPT_URL => "https://shop.api.openticket.tech/$shopGUID/reserve/ticket/$ticketGUID"
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
req, _ := http.NewRequest("PUT", "https://shop.api.openticket.tech/" + shopGUID + "/reserve/ticket/" + ticketGUID, bytes.NewBuffer(body))
req.Header.Add("Authorization", "Bearer " + accessToken)
resp, _ := http.DefaultClient.Do(req)
respBody, _ := io.ReadAll(resp.Body)
fmt.Println(string(respBody))
const options = {
"method": "GET",
"headers": {
"Authorization": `Bearer ${accessToken}`
}
};
fetch(`https://shop.api.openticket.tech/${shopGUID}/reserve/ticket/${ticketGUID}`, options)
.then(response => response.json())
.then(response => console.log(response))
curl -X GET \
-H "Authorization: Bearer $accessToken" \
"https://shop.api.openticket.tech/$shopGUID/reserve/ticket/$ticketGUID"
{
"reservation": "3bb763e0-611c-11ee-8764-cfd48e22cbd7",
"childReservations": {
"Product": {
"1b3760ca-c999-4b24-8e51-ea4ab4552957": [
"3bb59850-611c-11ee-abed-a91d3fef3b1b"
],
"23e91fdb-9a37-41eb-8a5c-c1cb4bc66a18": [
"3bb6d550-611c-11ee-9919-75d519897a5f"
]
}
}
}
The response to the request indicates that a ticket
has successfully been reserved. As you can see, the response contains a product
fields as well. These fields are used to complete an order, but will not be explained in depth. However, note that the GUID
s listed correspond to the ticketGUID
and the GUID
of the eventDate
attached to this ticket
.
For the shown API requests, the https://shop.api.openticket.tech
endpoint is used, which is slightly different from the https://api.openticket.tech
endpoint that was used in the documentation thus far.