📘 API Documentation

Register User

Mendaftarkan user baru.

POST /api/register

📥 Request Body:

{
  "nm_lengkap": "string",
  "email": "string",
  "username": "string",
  "password": "string"
}

📤 Sample Response:

{
  "message": "User registered successfully",
  "user": {
    "id": "string",
    "email": "string",
    "username": "string"
  }
}

Login

Login dengan username dan password.

POST /api/login

📥 Request Body:

{
  "username": "string",
  "password": "string"
}

📤 Sample Response:

{
  "code": 200,
  "message": "Login success",
  "data": {
    "uuid": "string",
    "fullName": "string"
  },
  "token": "string"
}

Get All Notes

Mengambil semua notes beserta nama lengkap user.

GET /api/notes

📥 Request Body:

{}

📤 Sample Response:

{
  "code": 200,
  "message": "Anda Berhasil Mengakses API Notes",
  "data": {
    "notes": [
      {
        "nm_lengkap": "string",
        "id_notes": "string",
        "id_user": "string",
        "title": "string",
        "content": "string",
        "created_at": "string",
        "updated_at": "string"
      },
      {
        "nm_lengkap": "string",
        "id_notes": "string",
        "id_user": "string",
        "title": "string",
        "content": "string",
        "created_at": "string",
        "updated_at": "string"
      }
    ]
  }
}

Get Note by ID

Mengambil satu note berdasarkan ID-nya.

GET /api/notes/{id_notes}

📥 Request Body:

{
  "id_notes": "string"
}

📤 Sample Response:

{
  "code": 200,
  "message": "Berhasil mendapatkan Notes",
  "data": {
    "id_notes": "string",
    "title": "string",
    "content": "string",
    "id_user": "string",
    "created_at": "datetime",
    "updated_at": "datetime"
  }
}

Create Note

Membuat note baru (memerlukan token Authorization).

POST /api/notes

📥 Request Body:

{
  "title": "string",
  "content": "string"
}

📤 Sample Response:

{
  "code": 200,
  "message": "Anda Berhasil Membuat Notes",
  "data": {
    "id_notes": "string",
    "title": "string",
    "content": "string"
  }
}

Update Note

Memperbarui note yang dimiliki user (memerlukan token Authorization).

PUT /api/notes

📥 Request Body:

{
  "id_notes": "string",
  "title": "string",
  "content": "string"
}

📤 Sample Response:

{
  "code": 200,
  "message": "Berhasil Update Notes",
  "data": {
    "id_notes": "string",
    "title": "string",
    "content": "string"
  }
}

Delete Note

Menghapus note yang dimiliki user (memerlukan token Authorization).

DELETE /api/notes

📥 Request Body:

{
  "id_notes": "string"
}

📤 Sample Response:

{
  "code": 200,
  "message": "Berhasil Menghapus Notes"
}