Skip to main content

Selling tickets

You can now attach the ticket that you created previously to the shop 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:

  • shopGUID: the GUID of the shop the tickets should be sold from.
  • ticketGUID: the GUID of the ticket that needs to be sold from the shop.

Use the required information to make a POST request to https://api.eventix.io/shop/:shopGUID/tickets/:ticketGUID. 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.eventix.io/shop/$shopGUID/tickets/$ticketGUID"
]);

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

echo $response;

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

You can use a DELETE request to detach a ticket from a shop 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.eventix.io/shop/$shopGUID/tickets/$ticketGUID"
]);

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

echo $response;

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