Skip to content

Latest commit

 

History

History
278 lines (221 loc) · 4.9 KB

File metadata and controls

278 lines (221 loc) · 4.9 KB

TIMEREG SYSTEM API v2

What's news from v1?

  • Support REST-API following SCIM 2.0
  • Using object model to define the resource
  • Using HTTP Status Code to verify the success/failure of the request

Authenticate with JWT Token

Timereg API using JWT authenticate, token will be included in query string

GET /api/v2/user?token={token} HTTP/1.1	

or HTTP request body

POST /api/v2/user HTTP/1.1

{
	"token": "{token}"
}

or HTTP request header x-access-token

POST /api/v2/user HTTP/1.1	
x-access-token: {token}

If token is not provided or invalid, the request will be responded immediately with HTTP Status Code 401 Unauthorized

APIs

User API


GET /api/v2/user

Description

Get list of users in system with filters

Parameters

[not implement yet]

Response

An array of User


GET /api/v2/user/{userId}

Description

Get information of a user

Response Header
HTTP Status Code Reason
200 User found and returned in body
404 User not found
Response Body

An object of User


GET /api/v2/user/{userId}/timeregs

Description

Get all timereg records of a user

Parameters
key type required description
fromDateTime datetime no Get timereg records from this datetime
toDateTime datetime no Get timereg records until this datetime
Response Body

An array of Timereg


GET /api/v2/user/{userId}/billableAccounts

Description

Get all billable accounts of a user

Response Body

An array of ProjectPhase

Timereg API


GET /api/v2/timereg

Description

Get all timereg records with filters

Parameters
key type required description
userId string no ID of filtered user
timeregPeriodId string no ID of filtered timereg period
projectPhaseId string no ID of filtered project phase
fromDateTime datetime no Get timereg records from this datetime
toDateTime datetime no Get timereg records until this datetime
Response Body

An array of Timereg


POST /api/v2/timereg

Description

Create a new timereg record

Request Body

An object of Timereg

Response Header
HTTP Status Code Reason
200 Timereg record was saved successfully
400 Bad Request, check error message in response body for detail
409 Conflict, the from/toDateTime overlap with another record
Response Body

An object of created Timereg


GET /api/v2/timereg/{timeregId}

Description

Get a timereg detail

Response Header
HTTP Status Code Reason
200 Timereg record found and returned in body
404 Timereg record not found
Response Body

An object of found Timereg

Models

Timereg Model

{

}

User Model

{

}

ProjectPhase Model

{

  • id String project phase's ID
  • name String project phase's name
  • projectId String ID of the project followed by phase

}