Skip to content

REST API's

Anusha Shetty edited this page Dec 11, 2019 · 31 revisions
  1. User Login
  SERVER_URI 	: 	http://www.brightlightventures.com/timetracker/index.php/api/login

  METHOD 	: 	POST

REQUEST DATA 	: 	{  
 			   "username":"test@printgreener.com",
 			   "password":"gp.@1234"
 			}

RESPONSE        : 
                  a) On sucessfull login gives 
                      {
                        "success": 1,
                        "user_details": {
                                       "id": "1",
                                       "type": "user",
                                       "email": "admin@printgreener.com",
                                       "auth_key": "eyJ0eXAiOiJKV1QiLCJhbG",
                                       "username":"John",
                                       "profile_pic":""
                                       "login_time":"2019:12:04 09:53:56"
                                        }
                      }
                      

                  b) On validation error like invalid email or invalid password it gives 

                      {
                         "success": 0,
                         "msg": "Invalid username or password!"
                      }
  1. Task List
  SERVER_URI 	: 	http://www.brightlightventures.com/timetracker/index.php/api/task

  METHOD 	: 	POST

REQUEST DATA	:  {
 			      "id": 1
                              "page_no": 1 
                   }
HEADERS : {
               "Authorization-Key" : //auth_key from login API
           }

RESPONSE        : 
                  a) On Success

                     {
                      "success": 1,
                      "details": [
                                 {
                                  "project_name": "Sphere",
                                  "project_id": "1",
                                  "image_name": "",
                                  "task_name": "task5",
                                  "description" : "xx",
                                  "id": "4",
                                  "completed": "0",
                                  "time_details": [
                                      {
                                       "id": "7",
                                       "task_date": "2019-11-14",
                                       "start_time": "2019-11-13 16:19:14",
                                       "end_time": "2019-11-28 11:16:47",
                                       "task_description": null,
                                       "total_hours": "0",
                                       "total_minutes": "21298"
                                      },
                                      {
                                       "id": "11",
                                       "task_date": "2019-11-28",
                                       "start_time": "2019-11-28 12:44:30",
                                       "end_time": "2019-11-28 12:45:04",
                                       "task_description": null,
                                       "total_hours": "0",
                                       "total_minutes": "1"
                                     }]

                                },
                               {
                                 "project_name": "Buck",
                                 "project_id": "1",
                                 "image_name": null,
                                 "task_name": "task22",
                                 "description" : "xsgfdhx",
                                 "id": "8",
                                 "completed": "1",
                                 "time_details": []
                               }
                             ]
                        }
                  b) if auth-key is incorrect

                     {
                       "success":0,
                       "status": 401,
                       "msg": "Unauthorized Access! "
                     }
                  
  1. User Project List
  SERVER_URI 	: 	http://www.brightlightventures.com/timetracker/index.php/api/task/projects

  METHOD 	: 	POST

REQUEST DATA 	: 	{  
 			   "userid":"3"
 			}
HEADERS : {
               "Authorization-Key" : //auth_key from login API
           }
RESPONSE        : 
                  a) On success
                      {
                       "success": 1,
                       "details": [
                                   {
                                   "project_name": "Sphere",
                                   "id": "1",
                                   "color_code": "",
                                   "image_name": "",
                                   "modules": [
                                            {
                                             "id": "2",
                                             "name": "zsgsdfgh"
                                            },
                                            {
                                             "id": "3",
                                             "name": "aaaaa"
                                           }
                                       ]
                                    }
                                ],
                       "default_module": [
                                 {
                                   "id": "1",
                                   "name": "General"
                                }
                        ]
                       }
  1. Create Task
  SERVER_URI 	: 	http://www.brightlightventures.com/timetracker/index.php/api/task/create_edit

  METHOD 	: 	POST

REQUEST DATA FOR CREATE	:  {
 			      "userid": 1,
                              "task_name": "DB design",
                              "task_desc": "Design users table",
                              "project_id": 1,
                              "project_module":2, //module id
                              "time_range":[{"date":"2019-12-08","start":"2019-12-08 08:59 ","end":"2019-12-08 10:49","task_description":"xxxx"},{"date":"2019-12-09","start":"2019-12-09 08:59 ","end":"2019-12-09 10:49","task_description":"abcd"}]
                   }

REQUEST DATA FOR EDIT:  {
 			      "userid": 1,
                              "task_id":1,
                              "task_name": "DB design",
                              "task_desc": "Design users table",
                              "project_id": 1,
                              "project_module":2, //module id
                              "time_range":[{"table_id":"12","date":"2019-12-08","start":"2019-12-08 08:59 ","end":"2019-12-08 10:49","task_description":"xxxx"},{"date":"2019-12-09","start":"2019-12-09 08:59 ","end":"2019-12-09 10:49","task_description":"abcd"}]
                   }
HEADERS : {
               "Authorization-Key" : //auth_key from login API
           }

RESPONSE        : 
                  a) On Success

                     {
                      "success": 1,
                     "task_id": 61,
                     "msg": "Task Added Successfully!"
                     }
                  b) If Parameters are missing
                     {
                      "success": 0,
                      "msg": "Parameters error!"
                     }
                  c) If due to any errors ,task is not added
                     {
                      "success": 0,
                      "msg": "Failed to add task!"
                     }
                  d) if auth-key is incorrect

                     {
                       "success":0,
                       "status": 401,
                       "msg": "Unauthorized Access! "
                     }
      
  1. Start Timer
  SERVER_URI 	: 	http://www.brightlightventures.com/timetracker/index.php/api/task/start_timer

  METHOD 	: 	POST

REQUEST DATA FOR START TASK:  {
 			      "userid": "1",
                              "type": "task",
                              "task_id": "1"
                            }

REQUEST DATA FOR START LOGIN:  {
 			      "userid": 1,
                              "type":"login"
                             }
HEADERS : {
               "Authorization-Key" : //auth_key from login API
           }

RESPONSE        : 
                  a) On Success

                     {
                      "success": 1,
                     "msg": "Timer started Successfully."
                     }
                  b) If Parameters are missing or incorrect
                     {
                      "success": 0,
                      "msg": "Parameters error!"
                     }
                  c) If due to any errors ,timer is not added
                     {
                      "success": 0,
                      "msg": "Something went wrong."
                     }
                  d) if auth-key is incorrect

                     {
                       "success":0,
                       "status": 401,
                       "msg": "Unauthorized Access! "
                     }
  1. Stop Timer
  SERVER_URI 	: 	http://www.brightlightventures.com/timetracker/index.php/api/task/stop_timer

  METHOD 	: 	POST

REQUEST DATA FOR START TASK:  {
 			      "userid": "1",
                              "type": "task",
                              "task_id": "1"
                            }

REQUEST DATA to LOG out for the day:  {
 			      "userid": 1,
                              "type":"login"
                             }
HEADERS : {
               "Authorization-Key" : //auth_key from login API
           }

RESPONSE        : 
                  a) On Success

                     {
                      "success": 1,
                     "msg": "Timer stopped Successfully."
                     }
                  b) If Parameters are missing or incorrect
                     {
                      "success": 0,
                      "msg": "Parameters error!"
                     }
                  c) If due to any errors ,timer is not added
                     {
                      "success": 0,
                      "msg": "Something went wrong."
                     }
                  d) if auth-key is incorrect

                     {
                       "success":0,
                       "status": 401,
                       "msg": "Unauthorized Access! "
                     }
 
  1. Login Details List
  SERVER_URI 	: 	http://www.brightlightventures.com/timetracker/index.php/api/login/details

  METHOD 	: 	POST

REQUEST DATA:              {
 			      "userid": "1",
                              "page_no": "1"
                            } 
HEADERS : {
               "Authorization-Key" : //auth_key from login API
           }
RESPONSE :     a) ON SUCCESS
                 {
                   "success": 1,
                   "details": [
                    {
                       "task_date": "2019-12-11",
                       "start_time": "2019-12-11 06:14:55",
                       "end_time": "2019-12-11 11:07:48"
                    },
                    {
                        "task_date": "2019-12-10",
                        "start_time": "2019-12-10 04:53:52",
                        "end_time": "2019-12-10 18:53:52"
                    }
                  ]  

                b) if auth-key is incorrect

                     {
                       "success":0,
                       "status": 401,
                       "msg": "Unauthorized Access! "
                     } 
                 c) Userid parameter not sent
                    {
                      "success": 0,
                      "msg": "Userid is required!"
                    }               

Clone this wiki locally