Skip to content
mahithegeek edited this page Oct 13, 2016 · 12 revisions

Welcome to the Leave-Management-System wiki! Following is the description of Web-Service APIs and JSON params needed.These are POST APIs Every API requires a accessToken retrieved from Google OAuth (currently google but can be extended to other services) in the request body as following :

{ tokenID = "ABCD" }

TokenID is validated and the associated user is authorised and depending on the access rights, the API is executed. If the user has limited access rights, appropriate error will be thrown.

1. login - API would be "http://serverurl/login" Login API expects only the tokenID in the request body.User is validated against the database and appropriate response is sent.

2. users - "http://serverurl/users" API to get list of employees reporting to the user and their available leaves. It expects tokenID in the request body.

3.leave - "http://serverurl/leave" This API is used to submit a leave request. It expects a authenticated user and expects the following JSON data as part of the request:

{ "tokenID" : "ABCD123", "leave" : { "fromDate" : "16/08/2016", "toDate" : "19/08/2016", "isHalfDay" : true, "type" : "Vacation" } } It returns errors if any of the input params is invalid. If "isHalfDay" is true the API considers only fromDate for the leave request.

4.availableLeaves - "http://serverurl/availableLeaves" This API retrieves the available leaves for the user determined by the tokenID passed in the request. This API expects only the tokenID in the body { tokenID = "ABCD" }

5.leaveRequests - "http://serverurl/leaveRequests" This API retrieves all the leave requests that came in to the user (typically a user with approval authority like manager, lead etc.). The request just needs tokenID in the body as : { tokenID = "ABCD" }

The response would contain a JSON with all the leave requests like this:

6.approveLeave - "http://serverurl/approveLeave" This API enables to approve any pending requests and hence updates the total leaves of the user. The request needs tokenID along with the request id of the request that was returned earlier in the "leaveRequests" API. { tokenID = "ABCD", requestID = 12 }

Clone this wiki locally