Skip to main content

Setting up events

Creating events​

You can use the location created in the previous section to create an event. For this, you need the following information:

  • locationGUID: GUID of the location where the event will take place.
  • name: the name for the event.
  • type: the type of the event. This is legacy, but still needs to be provided. Possible values are once or recurring.
  • locale: the locale used for the event, for example, NL_nl.
  • currency: the currency used for the event, for example, EUR.

This is the minimum information required to create an event. It is not possible to omit additional information. More information can be added to an event later, as will be described in updating an event. First, use the required information to create a POST request to https://api.openticket.tech/location/:locationGUID/event. See the following code blocks for examples of such requests and the expected response to the requests.

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $accessToken"
],
CURLOPT_POSTFIELDS => [
"name" => "Festival",
"type" => "once",
"currency" => "EUR",
"locale" => "nl_NL"
],
CURLOPT_URL => "https://api.openticket.tech/location/$locationGUID/event"
]);

$response = curl_exec($curl);
curl_close($curl);

echo $response;
This request results in the following response
{
"status": "normal",
"name": "Festival",
"type": "once",
"currency": "EUR",
"locale": "nl_NL",
"location_id": "157f3024-20ff-4353-859d-22ee5bc6b791",
"company_id": "d0a3f370-cd43-11ed-9c9c-bbcffde24a48",
"guid": "68096ad5-2eb7-45fb-977d-931b3485fe30",
"updated_at": "2023-10-02T13:07:43+02:00",
"created_at": "2023-10-02T13:07:43+02:00"
}

An event is created through the /location endpoint, and not the /event endpoint. This is the case as an event can only be created if there is a location where it can take place.

Getting events​

After you created an event, you can retrieve the information stored in this resource. To do this, make a GET request to https://api.openticket.tech/event/:GUID. You can also make a GET request to https://api.openticket.tech/event to list all event resources currently stored in the ​OpenTicket system.

Updating an event​

The response to the GET request shows that the created event still contains a lot of undefined information. Not all of this information is relevant, but it never hurts to provide as much information as possible. In addition to the required information of an event, you can also provide the following information:

  • name: the name for the event.
  • description: a description for the event.
  • website: website corresponding to the event.
  • locale: the locale used for the event, for example, NL_nl.
  • currency: the currency used for the event, for example, EUR.

If you want to update information of a specific event, you need its unique identifier:

  • GUID: the GUID of the event.

Use the unique identifier to make a PUT-request to https://api.openticket.tech/event/:GUID. The payload of the request should contain the information that needs to be updated. Any information that can be associated with an event 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.

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $accessToken"
],
CURLOPT_POSTFIELDS => http_build_query([
"description" => "Summer festival.",
"website" => "https =>//www.example.com",
"locale" => "en_GB",
"currency" => "GBP"
]),
CURLOPT_URL => "https://api.openticket.tech/event/$GUID"
]);

$response = curl_exec($curl);
curl_close($curl);

echo $response;
This request results in the following response
{
"guid": "68096ad5-2eb7-45fb-977d-931b3485fe30",
"company_id": "d0a3f370-cd43-11ed-9c9c-bbcffde24a48",
"location_id": "157f3024-20ff-4353-859d-22ee5bc6b791",
"payout_profile_id": null,
"event_refund_setting_id": null,
"name": "Festival",
"description": "Summer festival.",
"email_info": null,
"gui_mode": null,
"type": "once",
"status": "normal",
"visitor_contact_email": "",
"visitor_contact_phone": "",
"visitor_contact_url": "",
"contact_name": "",
"contact_email": "",
"contact_phone": "",
"website": "https://www.example.com",
"locale": "en_GB",
"currency": "GBP",
"category": "other",
"subcategories": [
"other"
],
"auto_prune": true,
"retrievable_after": null,
"created_at": "2023-10-02T13:07:43+02:00",
"updated_at": "2023-10-02T13:08:21+02:00",
"location": {
"...": "..."
}
}