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.eventix.io/shop
. 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" => "Ticket shop"
],
CURLOPT_URL => "https://api.eventix.io/shop"
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
payloadBuf := new(bytes.Buffer)
json.NewEncoder(payloadBuf).Encode({
"name": "Ticket shop"
})
req, _ := http.NewRequest("PUT", "https://api.eventix.io/shop", 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": "Ticket shop"
})
};
fetch("https://api.eventix.io/shop", options)
.then(response => response.json())
.then(response => console.log(response))
curl -X POST \
-H "Authorization: Bearer $accessToken" \
-F "name=Ticket shop" \
"https://api.eventix.io/shop"
{
"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.eventix.io/shop/:GUID
. You can also make a GET request to https://api.eventix.io/shop
to list all shop
resources stored in the Eventix 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.eventix.io/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.
- PHP
- GO
- Node
- Shell
$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.eventix.io/shop/$GUID"
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
payloadBuf := new(bytes.Buffer)
json.NewEncoder(payloadBuf).Encode({
"from_name": "Jane Appleseed",
"from_email": "jane.appleseed@example.com",
"google_tag": "GTM-NF6FJHH"
})
req, _ := http.NewRequest("PUT", "https://api.eventix.io/shop/" + 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({
"from_name": "Jane Appleseed",
"from_email": "jane.appleseed@example.com",
"google_tag": "GTM-NF6FJHH"
})
};
fetch(`https://api.eventix.io/shop/${GUID}`, options)
.then(response => response.json())
.then(response => console.log(response))
curl -X PUT \
-H "Authorization: Bearer $accessToken" \
-d "from_name=Jane%20Appleseed" \
-d "from_email=jane.appleseed%40example.com" \
-d "google_tag=GTM-NF6FJHH" \
"https://api.eventix.io/shop/$GUID"
{
"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
}