Skip to main content

Attaching eventDates

You can now attach the eventDate that you created previously to the ticket that you created in the previous section. As briefly mentioned before, resource attachment is an operation that associates two resources with each other, which is a simple task that only requires two pieces of information:

  • ticketGUID: the GUID of the ticket that should get an eventDate attached.
  • eventDateGUID: the GUID of the eventDate that should be attached to a ticket.

Use the required information to make a POST request to https://api.openticket.tech/ticket/:ticketGUID/dates/:eventDateGUID. 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_URL => "https://api.openticket.tech/ticket/$ticketGUID/dates/$eventDateGUID"
]);

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

echo $response;

The response to this request is a 204 OK and no payload, which simply indicates that the attachment of the eventDate to the ticket was successful.

You can use a DELETE request to detach an eventDate from a ticket again. For this, you can use the same information and endpoint as described above. See the following code blocks for examples of such requests.

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $accessToken"
],
CURLOPT_URL => "https://api.openticket.tech/ticket/$ticketGUID/dates/$eventDateGUID"
]);

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

echo $response;

The response to this request is also a 204 OK and no payload, which simply indicates that the detachment of the eventDate from the ticket was successful.