Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions API_DESIGN.md

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a space after the file name which can cause trouble. It also looks like the ending part of the file is missing, because I see only POST /api/analytics documented, and status codes are missing too.

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# 📘 API Design — Analytics API (Week 4 Assignment)

## Overview
This document describes the design of the **Analytics API** built for Week 4 of the HYF Backend course.
The API allows clients to submit analytics events, list and filter them, fetch individual records, replace or delete records, and request a summary.

The API follows REST principles, uses resource‑oriented URIs, proper HTTP methods, validation, and structured error responses.

---

# 📁 Resources

## **Analytics Record**
Represents a single analytics event.

### Fields
| Field | Type | Description |
|--------------|-------------------|-------------|
| `id` | String (UUID) | Server‑generated trace ID |
| `eventType` | String | Type of event (e.g., "click", "login") |
| `eventSource`| String | Source of event (e.g., "homepage") |
| `sessionId` | String | Anonymized session identifier |
| `timestamp` | ISO‑8601 datetime | When the event occurred |

---

# 🛣️ Endpoints

## 1. **Create a new analytics record**
### `POST /api/analytics`

### Request Body
```json
{
"eventType": "click",
"eventSource": "homepage",
"sessionId": "abc123",
"timestamp": "2024-05-01T10:15:30"
}
2 changes: 2 additions & 0 deletions task-1/AnalyticsAPI/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/mvnw text eol=lf
*.cmd text eol=crlf
33 changes: 33 additions & 0 deletions task-1/AnalyticsAPI/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
HELP.md
target/
.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/
3 changes: 3 additions & 0 deletions task-1/AnalyticsAPI/.mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
wrapperVersion=3.3.4
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.16/apache-maven-3.9.16-bin.zip
295 changes: 295 additions & 0 deletions task-1/AnalyticsAPI/mvnw

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading