Absence Web Service

Absence Web Service

Describes all endpoints to request absence web service between an HR system and the Staffbase HR platform. This includes:

/users/{userId}/leaves/{leaveId}

GET

Request a specific leave request that is identified by the ids of the user and the leave request. To know more about the schema used, refer Complete Leave Request Details.

URI Parameters

userId string required The identifier of the user in the HR system.
leaveId string required The identifier of the leave request.

Responses

200 OK

Returns the specific leave request by a user that was requested.

Examples:


					{
					 "id": "string",
					  "start": "2019-05-16T00:00",
					  "end": "2019-05-16T00:00",
					  "type": "Paid",
					  "status": "requested",
					  "title": "Paid Leave"
					}
					

DELETE

Deletes a specific leave request of a user that is identified by the ids of the user and the leave request.

URI Parameters

userId string required The identifier of the user in the HR system.
leaveId string required The identifier of the leave request.

Responses

200 OK

The specific leave request was successfully removed from the HR system.

Examples:


					{
					 "message": "The leave request was successfully deleted."
					}
					

PUT

Updates a leave request by an incremental update. The update can be editing the details, approving or declining a leave request.To know more about the schema used, refer Selective Leave Request Details.

URI Parameters

userId string required The identifier of the user in the HR system.
leaveId string required The identifier of the leave request.

Examples:

On Approving a Leave Request


					{
					 "status": "approved"
					}
					

On Changing the Time Period of a Leave Request


					{
					 "start": "2019-05-19T00:00",
 					 "end": "2019-05-22T00:00"

					}
					

Responses

200 OK

The specific leave request was successfully updated in the HR system. A complete dataset of the leave request is returned.

Examples:


					{
					 "id": "string",
					  "start": "2019-05-16T00:00",
					  "end": "2019-05-16T00:00",
					  "type": "Paid",
					  "status": "requested",
					  "title": "Paid Leave"
					}
					

/users/{userId}/leaves

GET

Request all leave requests of a user that is identified by its id. To know more about the schema used, refer Complete Leave Request Details.

URI Parameters

userID string required The identifier of the user in the HR system.

Responses

200 OK

Returns all leave requests by a user that was requested.

Example:


	[
					{
					   "id": "1",
					   "start": "2019-05-16T00:00",
					   "end": "2019-05-16T00:00",
					   "type": "Paid",
					   "status": "requested",
					   "title": "Paid Leave"

					}
	]
					

POST

Creates a leave request for a user that is identified by its id. To know more about the schema used, refer Partial Leave Request Details.

Example:


					{
					   "end": "2019-05-31T00:00",
					   "start": "2019-05-16T00:00",
					   "status": "requested",
					   "type": "0100"
					}
					

Absence Web Service Schemas

The following schemas describe data structures used in the Absence web service.

Complete Leave Request Details

When creating, requesting, or modifying a single leave request entity, these are the details in the response.

Name Type Description Accepted Values
id (required) string The identifier of the leave request. any
start (required) string The start date of the leave of absence. any
end (required) string The end date of the leave of absence.
It must be equal to or larger than the start date.
any
type (required) string The internal id of the type of leave request. any
status string The current status of the leave request. requested, declined, pending, approved
title (required) string The title of the leave request in the requested language. any

Example:


					{
					   "id": "1",
					   "start": "2019-05-16T00:00",
					   "end": "2019-05-16T00:00",
					   "type": "paid",
					   "status": "requested",
					   "title": "Paid leave"
					}
					

Partial Leave Request Details

A reduced dataset of a leave request, used to create a new leave request.

Name Type Description Accepted Values
type (required) string The internal id of the type of leave request. any
start (required) string The start date and time of the leave request. any
end (required) string The end date and time of the leave request. It must be than the start date. any
status string The current status of the leave request. requested, declined, pending, approved

Example:


					{
					   "start": "2019-05-16T00:00",
					   "end": "2019-05-16T00:00",
					   "type": "paid",
					   "status": "requested",
					   "title": "Paid leave"
					}
					

Selective Leave Request Details

Describes the schema used in updating a single field in the leave request. All the fields are optional for selective updates.

Name Type Description Accepted Values
type string The internal id of the type of leave request. any
start string The start date and time of the leave request. any
end string TThe end date and time of the leave request. It must be equal or larger than the start date. any
status string The current status of the leave request. requested, declined, pending, approved

Example:


					{
					   "start": "2019-05-16T00:00",
					   "end": "2019-05-16T00:00",
					   "type": "paid",
					   "status": "requested",
					   "title": "Paid leave"
					}
					

Collection of Leave Requests

Is a collection of leave requests, which lists all leave requests of a user but only with the partial set of details.

Name Type Description Accepted Values
LeaveRequests array of complete leave requests A collection of leave requests each a CompleteLeaveReuest. any

Example:


	[
					{
					   "id": "1",
					   "start": "2019-05-16T00:00",
					   "end": "2019-05-16T00:00",
					   "type": "paid",
					   "status": "requested",
					   "title": "Paid leave"
					}
	]
					

Leave Request Type

Describes the input parameter required to create a leave request. It also contains:

  • Type of leave, or example, paid leave
  • Id used in the HR system
Name Type Description Accepted Values
id (required) string The identifier of the leave request. any
fields (required) array (object) any
fields.id (required) string The internal id of the leave type. startDate, endDate, startTime, endTime
fields.format oneOf Format could be either of the following:

  • string according to fields.format.0
  • custom format according to fields.format.1
any
fields.format.0 string A format as defined in the JSON Schema Validation any
fields.format.1 (required) object The detailed description of a specific format. any
fields.format.1.type (required) string The field format is defined by the data type of the root, normally String. any
fields.format.1.pattern (required) string A valid regular expression. any
fields.required (required) boolean Is the field required or optional? any
fields.localization (required) object An object with localizations. any
fields.localization.title (required) string The title of the leave type in the requested language. any
minDuration integer The minimum duration of the absence in minutes. any
maxDuration integer The maximum duration of the absence in minutes. any
description (required) string The description title in the requested language. any

Example:


					{
					    "id": "string",
					    "fields": [
					    {
					    	"id": "startDate",
					    	"format": "string",
					    	"required": true,
					    	"localization": {
					        	"title": "string"
				    		} 
						}
					 	 ],
						"minDuration": 0,
					 	"maxDuration": 0,
						"description": "string"

					}
					

Collection of Leave Request Types

Describes a collection of different types of leaves.

Name Type Description Accepted Values
LeaveTypes array of partial leave types A collection of all types of leave requests. See, Leave Request Type. any

Example:


					{
					    "id": "string",
					    "fields": [
					    {
					    	"id": "startDate",
					    	"format": "string",
					    	"required": true,
					    	"localization": {
					        	"title": "string"
				    		} 
						}
					 	 ],
						"minDuration": 0,
					 	"maxDuration": 0,
						"description": "string"

					}