Page:
API Endpoints
3
API Endpoints
Marcel Schwarz edited this page 2020-04-21 06:46:13 +00:00
Table of Contents
Entities
- User (id(PK), roleid(FK), username, password, lastname, firstname, timetrackaccounts[List])
- Role (id(PK), name, permissions[List])
- TimetrackAccount(id(PK), userid(FK), revenue, name, description)
- TimeRecord (id(PK), timetrackaccountid(FK), start[DATETIME], end[DATETIME], time[CALCULATED], type[ENUM])
Endpoints (GET)
- "/login?username=bla&password=bla" → Returns a session token (later for authentication #16)
- "/logout?token=tk" → Invalidates the local token
- "/users?token=tk" → returns list of all users
- "/users/{uid}?token=tk" → returns a single user
- "/users/{uid}/accounts?token=tk" → returns all timetrack account ids of that user
- "/accounts/{accountid}?token=tk" → all metadata of that account
- "/records?token=tk&uid=bla&[startdate=date, enddate=date, timetrackaccount=[all, account1, account2]]" -> returns all records which match these params
- "/records/start?token=tk&accountid=bla" → start new record for that account
- "/records/stop?token=tk&accountid=bla" → stop recording for that account
Endpoints (POST)
- "/users?token=tk" → Payload user data in request body
- "/accounts?token=tk" → Payload new account in request body
- "/records?token=tk" → creates a new record (authentication through usertoken)
Endpoints (PUT)
- "/users/{uid}?token=tk" → updates the user, data in request body
- "/accounts/{accountid}?token=tk" → updates the account, data in request body
- "/records/{recordid}?token=tk" → updates a record, data in request body
Endpoints (DELETE)
- "/users/{uid}?token=tk" → deletes the user
- "/accounts/{accountid}?token=tk" → deletes the account
- "/records/{recordid}?token=tk" → deletes a record
Return types
- JSON → ALL Requests