WebPage Endpoints
These are the endpoints for managing your Web Pages
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 Page
To add pages (web paths) that you would like to be tracked in your website
URL: /api/webpage
Method: POST
Content Type: application/json
Headers
X-API-Key: YOUR_API_KEY_GOES_HERE
Request Body
{
"pathname": "/about"
}
Example Requests
- JavaScript
- cURL
const response = await fetch("https://web-counter.azurewebsites.net/api/webpage", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY_GOES_HERE",
},
body: JSON.stringify({
pathname: "/about",
}),
});
curl -X 'POST' \
'https://web-counter.azurewebsites.net/api/webpage' \
-H 'accept: application/json' \
-H 'X-API-Key: MY_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"pathname": "/about"
}'
Example Responses
- 201 Created
- 400 Bad Request
- 401 Unauthorized
- 409 Conflict
{
"hostname": "string",
"pathname": "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/webpage"
}
{
"type": "application/json",
"title": "Duplicate",
"status": 409,
"detail": "webpage already exists.",
"instance": "/api/webpage/"
}
Retrieve Web Pages
Get All Web Pages that are being tracked
URL: /api/webpage
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/webpage", {
method: "GET",
headers: {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY_GOES_HERE",
},
});
curl -X 'GET' \
'https://web-counter.azurewebsites.net/api/webpage' \
-H 'accept: application/json' \
-H 'X-API-Key: YOUR_API_KEY_GOES_HERE'
Example Responses
- 200 Success
- 400 Bad Request
- 401 Unauthorized
["/", "browse", "login"]
{
"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/webpage"
}