Setting up events
Creating events
An event is created through the /location endpoint rather than the /event endpoint. This
ensures that an event is only created when a valid location is available. The location created
in the previous section can be used for this purpose. The following information
is required:
locationGUID: GUID of thelocationwhere the event will take place.name: the name for the event.type: the type of the event. This is legacy, but still needs to be provided. Possible values are once or recurring.locale: the locale used for the event, for example, NL_nl.currency: the currency used for the event, for example, EUR.
It is also possible to add the following information to the request:
start: the start date and time of the event, in standard date-time format with time zone.end: the end date and time of the event, in standard date-time format with time zone.
More information can be added to an event later, as described in
updating an event. Using this information, create a POST request to
https://api.weeztix.com/location/:locationGUID/event. See the following code
blocks for examples of such requests and the expected response to the requests.
- PHP
- GO
- Node
- Shell
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $accessToken"
],
CURLOPT_POSTFIELDS => [
"name" => "Festival",
"type" => "once",
"currency" => "EUR",
"locale" => "nl_NL"
],
CURLOPT_URL => "https://api.weeztix.com/location/$locationGUID/event"
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
payloadBuf := new(bytes.Buffer)
json.NewEncoder(payloadBuf).Encode({
"name": "Festival",
"type": "once",
"currency": "EUR",
"locale": "nl_NL"
})
req, _ := http.NewRequest("PUT", "https://api.weeztix.com/location/" + locationGUID + "/event", 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({
"name": "Festival",
"type": "once",
"currency": "EUR",
"locale": "nl_NL"
})
};
fetch(`https://api.weeztix.com/location/${locationGUID}/event`, options)
.then(response => response.json())
.then(response => console.log(response))
curl -X POST \
-H "Authorization: Bearer $accessToken" \
-F "name=Festival" \
-F "type=once" \
-F "currency=EUR" \
-F "locale=nl_NL" \
"https://api.weeztix.com/location/$locationGUID/event"
Response
{
"status": "normal",
"name": "Festival",
"type": "once",
"currency": "EUR",
"locale": "nl_NL",
"location_id": "157f3024-20ff-4353-859d-22ee5bc6b791",
"company_id": "d0a3f370-cd43-11ed-9c9c-bbcffde24a48",
"guid": "68096ad5-2eb7-45fb-977d-931b3485fe30",
"updated_at": "2023-10-02T13:07:43+02:00",
"created_at": "2023-10-02T13:07:43+02:00"
}
The start and end fields indicate the beginning and ending dates of an event. When selling
tickets for this event, these times determine when entry is permitted. For situations requiring more
precise control over start and end times, event dates should be used. When
using eventDate resources, the start and end fields for the overall event convey the
communicated start and end dates. Meanwhile, each eventDate resource specifies the actual entry
times for attendees. If an event does not have defined start and end times, these values will
be inferred from the associated eventDate resources whenever possible.
Getting events
After you created an event, you can retrieve the information stored in this resource. To do this,
make a GET request to https://api.weeztix.com/event/:GUID. You can also make
a GET request to
https://api.weeztix.com/event to list all event resources currently stored
in the Weeztix
system.
Updating an event
The response to the GET request shows the information of the created event. After its creation,
you can add additional information to or update existing information of the event. You can, for
example, update the following information:
description: a description for the event.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.
If you want to update information of a specific event, you need its unique identifier:
GUID: the GUID of theevent.
Use the unique identifier to make a PUT-request to
https://api.weeztix.com/event/:GUID. The payload of the request should
contain the information that needs to be updated. Any information that can be associated with an
event 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.
- PHP
- GO
- Node
- Shell
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $accessToken"
],
CURLOPT_POSTFIELDS => http_build_query([
"description" => "Summer festival.",
"start" => "2030-08-29T09 =>00 =>00+02 =>00",
"end" => "2030-08-30T13 =>00 =>00+02 =>00"
]),
CURLOPT_URL => "https://api.weeztix.com/event/$GUID"
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
payloadBuf := new(bytes.Buffer)
json.NewEncoder(payloadBuf).Encode({
"description": "Summer festival.",
"start": "2030-08-29T09:00:00+02:00",
"end": "2030-08-30T13:00:00+02:00"
})
req, _ := http.NewRequest("PUT", "https://api.weeztix.com/event/" + 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({
"description": "Summer festival.",
"start": "2030-08-29T09:00:00+02:00",
"end": "2030-08-30T13:00:00+02:00"
})
};
fetch(`https://api.weeztix.com/event/${GUID}`, options)
.then(response => response.json())
.then(response => console.log(response))
curl -X PUT \
-H "Authorization: Bearer $accessToken" \
-d "description=Summer%20festival." \
-d "start=2030-08-29T09%3A00%3A00%2B02%3A00" \
-d "end=2030-08-30T13%3A00%3A00%2B02%3A00" \
"https://api.weeztix.com/event/$GUID"
Response
{
"guid": "68096ad5-2eb7-45fb-977d-931b3485fe30",
"company_id": "d0a3f370-cd43-11ed-9c9c-bbcffde24a48",
"location_id": "157f3024-20ff-4353-859d-22ee5bc6b791",
"payout_profile_id": null,
"event_refund_setting_id": null,
"name": "Festival",
"description": "Summer festival.",
"start": "2030-08-29T09:00:00+02:00",
"end": "2030-08-30T13:00:00+02:00",
"email_info": null,
"gui_mode": null,
"type": "once",
"status": "normal",
"visitor_contact_email": "",
"visitor_contact_phone": "",
"visitor_contact_url": "",
"contact_name": "",
"contact_email": "",
"contact_phone": "",
"website": "https://www.example.com",
"locale": "en_GB",
"currency": "GBP",
"category": "other",
"subcategories": [
"other"
],
"auto_prune": true,
"retrievable_after": null,
"created_at": "2023-10-02T13:07:43+02:00",
"updated_at": "2023-10-02T13:08:21+02:00"
}