Creating locations
Creating locations
First, you must create the location
resource. For this, you need the following information:
name
: the name of the location.capacity
: the capacity of the location.address
: the address of the location.
This is the minimum information required to create a location
. It is not possible to omit additional information. More information can be added to a location
later, as will be described in updating a location. First, use the required information to create a POST request to https://api.eventix.io/location
. 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" => "Parktheater Eindhoven",
"capacity" => 952,
"address" => "Elzentlaan 50, 5615 CN Eindhoven, Netherlands"
],
CURLOPT_URL => "https://api.eventix.io/location"
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
payloadBuf := new(bytes.Buffer)
json.NewEncoder(payloadBuf).Encode({
"name": "Parktheater Eindhoven",
"capacity": 952,
"address": "Elzentlaan 50, 5615 CN Eindhoven, Netherlands"
})
req, _ := http.NewRequest("PUT", "https://api.eventix.io/location", 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": "Parktheater Eindhoven",
"capacity": 952,
"address": "Elzentlaan 50, 5615 CN Eindhoven, Netherlands"
})
};
fetch("https://api.eventix.io/location", options)
.then(response => response.json())
.then(response => console.log(response))
curl -X POST \
-H "Authorization: Bearer $accessToken" \
-F "name=Parktheater Eindhoven" \
-F "capacity=952" \
-F "address=Elzentlaan 50, 5615 CN Eindhoven, Netherlands" \
"https://api.eventix.io/location"
{
"name": "Parktheater Eindhoven",
"capacity": 952,
"address": "Elzentlaan 50, 5615 CN Eindhoven, Netherlands",
"company_id": "d0a3f370-cd43-11ed-9c9c-bbcffde24a48",
"guid": "157f3024-20ff-4353-859d-22ee5bc6b791",
"updated_at": "2023-10-02T13:05:34+02:00",
"created_at": "2023-10-02T13:05:34+02:00",
"seated": false
}
Getting locations
After you created a location
, you can retrieve the information stored in this resource. To do this, you need its unique identifier:
GUID
: the GUID of thelocation
. You can get this information from the response to the POST request above.
Use this identifier to make a GET request to https://api.eventix.io/location/:GUID
. This allows you to verify that the resource is stored correctly in the Eventix system and that all information associated with the resource is correct. 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 => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $accessToken"
],
CURLOPT_URL => "https://api.eventix.io/location/$GUID"
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
req, _ := http.NewRequest("PUT", "https://api.eventix.io/location/" + 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": "GET",
"headers": {
"Authorization": `Bearer ${accessToken}`
}
};
fetch(`https://api.eventix.io/location/${GUID}`, options)
.then(response => response.json())
.then(response => console.log(response))
curl -X GET \
-H "Authorization: Bearer $accessToken" \
"https://api.eventix.io/location/$GUID"
{
"guid": "157f3024-20ff-4353-859d-22ee5bc6b791",
"company_id": "d0a3f370-cd43-11ed-9c9c-bbcffde24a48",
"name": "Parktheater Eindhoven",
"description": null,
"capacity": 952,
"latitude": null,
"longitude": null,
"address": "Elzentlaan 50, 5615 CN Eindhoven, Netherlands",
"public": false,
"parent_guid": null,
"seats_chart_key": null,
"created_at": "2023-10-02T13:05:34+02:00",
"updated_at": "2023-10-02T13:05:34+02:00",
"seated": false
}
If the GUID
of a location
is not known, you can get a list of all locations currently stored in the Eventix system. To request the list of all locations
, you do not need to provide any information; simply make a GET request to https://api.eventix.io/location
. 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 => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $accessToken"
],
CURLOPT_URL => "https://api.eventix.io/location"
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
req, _ := http.NewRequest("PUT", "https://api.eventix.io/location", 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": "GET",
"headers": {
"Authorization": `Bearer ${accessToken}`
}
};
fetch("https://api.eventix.io/location", options)
.then(response => response.json())
.then(response => console.log(response))
curl -X GET \
-H "Authorization: Bearer $accessToken" \
"https://api.eventix.io/location"
[
{
"guid": "157f3024-20ff-4353-859d-22ee5bc6b791",
"company_id": "d0a3f370-cd43-11ed-9c9c-bbcffde24a48",
"name": "Parktheater Eindhoven",
"description": null,
"capacity": 952,
"latitude": null,
"longitude": null,
"address": "Elzentlaan 50, 5615 CN Eindhoven, Netherlands",
"public": false,
"parent_guid": null,
"seats_chart_key": null,
"created_at": "2023-10-02T13:05:34+02:00",
"updated_at": "2023-10-02T13:05:34+02:00",
"seated": false
}
]
All the GET-requests are analogous to the example request shown above. For this reason, further examples of GET-requests are omitted from the documentation.
Updating a location
The response to the GET request shows that the created location
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 a location
, you can also provide the following information:
name
: the name of the location.description
: the description of the location.capacity
: the capacity of the location.address
: the address of the location.latitude
: the latitude of the location.longitutde
: the longitude of the location.seated
: whether the location is seated or not.
To update the information of a specific location
, its unique identifier is required:
GUID
: the GUID of thelocation
.
Use the unique identifier to make a PUT request to https://api.eventix.io/location/:GUID
. The payload of the request should contain the information that needs to be updated. Any information that can be associated with a location
but is not included 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([
"name" => "Parktheater Eindhoven, Hertog Jan Zaal"
]),
CURLOPT_URL => "https://api.eventix.io/location/$GUID"
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
payloadBuf := new(bytes.Buffer)
json.NewEncoder(payloadBuf).Encode({
"name": "Parktheater Eindhoven, Hertog Jan Zaal"
})
req, _ := http.NewRequest("PUT", "https://api.eventix.io/location/" + 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({
"name": "Parktheater Eindhoven, Hertog Jan Zaal"
})
};
fetch(`https://api.eventix.io/location/${GUID}`, options)
.then(response => response.json())
.then(response => console.log(response))
curl -X PUT \
-H "Authorization: Bearer $accessToken" \
-d "name=Parktheater%20Eindhoven%2C%20Hertog%20Jan%20Zaal" \
"https://api.eventix.io/location/$GUID"
{
"guid": "157f3024-20ff-4353-859d-22ee5bc6b791",
"company_id": "d0a3f370-cd43-11ed-9c9c-bbcffde24a48",
"name": "Parktheater Eindhoven, Hertog Jan Zaal",
"description": null,
"capacity": 952,
"latitude": null,
"longitude": null,
"address": "Elzentlaan 50, 5615 CN Eindhoven, Netherlands",
"public": false,
"parent_guid": null,
"seats_chart_key": null,
"created_at": "2023-10-02T13:05:34+02:00",
"updated_at": "2023-10-02T13:07:03+02:00",
"seated": false
}
Remarks
Not all information associated with a location
is trivial to obtain, and the resource does not force addresses to be stored in a consistent manner. As mentioned above, these fields can be left blank, but it is recommended to use an external tool or API to obtain this information instead.
The Google Maps JavaScript API offers a free to use Place Autocomplete endpoint that can be used for autocompleting addresses and inferring latitudes and longitudes from said addresses.