Skip to content
/ notes Public

RESTful API for a simple notes application implemented using Spring Boot

Notifications You must be signed in to change notification settings

adewolfe/notes

Repository files navigation

Notes REST API

Quickstart

Pre-requisites

  • Gradle 8+
  • Java 17+

Build

./gradlew build

Run

./gradlew bootRun

Examples

Create a note

curl -X POST -H "X-User-Id: 1" -H "Content-Type: application/json" -d '{"text": "My first note"}' "http://localhost:8080/api/notes"

Get all notes (for a user)

curl -H "X-User-Id: 1" "http://localhost:8080/api/notes"

Get all notes (for a different user)

curl -H "X-User-Id: 2" "http://localhost:8080/api/notes"

Get a note (for the user that owns the note)

curl -H "X-User-Id: 1" "http://localhost:8080/api/notes/1"

Get a note (for a user that does not own the note)

curl -H "X-User-Id: 2" "http://localhost:8080/api/notes/1"

Update a note (for the user that owns the note)

curl -X PUT -H "X-User-Id: 1" -H "Content-Type: application/json" -d '{"text": "My updated note"}' "http://localhost:8080/api/notes/1"

Update a note (for a user that does not own the note)

curl -X PUT -H "X-User-Id: 2" -H "Content-Type: application/json" -d '{"text": "My updated note"}' "http://localhost:8080/api/notes/1"

Delete a note (for a user that does not own the note)

curl -X DELETE -H "X-User-Id: 2" "http://localhost:8080/api/notes/1"

Delete a note (for the user that owns the note)

curl -X DELETE -H "X-User-Id: 1" "http://localhost:8080/api/notes/1"

About

RESTful API for a simple notes application implemented using Spring Boot

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages