WebEvent Endpoints
These are the endpoints for managing your Web Events
Base URL: https://web-counter.azurewebsites.net
info
The endpoints below will require adding a X-API-Key
Header to your request in order to authorize the request.
Create a Web Event
To add a Web Event that can be tracked
URL: /api/webevent
Method: POST
Content Type: application/json
Headers
X-API-Key: YOUR_API_KEY_GOES_HERE
Request Body
{
"name": "Page Visit"
}
Example Requests
- JavaScript
- cURL
const response = await fetch("https://web-counter.azurewebsites.net/api/webevent", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY_GOES_HERE",
},
body: JSON.stringify({
name: "Registration Click",
}),
});
curl -X 'POST' \
'https://web-counter.azurewebsites.net/api/webevent' \
-H 'accept: application/json' \
-H 'X-API-Key: MY_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"name": "Page Visit"
}'
Example Responses
- 201 Created
- 400 Bad Request
- 401 Unauthorized
- 409 Conflict
{
"hostname": "string",
"eventName": "string"
}
{
"type": "string",
"title": "string",
"status": 0,
"detail": "string",
"instance": "string",
"errors": {
"additionalProp1": ["string"],
"additionalProp2": ["string"],
"additionalProp3": ["string"]
},
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
}
{
"type": "https://tools.ietf.org/html/rfc7235#section-3.1",
"title": "Invalid API Key",
"status": 401,
"detail": "The provided API Key was invalid. Please check your API Key and try again.",
"instance": "/api/webevent"
}
{
"type": "application/json",
"title": "Duplicate",
"status": 409,
"detail": "WebEvent already exists.",
"instance": "/api/webevent/"
}
Retrieve Web Events
Get All Web Events by Name
URL: /api/webevent
Method: GET
Request Parameters
Headers
X-API-Key: YOUR_API_KEY_GOES_HERE
Example Requests
- JavaScript
- cURL
const response = await fetch("https://web-counter.azurewebsites.net/api/webevent", {
method: "GET",
headers: {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY_GOES_HERE",
},
});
curl -X 'GET' \
'https://web-counter.azurewebsites.net/api/webevent' \
-H 'accept: application/json' \
-H 'X-API-Key: YOUR_API_KEY_GOES_HERE'
Example Responses
- 200 Success
- 400 Bad Request
- 401 Unauthorized
["Page Visit", "Second Event"]
{
"type": "string",
"title": "string",
"status": 0,
"detail": "string",
"instance": "string",
"errors": {
"additionalProp1": ["string"],
"additionalProp2": ["string"],
"additionalProp3": ["string"]
},
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
}
{
"type": "https://tools.ietf.org/html/rfc7235#section-3.1",
"title": "Invalid API Key",
"status": 401,
"detail": "The provided API Key was invalid. Please check your API Key and try again.",
"instance": "/api/webevent"
}