Skip to content

API Endpoints

Alaaddin Eren Namlı edited this page Apr 6, 2026 · 4 revisions

Mapcess Backend API Endpoints

Base URL: http://localhost:8080


Comments

1.1 Get All Comments

GET /api/comments

Response 200 OK

[
  {
    "id": 1,
    "content": "There is a broken ramp here.",
    "author": { "id": 1 },
    "createdAt": "2026-03-28T10:00:00"
  }
]

1.2 Get Comment by ID

GET /api/comments/{id}

Path Param Type Description
id Long Comment ID

Response 200 OK — Comment object.

Response 404 Not Found — Comment does not exist.


1.3 Get Comments by Author

GET /api/comments/author/{authorId}

Path Param Type Description
authorId Long ID of the author (RegisteredUser)

Response 200 OK — Array of comment objects. Returns empty array if none found.


1.4 Get Comments by Report

GET /api/comments/report/{reportId}

Path Param Type Description
reportId Long ID of the report

Response 200 OK — Array of comment objects linked to the specified report. Returns empty array if none found.


1.5 Create Comment

POST /api/comments

Request Body

{
  "content": "There is a broken ramp here.",
  "author": { "id": 1 },
  "report": { "reportId": 5 }
}
Field Type Required Description
content String Yes Text of the comment
author Object Yes Must include id of an existing user
report Object No Must include reportId of an existing report

Response 200 OK

{
  "id": 3,
  "content": "There is a broken ramp here.",
  "author": { "id": 1 },
  "createdAt": "2026-03-28T10:00:00"
}

createdAt is set automatically on creation.


1.6 Update Comment

PUT /api/comments/{id}

Path Param Type Description
id Long Comment ID to update

Request Body

{
  "content": "Updated comment text."
}

Response 200 OK — Updated comment object.

Response 404 Not Found — Comment does not exist.


1.7 Delete Comment

DELETE /api/comments/{id}

Path Param Type Description
id Long Comment ID to delete

Response 204 No Content

Response 404 Not Found — Comment does not exist.


Users

2.1 Get All Users

GET /api/users

Response 200 OK

[
  { "id": 1 }
]

2.2 Get User by ID

GET /api/users/{id}

Path Param Type Description
id Long User ID

Response 200 OK

{ "id": 1 }

Response 404 Not Found — User does not exist.


2.3 Create User

POST /api/users

Use /auth/register instead for creating users with proper validation and password hashing.

Response 201 Created

{ "id": 2 }

2.4 Delete User

DELETE /api/users/{id}

Path Param Type Description
id Long User ID to delete

Response 204 No Content

Response 404 Not Found — User does not exist.


Reports

3.1 Get All Reports

GET /api/reports

Response 200 OK — Array of ReportResponse objects.


3.2 Get Report by ID

GET /api/reports/{id}

Path Param Type Description
id Long Report ID

Response 200 OK — ReportResponse object.

Response 404 Not Found — Report does not exist.


3.3 Get Reports by User

GET /api/reports/user/{userId}

Path Param Type Description
userId Long ID of the user

Response 200 OK — Array of ReportResponse objects. Returns empty array if none found.


3.4 Create Report

POST /api/reports

Request Body

{
  "userId": 1,
  "latitude": 41.0082,
  "longitude": 28.9784,
  "description": "Broken ramp at entrance.",
  "tag": "BROKEN_ELEVATOR"
}
Field Type Required Description
userId Long Yes ID of the user creating the report
latitude double Yes Geographic latitude
longitude double Yes Geographic longitude
description String Yes Max 1000 chars
tag Enum Yes MISSING_RAMP, BROKEN_ELEVATOR, NARROW_PASSAGE, WET_FLOOR, CONSTRUCTION, OTHER

Response 201 Created — ReportResponse object.


3.5 Update Report

PUT /api/reports/{id}

Path Param Type Description
id Long Report ID to update

Request Body — Same structure as Create Report.

Response 200 OK — Updated ReportResponse object.

Response 404 Not Found — Report does not exist.


3.6 Delete Report

DELETE /api/reports/{id}

Path Param Type Description
id Long Report ID to delete

Response 204 No Content

Response 404 Not Found — Report does not exist.


3.7 Verify Report

POST /api/reports/{id}/verify

Path Param Type Description
id Long Report ID to verify (upvote)

Response 200 OK — Updated ReportResponse object with incremented agrees count.


3.8 Unverify Report

POST /api/reports/{id}/unverify

Path Param Type Description
id Long Report ID to unverify (downvote)

Response 200 OK — Updated ReportResponse object with incremented disagrees count.


3.9 Upload Media for Report

POST /api/reports/{id}/media

Content-Type: multipart/form-data

Path Param Type Description
id Long Report ID to attach media to
Form-Data Field Type Description
file MultipartFile The media file (image/video) to upload

Response 201 Created

{
  "mediaUrl": "https://s3.bucket.url/to/media.jpg"
}

Response 400 Bad Request — Invalid file. Response 404 Not Found — Report ID not found.


Ramp Reports

4.1 Get All Ramp Reports

GET /api/reports/ramp

Response 200 OK — Array of RampReportResponse objects.


4.2 Get Ramp Report by ID

GET /api/reports/ramp/{id}

Path Param Type Description
id Long Ramp Report ID

Response 200 OKRampReportResponse object.

Response 404 Not Found — Ramp report does not exist.


4.3 Create Ramp Report

POST /api/reports/ramp

Request Body (CreateRampReportRequest)

{
  "userId": 1,
  "latitude": 41.0082,
  "longitude": 28.9784,
  "description": "Steep incline on the ramp."
}

Response 201 CreatedRampReportResponse object.


Routes (Routing)

5.1 Get Route Options

POST /api/routes

Request Body (RouteRequest)

{
  "startLat": 41.0082,
  "startLon": 28.9784,
  "endLat": 41.0090,
  "endLon": 28.9800,
  "mode": "WALKING"
}
Field Type Required Description
mode Enum Yes Mode of travel. Options: WALKING, WHEELCHAIR

Response 200 OK — Array of RouteResponse objects containing routing steps, geometry, and coordinates.


Public Server-Sent Events (SSE)

6.1 Subscribe to Events

GET /api/sse/public/subscribe

Produces: text/event-stream

Subscribes the client to public server-side events (e.g., live notifications/updates).


Auth

All endpoints except /auth/register and /auth/login require a JWT token in the Authorization header:

Authorization: Bearer <token>

7.1 Register

POST /auth/register

Request Body

{
  "name": "John Doe",
  "email": "john@example.com",
  "password": "securepassword"
}
Field Type Required Validation
name String Yes 2–50 characters
email String Yes Valid email format
password String Yes Min 8 characters

Response 201 Created

{
  "id": 1,
  "name": "John Doe",
  "email": "john@example.com",
  "role": "USER"
}

Response 409 Conflict — Email already in use.

Response 400 Bad Request — Weak password or validation error.


7.2 Login

POST /auth/login

Request Body

{
  "email": "john@example.com",
  "password": "securepassword"
}
Field Type Required Validation
email String Yes Valid email format
password String Yes Non-blank

Response 200 OK

{
  "token": "<jwt-token>"
}

Response 401 Unauthorized — Wrong email or password.


Reference

Tag Enum

MISSING_RAMP, BROKEN_ELEVATOR, NARROW_PASSAGE, WET_FLOOR, CONSTRUCTION, OTHER

ReportStatus Enum

PENDING, VERIFIED, REJECTED

TravelMode Enum

WALKING, WHEELCHAIR

Comment Object

Field Type Description
id Long Auto-generated
content String Text of the comment
author RegisteredUser The user who wrote the comment
createdAt LocalDateTime Auto-set on creation (ISO 8601)

ReportResponse Object

Field Type Description
reportId Long Auto-generated
userId Long ID of the user who created the report
latitude double Geographic latitude
longitude double Geographic longitude
description String Max 1000 chars
tag Enum Category
status Enum Default: PENDING
agrees int Upvote count
disagrees int Downvote count
publishDate LocalDateTime Auto-set on creation (ISO 8601)
mediaUrls List<String> URLs of attached media files

RampReportResponse Object

Field Type Description
reportId Long Auto-generated
userId Long ID of the creator
latitude double Location latitude
longitude double Location longitude
description String
status Enum ReportStatus
publishDate LocalDateTime
entryLatitude double Computed/Associated entrance lat
entryLongitude double Computed/Associated entrance long
exitLatitude double Computed/Associated exit lat
exitLongitude double Computed/Associated exit long

logo Mapcess

Team Members

Final Milestone Deliverables

MVP Deliverables

Lab Reports

Communication Plan

Weekly Meetings

Sub-Group Meetings

Other Meetings

Project Documentation

RAM

Scenarios and Mock-ups

Use Case Diagrams (Initial)

Use Case Diagram (Final)

Class Diagram (Final)

Sequence Diagram (Final)

Standards & Conventions

Test & Coverage Plan

Mapping API Comparison Report

MVP Demo

Final Demo

Clone this wiki locally