Query Notes

.

Executes safe, predefined SQL queries against the indexed Properties table to find notes. This becomes even more powerful for historical queries.

POST /api/v1/query_notes.php

  • Description: Fetches notes that match a specific, secure SQL query pattern.
  • Request: application/json
    1
    2
    3
    4
    5
    
    {
      "sql_query": "SELECT N.id FROM Notes N JOIN Properties P ON N.id = P.note_id WHERE P.name = 'status' AND P.value = 'DONE' AND P.created_at > '2023-10-27'",
      "page": 1,
      "per_page": 10
    }
    
  • Response (200 OK):
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    
    {
        "status": "success",
        "data": [
            {
                "id": 42,
                "content": "This is an updated task.\n{status::::DONE}\n{priority::High}",
                "properties": { "...": "..." },
                "...": "..."
            }
        ],
        "pagination": { "current_page": 1, "...": "..." }
    }