-
Notifications
You must be signed in to change notification settings - Fork 0
REST API's
Anusha Shetty edited this page Dec 9, 2019
·
31 revisions
- 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!"
}
- 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! "
}
- 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": ""
}
]
}
- Create Task
SERVER_URI : http://www.brightlightventures.com/timetracker/index.php/api/task/create
METHOD : POST
REQUEST DATA : {
"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"}]
}
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! "
}