Skip to main content
This endpoint requires an active authenticated session. Unauthenticated requests are redirected to the login page.

Endpoint

Description

Finds a task by its id and sets completed = 1, then returns the updated task object in the response.
Once a task is marked as completed, it is excluded from the GET /tasks/index response, which filters on completed = 0. The task will disappear from the active task list the next time fetchTasks is called.

Path parameters

integer
required
The unique identifier of the task to mark as completed.

Response

Returns a JSON object with a confirmation message and the updated task.

Response fields

string
A confirmation string. Value: "Task completed successfully."
object
The full task object after the update.

Example response

Error response

If no task with the given id exists:
HTTP status: 404

Controller code

Frontend Axios call