Setting up events
Creating events
You can use the location
created in the previous section to create an event. For this, you need the following information:
locationGUID
: GUID of thelocation
where 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.
This is the minimum information required to create an event
. It is not possible to omit additional information. More information can be added to an event
later, as will be described in updating an event. First, use the required information to create a POST request to https://api.eventix.io/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.eventix.io/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.eventix.io/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.eventix.io/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.eventix.io/location/$locationGUID/event"
{
"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"
}
An event
is created through the /location
endpoint, and not the /event
endpoint. This is the case as an event
can only be created if there is a location
where it can take place.
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.eventix.io/event/:GUID
. You can also make a GET request to https://api.eventix.io/event
to list all event
resources currently stored in the Eventix system.
Updating an event
The response to the GET request shows that the created event
still contains a lot of undefined information. Not all of this information is relevant, but it never hurts to provide as much information as possible. In addition to the required information of an event
, you can also provide the following information:
name
: the name for the event.description
: a description for the event.website
: website corresponding to the event.locale
: the locale used for the event, for example, NL_nl.currency
: the currency used for the event, for example, EUR.
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.eventix.io/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.",
"website" => "https =>//www.example.com",
"locale" => "en_GB",
"currency" => "GBP"
]),
CURLOPT_URL => "https://api.eventix.io/event/$GUID"
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
payloadBuf := new(bytes.Buffer)
json.NewEncoder(payloadBuf).Encode({
"description": "Summer festival.",
"website": "https://www.example.com",
"locale": "en_GB",
"currency": "GBP"
})
req, _ := http.NewRequest("PUT", "https://api.eventix.io/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.",
"website": "https://www.example.com",
"locale": "en_GB",
"currency": "GBP"
})
};
fetch(`https://api.eventix.io/event/${GUID}`, options)
.then(response => response.json())
.then(response => console.log(response))
curl -X PUT \
-H "Authorization: Bearer $accessToken" \
-d "description=Summer%20festival." \
-d "website=https%3A%2F%2Fwww.example.com" \
-d "locale=en_GB" \
-d "currency=GBP" \
"https://api.eventix.io/event/$GUID"
{
"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.",
"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",
"location": {
"...": "..."
}
}