Skip to main content

Assigning eventDates

Creating eventDates​

The event created in the previous section does not have a date or time associated with it (yet). You can confirm this through dashboard because there is no date associated with the event, is not displayed on the dashboard. You can use an eventDate to add a date and time to an event. To create an eventDate, you need the following information:

  • event_id: GUID of the event that will be hosted on this date.
  • start: the start date and time of the event, in standard date-time form with time zone.
  • end: the end date and time of the event, in standard date-time form with time zone.

Use the required information to create a POST request to https://api.openticket.tech/eventdate. All the required information is embedded in the endpoint URL, and therefore this POST request does not require a payload. See the following code blocks for examples of such requests.

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $accessToken"
],
CURLOPT_POSTFIELDS => [
"event_id" => $eventGUID,
"start" => "2030-08-29T09 =>00 =>00+02 =>00",
"end" => "2030-08-30T13 =>00 =>00+02 =>00"
],
CURLOPT_URL => "https://api.openticket.tech/eventdate"
]);

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

echo $response;
This request results in the following response
{
"start": "2030-08-29T09:00:00+02:00",
"end": "2030-08-30T13:00:00+02:00",
"event_id": "68096ad5-2eb7-45fb-977d-931b3485fe30",
"guid": "23e91fdb-9a37-41eb-8a5c-c1cb4bc66a18",
"updated_at": "2023-10-02T13:17:09+02:00",
"created_at": "2023-10-02T13:17:09+02:00",
"seated": false
}

After you created the eventDate, the event with which you associated the eventDate will appear on the dashboard.

Getting eventDates​

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

Updating an eventDate​

If you want to update the information of an eventDate, you need its unique identifier:

  • GUID: the GUID of the eventDate.

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 eventDate 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 requests, the name of an eventDate is updated, which allows you to easily distinguish different eventDate resources.

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $accessToken"
],
CURLOPT_POSTFIELDS => http_build_query([
"name" => "Festival",
"start" => "2030-09-29T09 =>00 =>00+02 =>00",
"end" => "2030-09-30T13 =>00 =>00+02 =>00"
]),
CURLOPT_URL => "https://api.openticket.tech/eventdate/$GUID"
]);

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

echo $response;
This request results in the following response
{
"guid": "23e91fdb-9a37-41eb-8a5c-c1cb4bc66a18",
"location_id": null,
"event_id": "68096ad5-2eb7-45fb-977d-931b3485fe30",
"name": "",
"capacity": 0,
"start": "2030-08-29T09:00:00+02:00",
"end": "2030-08-30T13:00:00+02:00",
"seats_event_key": null,
"facebook_event_id": null,
"created_at": "2023-10-02T13:17:09+02:00",
"updated_at": "2023-10-02T13:17:09+02:00",
"seated": false,
"event": {
"...": "..."
}
}