Skip to content

Timetracker Rest API

dermoritz edited this page Jun 10, 2015 · 4 revisions

This page describes the resources with their methods available for timetracker. There are 3 roles distinguished “ADMIN” > “MANAGER” > “USER”. That means that ADMIN inherits all permissions from MANAGER and MANAGER inherits all from USER.
work in progress

general

All resources are available via base url /timetracker-backend/timtracker. The following resources are exposed (each maps to a persisted entity):

  • /booking : has “usersproject”, start time and end time
  • /project : has name (unique) and description
  • /user : has name (unique) and role
  • /usersprojects : represents projects registered to user, has project and user

common operations for all resources

For all resources the CRUD operations are equal and accept/respond either application/json or application/xml. Per default json is used but if request was sent with content-type header application/xml the response will be in xml format. The operationas are (http method: path, description):

  • POST:/{resource}, creates an entity, return 201 on success
  • GET:/{resource}/{id}, retrieves the entity with given id, returns entity and 200 on success, 404 if not found, the header for last modified is set accordingly to date in data base
  • PUT:/{resource}/{id}, updates entity with given id with data in body, returns 204 on success, 404 if not found
  • DELETE:/{resource}/{id}, deletes entity with given id, returns 204 on success, 404 if not found
  • GET:/{resource}/all with query param “page” and “pageSize”, if parameters are omitted all entities will be returned

resource specific operations

booking

  • GET: /booking/user/{userId} returns all bookings for given user
  • GET: /booking/project/{projectId} returns all bookings for given project
  • GET: /booking/{userId}/{epochStart}/{epochEnd} Returns all bookings for given user that overlap with given time interval (creation of a booking with this data will be rejected)

project

  • GET: /project/{name} returns project with given name, 404 if not found

user

  • GET: /user/{name} returns user with given name, 404 if not found
  • GET: /user/current returns user currently signed in

usersproject

  • GET: /usersprojects/user/{userId} returns projects registered to given user
  • GET: /usersprojects/project/{projectId} returns users registered to given project