CRUD API Operations

This document outlines the standard CRUD (Create, Read, Update, Delete) operations for our API, using 'Note' as the primary study case or object. Below are the typical operations you can perform.

Base URL: https://fdelux.globeapp.dev/api

Endpoint Summary

Method Path Description
GET: /api/notes Read (Paginated)
POST: /api/notes Create Note
GET: /api/notes/{id} Find Note by ID
PUT: /api/notes/{id} Update Note
DELETE: /api/notes/{id} Delete Note
GET: /api/notes/search?q=... Search Notes

Create Note

  • Method: POST
  • Endpoint: /notes

Example Request URL: https://fdelux.globeapp.dev/api/notes

Note: This operation simulates creating a note and these changes will be reset daily at 00:00 Jakarta/Indonesia Time.

Request

headers
{
  "Content-Type": "application/json",
  "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
}
body
{
  "title": "My First Note",
  "description": "This is the description of my first note. It can be quite long!"
}

Responses

201 Created
{
  "message": "Note created successfully",
  "data": {
    "note": {
      "id": 101,
      "title": "My First Note",
      "description": "This is the description of my first note. It can be quite long!",
      "created_at": "2023-10-27T10:00:00Z",
      "updated_at": "2023-10-27T10:00:00Z"
    }
  }
}
400 Bad Request
{
  "message": "Title and description are required",
  "details": "Please provide both title and description."
}
401 Unauthenticated
{
  "message": "Authentication required. Please provide a Bearer token.",
  "details": "Include a valid Bearer token in the Authorization header."
}

Read Notes

  • Method: GET
  • Endpoint: /notes
  • Query Parameters:
    • page (optional, default: 1): The page number to retrieve. Must be 1 or greater.
    • limit (optional, default: 10): The maximum number of notes per page. Must be between 1 and 100.

Example Request URL: https://fdelux.globeapp.dev/api/notes?page=1&limit=5

Request

headers
{
  "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
}

Responses

200 OK
{
  "message": "Notes fetched successfully",
  "data": {
    "notes": [
      {
        "id": 16,
        "title": "Infrastructure Monitoring Setup",
        "description": "Configured new monitoring alerts for critical server infrastructure.",
        "created_at": "2025-05-29T11:00:00Z",
        "updated_at": "2025-05-29T11:00:00Z"
      },
      {
        "id": 17,
        "title": "Team Building Event Planning",
        "description": "Finalized venue and activities for the annual team building retreat.",
        "created_at": "2025-05-30T09:30:00Z",
        "updated_at": "2025-05-30T09:30:00Z"
      },
      {
        "id": 18,
        "title": "Client Feedback Session",
        "description": "Collected feedback from key clients on recent feature releases.",
        "created_at": "2025-05-31T14:00:00Z",
        "updated_at": "2025-05-31T14:00:00Z"
      }
    ],
    "pagination": {
      "current_page": 1,
      "limit": 3,
      "total_notes": 100,
      "total_pages": 34
    }
  }
}
400 Bad Request
{
  "message": "Failed to fetch notes",
  "details": "Page and limit must be positive integers."
}
401 Unauthenticated
{
  "message": "Authentication required. Please provide a Bearer token.",
  "details": "Include a valid Bearer token in the Authorization header."
}

Search Notes

  • Method: GET
  • Endpoint: /notes/search
  • Query Parameters:
    • q (required, string): The search query.

Example Request URL: https://fdelux.globeapp.dev/api/notes/search?q=meeting

Request

headers
{
  "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
}

Responses

200 OK
{
  "message": "Search completed successfully",
  "data": {
    "notes": [
      {
        "id": 1,
        "title": "Meeting Minutes - Q4 Strategy",
        "description": "Discussed Q4 strategy, budget allocation, and team performance metrics.",
        "created_at": "2023-10-26T09:00:00Z",
        "updated_at": "2023-10-26T09:30:00Z"
      },
      {
        "id": 10,
        "title": "Client Meeting Follow-up",
        "description": "Prepared action items from client meeting regarding new feature requests.",
        "created_at": "2023-12-05T10:00:00Z",
        "updated_at": "2023-12-05T10:00:00Z"
      }
    ],
    "notes_count": 2
  }
}
400 Bad Request
{
  "message": "Search query cannot be empty",
  "details": "Please provide a valid search query."
}
401 Unauthenticated
{
  "message": "Authentication required. Please provide a Bearer token.",
  "details": "Include a valid Bearer token in the Authorization header."
}
405 Method Not Allowed
{
  "error": "Method Not Allowed",
  "message": "Only GET requests are supported for this endpoint."
}

Find Note by ID

  • Method: GET
  • Endpoint: /notes/{id}

Example Request URL: https://fdelux.globeapp.dev/api/notes/1

Request

headers
{
  "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
}

Responses

200 OK
{
  "message": "Note found successfully",
  "data": {
    "note": {
      "id": 1,
      "title": "Meeting Minutes",
      "description": "Discussed Q3 strategy and budget.",
      "created_at": "2023-10-26T09:00:00Z",
      "updated_at": "2023-10-26T09:00:00Z"
    }
  }
}
400 Bad Request
{
  "message": "Invalid note ID provided",
  "details": "Please provide a valid numeric note ID."
}
404 Not Found
{
  "message": "Note with ID 1 not found",
  "details": "No note found with the provided ID."
}
401 Unauthenticated
{
  "message": "Authentication required. Please provide a Bearer token.",
  "details": "Include a valid Bearer token in the Authorization header."
}

Update Note

  • Method: PUT
  • Endpoint: /notes/{id}

Example Request URL: https://fdelux.globeapp.dev/api/notes/1

Note: This operation simulates updating a note and these changes will be reset daily at 00:00 Jakarta/Indonesia Time.

Request

headers
{
  "Content-Type": "application/json",
  "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
}
body
{
  "title": "Updated Note Title",
  "description": "The description of the note has been changed."
}

Responses

200 OK
{
  "message": "Note updated successfully",
  "data": {
    "note": {
      "id": 1,
      "title": "Updated Note Title",
      "description": "The description of the note has been changed.",
      "created_at": "2023-10-26T09:00:00Z",
      "updated_at": "2023-10-27T14:00:00Z"
    }
  }
}
400 Bad Request
{
  "message": "Invalid note ID provided for update",
  "details": "Please provide a valid numeric note ID."
}
404 Not Found
{
  "message": "Note with ID 1 not found for update",
  "details": "No note found with the provided ID."
}
401 Unauthenticated
{
  "message": "Authentication required. Please provide a Bearer token.",
  "details": "Include a valid Bearer token in the Authorization header."
}

Delete Note

Delete a note by its ID.

  • Method: DELETE
  • Endpoint: /notes/{id}

Example Request URL: https://fdelux.globeapp.dev/api/notes/1

Note: This operation simulates deleting a note and these changes will be reset daily at 00:00 Jakarta/Indonesia Time.

Request

headers
{
  "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
}

Responses

204 No Content
<!-- Empty Response Body -->
400 Bad Request
{
  "message": "Invalid note ID provided for deletion",
  "details": "Please provide a valid numeric note ID."
}
404 Not Found
{
  "message": "Note with ID 1 not found for deletion",
  "details": "No note found with the provided ID."
}
401 Unauthenticated
{
  "message": "Authentication required. Please provide a Bearer token.",
  "details": "Include a valid Bearer token in the Authorization header."
}