Creating a waiting list
Creating a waiting list
The previous section of the documentation describes how to create an
event. In this part of the documentation, you will create a waiting list for this event.
For this, you need the following information:
eventGUID: GUID of the event for which the waiting list will be created.companyGUID: GUID of the company for which the waiting list will be created.type: the type of behavior the waiting list has and when it should be shown
When created a waiting list has its property enabled set to false by default.
Also the waiting list has a type, this will determine when it should show up in the shop of the event:
one_or_more_tickets_sold_outall_tickets_sold_outshow_always
The combination of the enabled and type properties mean the waiting list can have four distinct states:
- Disabled: the waiting list will not return when fetched and will never be shown to a customer
- Show when one or more tickets are sold-out - a customer should only be able to signup when one or more tickets are sold out
- Show when all tickets sold-out - a customer should only be able to signup when all tickets are sold out
- Show always - a customer should always be able to signup
First, use the required information to create a POST
request to https://waiting_list_api.openticket.tech/waiting_list. See the following
code blocks for examples of such requests and the expected response to the requests.
- PHP
- GO
- Node
- Shell
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $accessToken"
],
CURLOPT_POSTFIELDS => [
"company_id" => "d0a3f370-cd43-11ed-9c9c-bbcffde24a48",
"event_id" => "68096ad5-2eb7-45fb-977d-931b3485fe30",
"type" => "one_or_more_tickets_sold_out"
],
CURLOPT_URL => "https://waiting_list_api.openticket.tech/waiting_list"
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
payloadBuf := new(bytes.Buffer)
json.NewEncoder(payloadBuf).Encode({
"company_id": "d0a3f370-cd43-11ed-9c9c-bbcffde24a48",
"event_id": "68096ad5-2eb7-45fb-977d-931b3485fe30",
"type": "one_or_more_tickets_sold_out"
})
req, _ := http.NewRequest("PUT", "https://waiting_list_api.openticket.tech/waiting_list", 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": "POST",
"headers": {
"Authorization": `Bearer ${accessToken}`,
"Content-Type": "application/json"
},
"body": JSON.stringify({
"company_id": "d0a3f370-cd43-11ed-9c9c-bbcffde24a48",
"event_id": "68096ad5-2eb7-45fb-977d-931b3485fe30",
"type": "one_or_more_tickets_sold_out"
})
};
fetch("https://waiting_list_api.openticket.tech/waiting_list", options)
.then(response => response.json())
.then(response => console.log(response))
curl -X POST \
-H "Authorization: Bearer $accessToken" \
-F "company_id=d0a3f370-cd43-11ed-9c9c-bbcffde24a48" \
-F "event_id=68096ad5-2eb7-45fb-977d-931b3485fe30" \
-F "type=one_or_more_tickets_sold_out" \
"https://waiting_list_api.openticket.tech/waiting_list"
Response
[
{
"guid": "1b3760ca-c999-4b24-8e51-ea4ab4552957",
"company_id": "d0a3f370-cd43-11ed-9c9c-bbcffde24a48",
"event_id": "68096ad5-2eb7-45fb-977d-931b3485fe30",
"enabled": true,
"allow_quantity": false,
"allow_reseller_ticketswap": false,
"allow_reseller_tixel": false,
"type": "one_or_more_tickets_sold_out",
"created_at": "2023-10-02T13:19:32+02:00",
"updated_at": "2023-10-02T13:19:32+02:00",
"deleted_at": null
}
]
Getting waiting list
After you have created a waiting list, you can retrieve the information stored in this resource. To do this,
make a GET request to https://waiting_list_api.openticket.tech/waiting_list/:GUID. You can also make
a GET request to https://waiting_list_api.openticket.tech/waiting_list to list all ticket
resources currently stored in the OpenTicket system.
Getting a waiting list from event
To simplify retrieving a waiting list for a certain event you need the following information:
eventGUID: the GUID of an event.
This is a public route that will treat a disabled waiting list as non existent and return a 404.
- PHP
- GO
- Node
- Shell
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $accessToken"
],
CURLOPT_URL => "https://waiting_list_api.openticket.tech/event/$eventGUID/waiting_list"
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
req, _ := http.NewRequest("PUT", "https://waiting_list_api.openticket.tech/event/" + eventGUID + "/waiting_list", 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://waiting_list_api.openticket.tech/event/${eventGUID}/waiting_list`, options)
.then(response => response.json())
.then(response => console.log(response))
curl -X GET \
-H "Authorization: Bearer $accessToken" \
"https://waiting_list_api.openticket.tech/event/$eventGUID/waiting_list"
Response
[
{
"guid": "1b3760ca-c999-4b24-8e51-ea4ab4552957",
"company_id": "d0a3f370-cd43-11ed-9c9c-bbcffde24a48",
"event_id": "68096ad5-2eb7-45fb-977d-931b3485fe30",
"enabled": true,
"allow_quantity": false,
"allow_reseller_ticketswap": false,
"allow_reseller_tixel": false,
"type": "one_or_more_tickets_sold_out",
"created_at": "2023-10-02T13:19:32+02:00",
"updated_at": "2023-10-02T13:19:32+02:00",
"deleted_at": null
}
]
Updating a waiting list
To update a waiting list, you need to following information:
GUID: the GUID of the waiting list.
Use the required information to make a PUT request to
https://api.openticket.tech/waiting_list/:GUID. This request should contain a payload
containing the information that should be updated. Any information that can be associated with a
waiting list but that is not contained in the payload is left unchanged. See the following code blocks
for examples of such requests and the expected response to the requests. In these example request,
the description and swappable of a ticket are updated.
- PHP
- GO
- Node
- Shell
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $accessToken"
],
CURLOPT_POSTFIELDS => http_build_query([
"type" => "show_always",
"allow_quantity" => true
]),
CURLOPT_URL => "https://api.openticket.tech/waiting_list/$GUID"
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
payloadBuf := new(bytes.Buffer)
json.NewEncoder(payloadBuf).Encode({
"type": "show_always",
"allow_quantity": true
})
req, _ := http.NewRequest("PUT", "https://api.openticket.tech/waiting_list/" + GUID, 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": "PUT",
"headers": {
"Authorization": `Bearer ${accessToken}`,
"Content-Type": "application/json"
},
"body": JSON.stringify({
"type": "show_always",
"allow_quantity": true
})
};
fetch(`https://api.openticket.tech/waiting_list/${GUID}`, options)
.then(response => response.json())
.then(response => console.log(response))
curl -X PUT \
-H "Authorization: Bearer $accessToken" \
-d "type=show_always" \
-d "allow_quantity=true" \
"https://api.openticket.tech/waiting_list/$GUID"
Response
{
"guid": "1b3760ca-c999-4b24-8e51-ea4ab4552957",
"company_id": "d0a3f370-cd43-11ed-9c9c-bbcffde24a48",
"event_id": "68096ad5-2eb7-45fb-977d-931b3485fe30",
"enabled": false,
"allow_quantity": true,
"allow_reseller_ticketswap": false,
"allow_reseller_tixel": false,
"type": "show_always",
"created_at": "2023-10-02T13:19:32+02:00",
"updated_at": "2023-10-02T13:19:32+02:00",
"deleted_at": null
}