This API is for learning only. It is not suitable for real apps!


Get tasks

GET https://apithing.net/tasks?token=YOUR_TOKEN_HERE

Response


    [
        {
            "id": 2,
            "title": "Updated title",
            "description": "Updated description",
            "is_completed": false,
            "is_deleted": false,
            "created": "2019-12-25",
            "updated": "2019-12-26T18:01:40.480Z"
        },
        {
            "id": 5,
            "title": "Postman",
            "description": "This is task description",
            "is_completed": false,
            "is_deleted": false,
            "created": "2019-12-26",
            "updated": "2019-12-26T10:07:34.652Z"
        },
        {
            "id": 4,
            "title": "Finish Free Task API",
            "description": "Deploy on server, setup HTTPS certificate",
            "is_completed": true,
            "is_deleted": false,
            "created": "2019-12-26",
            "updated": "2019-12-26T10:06:45.551Z"
        }
    ]
        
    

Create new task

POST https://apithing.net/tasks?token=YOUR_TOKEN_HERE

Request body

Only title is required. Parameters description, is_completed and is_deleted are optional. You can send either form-encoded data or raw JSON. Both should work ;-)


     {
        "title": "Task title",
        "description": "This is optional task description",
        "is_completed": false,
        "is_deleted": false
     }
        

Response

Newly created task with id and other properties


     {
        "id": 20,
        "title": "Task title",
        "description": "This is optional task description",
        "is_completed": false,
        "is_deleted": false,
        "created": "2019-12-27",
        "updated": "2019-12-27T20:37:38.717Z"
     }
        

Errors

There is some validation. As mentioned previously title is required property and like description has max length set. If you send invalid data, you will get error response back along with information what is wrong.

Example


        {
            "status": "error",
            "message": "Invalid POST data",
            "errors": {
                "title": [
                    {
                        "message": "This field is required.",
                        "code": "required"
                    }
                ]
            }
        }
        

Update task

POST https://apithing.net/tasks/{ID}?token=YOUR_TOKEN_HERE

{ID} is the id of the task you want to update.

Request body

You can send only the properties you want to update. For example only is_completed to mark completed task


     {
        "is_completed": true
     }
    

Response

Response contains all task data. Same as when creating task for the first time.


     {
        "id": 20,
        "title": "Task title",
        "description": "This is optional task description",
        "is_completed": true,
        "is_deleted": false,
        "created": "2019-12-27",
        "updated": "2019-12-27T20:37:38.717Z"
     }
        

Errors

Similar to creating new task, update is also validated. You will get an error is you don't respect the max length and also if you don't send bool values to is_completed and is_deleted properties.

Delete task

You have choice how to implement deletion. You can either use the is_deleted property to perform what is known as a soft deletion and then hide those tasks or regularly delete it with request.

Delete request

DELETE https://apithing.net/tasks/{ID}?token=YOUR_TOKEN_HERE

Response


     {
        "status": "success"
     }
    

Errors

These errors apply to all available methods and have various 4xx status codes.

They always have status key with value error and message key with explanation what went wrong.

Example


     {
        "status": "error",
        "message": "Token not provided"
    }