General - Insert absence

API Url

Used for adding a new absences. The API will check if it's allowed to enter absences for another employee.

POST
http://localhost:16010/ProMarkREST/rest/General/absences

Permissions: user

Request headers

FieldTypeDescription
Accept-LanguageoptionalString

=en-GB Language use for localization.

X-ClientoptionalString

=Client type.

Allowed values:"Portal""Mobile""Admin"
X-RoleoptionalNumber

ProMark role (1: Employee, 2: User).

Allowed values:{12}
X-WebPart-IdoptionalNumber

Unique web-part identifier.

Parameter

FieldTypeDescription
requestObject

Main object containing the request data.

  dataObject

Object containg data to be uploaded.

    absencesObject[]

Collection of absence intervals.

      activityoptionalString

Activity id

      attendanceDateDate

Attendance date to be absented.

      codeString

The reason code (identifier).

      empIdString

The employee ID.

      endTimeoptionalNumber

End time of day in seconds.

      hoursoptionalNumber

The absence time expressed in seconds. It's not needed if reason code is set-up as being percent of normal time.

      projectoptionalString

Project id

      startTimeoptionalNumber

Start time of day in seconds.

      typeNumber

Absence type (1: All-day, 2: Anytime, 3: Before Clock-in, 4: After Clock-out, 5: All-shift).

Size range: 1-5

Request example for adding partial absence via time interval:

{
"request": {
"data": {
"absences": [
{
"empId": "804",
"attendanceDate": "2017-06-22",
"type": 2,
"code": "W",
"startTime": 30600,
"endTime": 34200,
}
]
}
}
}

Request example for adding all-day absence:

{
"request": {
"data": {
"absences": [
{
"empId": "804",
"attendanceDate": "2017-06-22",
"type": 1,
"code": "D
}
]
}
}
}

Success 200

FieldTypeDescription
responseObject

Main object containing the response data.

  dataObject

Object containing the requested data.

    absencesObject[]

Collection of absence intervals.

      attendanceDateDate

Attendance date to be absented.

      backColorString

The background color in HEX of an absence.

      codeString

The reason code (identifier).

      descriptionString

Description of the reason for the absences

      empIdString

The employee ID.

      endTimeoptionalNumber

End time of day in seconds.

      foreColorString

The foreground color in HEX of an absence.

      hoursoptionalNumber

The absence time expressed in seconds. It's not needed if reason code is set-up as being percent of normal time.

      idString

Absences unique ID

      shortDescriptionString

The reason short description.

      startTimeoptionalNumber

Start time of day in seconds.

      typeNumber

Absence type (1: All-day, 2: Anytime, 3: Before Clock-in, 4: After Clock-out, 5: All-shift).

Size range: 1-5
  messageoptionalObject

Object containing response messages.

    codeNumber

Message code.

    textString

Message text.

    typeString

Type of message.

Allowed values:"warning""info"

Success example:

HTTP/1.1 200 OK
{
"response": {
"data": {
"absences": [
{
"empId": "804",
"attendanceDate": "2017-06-30",
"type": 2,
"code": "W",
"hours": 0,
"startTime": 31980,
"endTime": 36180,
"id": "2153607866~\u00002~\u000031980"
}
]
},
"errorCode": 0
"errorMessage": ""
}
}

Error 4xx

FieldTypeDescription
responseObject

Main object containing the response data.

  dataObject

Object containing the requested data (empty).

  errorCodeNumber

Error code.

  errorMessageString

Error description.

Error example:

HTTP/1.1 200 OK
{
"response": {
"data": {
"absences": [
{
"empId": "804",
"attendanceDate": "2017-07-01",
"type": 2,
"code": "W",
"hours": 0,
"startTime": 31980,
"endTime": 36180,
"id": "0"
}
]
},
"errorCode": 33
"errorMessage": "The referred day profile must have normal time"
}
}