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 theevent
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.
- PHP
- GO
- Node
- Shell
$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;
payloadBuf := new(bytes.Buffer)
json.NewEncoder(payloadBuf).Encode({
"event_id": eventGUID,
"start": "2030-08-29T09:00:00+02:00",
"end": "2030-08-30T13:00:00+02:00"
})
req, _ := http.NewRequest("PUT", "https://api.openticket.tech/eventdate", 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({
"event_id": eventGUID,
"start": "2030-08-29T09:00:00+02:00",
"end": "2030-08-30T13:00:00+02:00"
})
};
fetch("https://api.openticket.tech/eventdate", options)
.then(response => response.json())
.then(response => console.log(response))
curl -X POST \
-H "Authorization: Bearer $accessToken" \
-F "event_id=$eventGUID" \
-F "start=2030-08-29T09:00:00+02:00" \
-F "end=2030-08-30T13:00:00+02:00" \
"https://api.openticket.tech/eventdate"
{
"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 theeventDate
.
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.
- PHP
- GO
- Node
- Shell
$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;
payloadBuf := new(bytes.Buffer)
json.NewEncoder(payloadBuf).Encode({
"name": "Festival",
"start": "2030-09-29T09:00:00+02:00",
"end": "2030-09-30T13:00:00+02:00"
})
req, _ := http.NewRequest("PUT", "https://api.openticket.tech/eventdate/" + 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({
"name": "Festival",
"start": "2030-09-29T09:00:00+02:00",
"end": "2030-09-30T13:00:00+02:00"
})
};
fetch(`https://api.openticket.tech/eventdate/${GUID}`, options)
.then(response => response.json())
.then(response => console.log(response))
curl -X PUT \
-H "Authorization: Bearer $accessToken" \
-d "name=Festival" \
-d "start=2030-09-29T09%3A00%3A00%2B02%3A00" \
-d "end=2030-09-30T13%3A00%3A00%2B02%3A00" \
"https://api.openticket.tech/eventdate/$GUID"
{
"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": {
"...": "..."
}
}