Skip to content

Instantly share code, notes, and snippets.

@gjaya79
Last active March 17, 2017 10:33
Show Gist options
  • Save gjaya79/e076c5094b6424905e2a8733e83c296e to your computer and use it in GitHub Desktop.
Save gjaya79/e076c5094b6424905e2a8733e83c296e to your computer and use it in GitHub Desktop.
ADDO API Specification

Headers

{
  "Content-Type": "application/json"  ,
  "Accept": "application/json",
  "Api-Version": "",
  "Access-Token": "",
  "App-Version": "",
  "Device-Platform": "iphone" or "android"
}

_id - all primary key


USER Model

{
	"_id": "",
	"name": "",
	"phone_number": "",
	"profile_image": "",
	"website": "",
	"projects_count": 1,
	"about": "",
	"level": {
		"_id": ""
		"name": ""
	}
}

SIGNIN

POST api/sessions/

For both the cases api will be same, which is that frontend will firstly hit the digits server they will get an OTP, after submission of OTP they will get two keys, which they will send us, then backend will hit the digits server agin with these two keys, from where i will get the number, then we will check that it is the existing user or the new user, and will give the response accordingly.

If the user is existing then we will return a token else we will return phone number. Any one will only come back.

Send back empty string when the user a new user.

Request:

{
    "X-Auth-Service-Provider": "https://api.digits.com/1.1/sdk/account.json",
    "X-Verify-Credentials-Authorization": "OAuth     oauth_signature=\"CE9D8ynnnNt%2B94zyo8AXHR3SBSk%3D\",oauth_nonce=\"78F0FE72-6A4E-439B-B912-2CC5101E3E05\",oauth_timestamp=\"1489063665\",oauth_consumer_key=\"rU6EEaMlYYOQFKA21xX2h2kDe\",oauth_token=\"838922894797217792-rAz6kt5ayHupbg0VogjhGr78c79wTVG\",oauth_version=\"1.0\",oauth_signature_method=\"HMAC-SHA1\""
}

Response:

{
   "meta" : {
       "status" : true,
        "message" : ""
   },
  "response" : {
  		"user":{
	  	  "auth_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJub25lIn0.eyJ1c2VyX2lkIjoiRDg5NUYwREEtMDRDOS0xMUU3LTk5MTMtOEFEMzgzNjE0OTZDIn0.",
	      "_id": "",
	      "phone_number": "",
	      "name": "",
	      "profile_image": "",
	      "website": "",
	      "about": ""
  		}
   } 
}

POST api/profiles

Create a 2 default task(one for project and task) when a new profile is created and assign it to the same person. Due date should be 10minutes from now.

You can use this endpint while creating a profile and updating a profile.

When you are updating the profile use auth_token in the header.

Request:

{
    "X-Auth-Service-Provider": "https://api.digits.com/1.1/sdk/account.json",
    "X-Verify-Credentials-Authorization": "OAuth     oauth_signature=\"CE9D8ynnnNt%2B94zyo8AXHR3SBSk%3D\",oauth_nonce=\"78F0FE72-6A4E-439B-B912-2CC5101E3E05\",oauth_timestamp=\"1489063665\",oauth_consumer_key=\"rU6EEaMlYYOQFKA21xX2h2kDe\",oauth_token=\"838922894797217792-rAz6kt5ayHupbg0VogjhGr78c79wTVG\",oauth_version=\"1.0\",oauth_signature_method=\"HMAC-SHA1\"",
    "name": "",
    "profile_image": "image_url"
}

Response:

{
   "meta" : {
       "status" : true,
        "message" : ""
   },
  "response" : {
    "user": {
      "auth_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJub25lIn0.eyJ1c2VyX2lkIjoiRDg5NUYwREEtMDRDOS0xMUU3LTk5MTMtOEFEMzgzNjE0OTZDIn0.",
      "_id": "",
      "phone_number": "",
      "name": "",
      "profile_image": "",
      "website": "",
      "about": ""
    }
}

GET LIST PROJECTS

GET /api/projects?status=active&counts_per_page=25&page_number=0

Only active projects will be returned.

  • status - "active", "closed", "deleted" // optional default active
  • page_count // defaults to 25 and optional
  • page_number // defaults to 0 and optional

Response

{
  "meta": {
    "status": true,
    "message": "",
  },
  "response": {
 	 "page_number": 25,
    "counts_per_page": 1,
    "number_of_pages": 1,
    "projects": [
      {
        "name": "",
		 "owner": {
			"_id": "",
			"phone_number": "",
			"name": "",
			"profile_image": "",
			"website": "",
			"about": ""
        },
        "status": "active",
        "levels_count": 1
      }
    ]
  }
}

GET PROJECT DETAILS

GET api/projects/:id

Owner and all members of the project

status: active or deleted

{
  "meta": {
    "status": true,
    "message": ""
  },
  "response": {
    "project": {
      "name": "",
      "owner": {
			"_id": "",
			"phone_number": "",
			"name": "",
			"profile_image": "",
			"website": "",
			"about": ""
        },
      "status": "active",
      "levels_count": 1,
      "tasks_count": 0,
      "levels": [
        {
          "name": "",
          "members_count": 1,
          "members": [
            {
				"_id": "",
				"phone_number": "",
				"name": "",
				"profile_image": "",
				"website": "",
				"about": ""
	        }
          ]
        }
      ]
    }
  }
}

Project Creation

POST /api/projects

Request

{
	"project": {
		"name": ""
	}
}

Response

{
	"meta": {
	    "message": "",
	    "status": true
	  },
	"response":{
		"project": {
      "name": "",
      "owner": {
			"_id": "",
			"phone_number": "",
			"name": "",
			"profile_image": "",
			"website": "",
			"about": ""
        },
      "status": "active",
      "levels_count": 1,
      "tasks_count": 0,
      "levels": [
        {
          "name": "",
          "members_count": 1,
          "members": [
            {
				"_id": "",
				"phone_number": "",
				"name": "",
				"profile_image": "",
				"website": "",
				"about": ""
	        }
          ]
        }
      ]
    }
	}
}

DELETE /api/projects/:id

Reponse

{
	"meta": {
	    "code": "200",
	    "message": "It is deleted successfully",
	    "status": "true"
	  },
	"response":{}
}

--

Level Creation

POST /api/roles

Request

{
	"name": "",
	"project_id": ""
}

Response

{
	"meta": {
	    "code": "200",
	    "message": "It is deleted successfully",
	    "status": "true"
	},
	"response":{
		"level"{
			"_id": "",
          "name": "",
          "member_count": 0,
          "members": []
        }
      }
	}
}

Member Invite

POST /api/members

Request

{
	members:[
		{
			"name": "",
			"phone_number": "",
			"level_id": ""
		}
	]
}

Response

{
	"meta": {
	    "code": "200",
	    "message": "",
	    "status": "true"
	},
	"response":{
      "members": [
        {
          "_id": "",
          "name": "",
          "profile_image": "",
          "phone_number": "",
          "invite_status": ""
        }
      ]
	}
}

Create Task/Sub tasks

POST /api/tasks

When project_id is not specified then the task will be added to personal board.

When parent_task_id is present then it is a sub-task. Otherwise a task.

Name is mandatory
Assignee is mandatory
Due date is mandatory

Request

{
	task:
		{
			"project_id": "optional"
			"name": "",
			"description": "optional"
			"assignee_id": "member_id",
			"parent_task_id": "optional",
			"due_date": "epoch",
			"attachments": [
				{
					"url": "",
					"name": "",
					"type": ""
				}
			]
		}
	
}

Response

{
	"meta": {
	    "code": "200",
	    "message": "Task created",
	    "status": "true"
	},
	"response":{
      "task": 
        {
          "_id": "",
          "name": "",
          "description": "",
	  "attachments": [
	  	{
			"_id": ""
			"name": "",
			"url": "",
			"created_at": "",
			"file_type: ""
		}
	  ],
          "sub_task": [],
          "followers": []
        }
      
	}
}

Add Followers

POST /api/tasks/:id/followers

Request

{
	followers: ["_id", "_id"]
}

Response

{
	"meta": {
	    "code": "200",
	    "message": "",
	    "status": "true"
	},
	"response":{
      "followers": [
        {
          "_id": "",
          "name": "",
          "profile_image": "",
          "phone_number": ""
        }
      ]
	}
}

PATCH /api/tasks/:id

Only Task owner and Assignee can edit.

Reopen : status is mandatory Reschedule: due_date is mandatory

Reopen and Reschedule need to be discussed

Request

{
	task:{
		"name": "",
		"description": "",
		"assignee": "",
		"status": "",
		"due_date": "",
		"attachments": [
			{
				"url": "",
				"name": "",
				"type": ""				
			}
		]
	}
}

Response

{
	"meta": {
	    "code": "200",
	    "message": "",
	    "status": "true"
	},
	"response":{
      "followers": [
        {
          "_id": "",
          "name": "",
          "profile_image": "",
          "phone_number": ""
        }
      ]
	}
}

GET Task List

Type: incomplete, completed, by_project, due_date, deleted

GET /api/tasks?type=

task status : active, closed, deleted

Replies based on the type

look for key "tasks" incomplete: Array of tasks, reverse chronological
completed: Array of tasks, reverse chronological
deleted: Array of tasks, reverse chronological

due_date: Grouped by date (today, tomorrow, ...)
by_project: grouped by project

Response

{
	"meta": {
	    "code": "200",
	    "message": "",
	    "status": "true"
	},
	"response":{
		"tasks":[
			{
         	"_id": "",
         	"name": "",
         	"description": "",
         	"due_date": "epoch",
         	"owner": "",
         	"status": ""
         }
		],
		"today":[		
		{
         	"_id": "",
         	"name": "",
         	"description": "",
         	"due_date": "epoch",
         	"owner": "",
         	"status": ""
         }
      ],
      "tommorrow": [
      ]
      ...
	}
}

Delete Task

DELETE /api/tasks/:id

{
	"meta": {
	    "code": "200",
	    "message": "It is deleted successfully",
	    "status": "true"
	  },
	"response":{}
}

GET List of Users who are in my level and below my level

GET /api/projects/:id/members


GET All project users

GET /api/projects/:id/users


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment