Skip to main content

Creating shops

Creating shops​

First, you must create the shop resource. For this, you need the following information:

  • name: the name for the shop.

This is the minimum information required to create a shop. It is not possible to omit additional information. More information can be added to a shop later, as will be described in updating a shop. First, use the required information to create a POST request to https://api.openticket.tech/shop. 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" => "Ticket shop"
],
CURLOPT_URL => "https://api.openticket.tech/shop"
]);

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

echo $response;
This request results in the following response
{
"name": "Ticket shop",
"company_id": "d0a3f370-cd43-11ed-9c9c-bbcffde24a48",
"guid": "7d2bb3a8-739b-41c8-afe0-80b66f70943a",
"updated_at": "2023-10-02T13:23:29+02:00",
"created_at": "2023-10-02T13:23:29+02:00",
"global_terms": "https://example.com/documents/select.php?doc=visitorterms",
"currency": "USD",
"reservation_time": 0,
"seats_public_key": null
}

Getting a shop​

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

Updating a shop​

The response to the GET request shows that the created shop still contains a lot of undefined information. Most of these undefined fields provide essential information that influences how customers interact with the shop. Therefore, it is very useful to take a look at the API reference to see what all these fields entail.

To update a shop, you need the following information:

  • GUID: the GUID of a shop.

Use the required information to make a PUT request to https://api.openticket.tech/shop/:GUID. This request should contain a payload containing the information that should be updated. Any information that can be associated with a shop 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 from_name, from_email and google_tag of a shop are updated.

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $accessToken"
],
CURLOPT_POSTFIELDS => http_build_query([
"from_name" => "Jane Appleseed",
"from_email" => "jane.appleseed@example.com",
"google_tag" => "GTM-NF6FJHH"
]),
CURLOPT_URL => "https://api.openticket.tech/shop/$GUID"
]);

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

echo $response;
This request results in the following response
{
"guid": "7d2bb3a8-739b-41c8-afe0-80b66f70943a",
"company_id": "d0a3f370-cd43-11ed-9c9c-bbcffde24a48",
"name": "Ticket shop",
"description": null,
"event_selection": "auto",
"google_tag": "GTM-NF6FJHH",
"email_validation_rule": null,
"email_must_be_unique": false,
"company_terms": null,
"elements": null,
"css": null,
"facebook_auto_attend": false,
"facebook_page_url": "",
"from_name": "Jane Appleseed",
"from_email": "jane.appleseed@example.com",
"custom_redirect": null,
"seats_allow_orphan": null,
"greedy_date_selection": false,
"auto_prune": true,
"created_at": "2023-10-02T13:23:29+02:00",
"updated_at": "2023-10-02T13:24:05+02:00",
"global_terms": "http://custom.eventix.nl/documents/select.php?doc=visitorterms",
"currency": "USD",
"reservation_time": 0,
"seats_public_key": null
}