To use these endpoints, the Public User API must be enabled by the administrator, as it is disabled by default!
GET
/api/v3/user/app_settings
This endpoint is used to retrieve global application settings.
- No request headers required.
No special headers are needed for the request.
- Request limit: Defined by
Config.API_USER_RATELIMIT
(user-specific rate limit).
- No input data required.
The request body should be empty.
-
HTTP 200 - OK (GET): If the request is successful, it will return the current application settings.
Example Response:
{ "markdown_admin_enabled": true, "markdown_frontend_enabled": false, "approve_questions_first": true }
-
HTTP 404 - Not Found: If the application settings are not yet set, it will return a 404 error.
Example Response:
{ "error": "App Settings are not set yet!" }
-
HTTP 500 - Internal Server Error: If a server error occurs while processing the request, it will return an error message with a 500 status code.
Example Response:
{ "error": "An error occurred while loading application settings! Try again later." }
- The endpoint fetches the current application settings stored in the database.
- If the settings exist, they are returned as a JSON response.
- If the settings do not exist, a 404 error is returned.
GET
/api/v3/user/fetch_all_questions
This endpoint allows users to fetch all questions stored in the database, ordered by date in descending order (newest first).
- No request headers required.
No special headers are needed for the request.
- Request limit: Defined by
Config.API_USER_RATELIMIT
(user-specific rate limit).
- No input data required.
The request body should be empty.
-
HTTP 200 - OK: If questions exist, returns a list of all questions.
Example Response:
[ { "id": "abea6464-43af-4fc2-9ae4-392678466788", "date": "2025-02-07 12:34:56", "question": "Hi!", "answer": "Hello there!" }, { "id": "30f9692e-3f3a-4499-b6a9-4aa26491a703", "date": "2025-02-06 10:20:30", "question": "How does this application work?", "answer": "This application works with some Python and JavaScript magic!" } ]
-
HTTP 200 - No Questions: If no questions exist in the database.
Example Response:
{ "message": "No questions yet!" }
-
HTTP 500 - Internal Server Error: If an error occurs while retrieving questions from the database.
Example Response:
{ "error": "An error occurred while fetching questions list! Try again later." }
- Queries all records from the
Questions
table, ordering by date in descending order. - Iterates through the results, formatting each question into a structured JSON format.
- If no questions are found, returns a
"message": "No questions yet!"
response. - If any errors occur, logs the error and returns a
500
response. - Ensures proper closing of the SQL session in the
finally
block.
POST
/api/v3/user/submit_question
This endpoint allows users to submit a new question. Depending on the application settings, questions may need to be approved by an administrator before they are visible to others. The endpoint ensures that only non-empty messages are accepted, and it handles the blocking of users with previously flagged IP addresses.
- No request headers required.
No special headers are needed for the request.
-
question
(string, required): The question that the user wants to submit.Example Request Body:
{ "question": "How are you doing?" }
- Request limit: Defined by
Config.API_USER_RATELIMIT
(user-specific rate limit).
-
HTTP 200 - OK: If the question is submitted successfully, it will return a success message. The question may either be immediately visible or await administrator approval.
Example Response:
{ "success": "Your message has been sent successfully!" }
Or if approval is required:
{ "success": "Your message has been sent successfully, but administrator needs to approve it before it will be visible!" }
-
HTTP 400 - Bad Request: If the question is empty or invalid, it will return a message indicating the error.
Example Response:
{ "error": "Sending question failed. Empty messages are not allowed!" }
-
HTTP 403 - Forbidden: If the sender's IP address is blocked, it will return a message indicating that the sender is blocked from submitting questions.
Example Response:
{ "error": "Sending question failed. You have been blocked!" }
-
HTTP 500 - Internal Server Error: If an error occurs while processing the request, it will return an error message with a 500 status code.
Example Response:
{ "error": "An error occurred while sending your message! Try again later." }
- The endpoint accepts a
POST
request with aquestion
in the request body. - It checks if the question is empty; if so, it returns a
400
error. - It checks if the sender's IP address is blocked; if so, it returns a
403
error. - The question is assigned a unique
UUID
and added to theQuestions
table. - If the
approve_questions_first
setting is enabled, the question is marked as hidden until approved by the administrator. - Notifications are sent to the administrator (via push and Telegram) whenever a new question is submitted.
- If any error occurs during processing, it logs the error and returns a
500
error response.