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.
http://localhost:16010/ProMarkREST/rest/General/absences
Permissions: user
Request headers
| Field | Type | Description |
|---|---|---|
Accept-Languageoptional | String | =en-GB Language use for localization. |
X-Clientoptional | String | =Client type. "Portal""Mobile""Admin" |
X-Roleoptional | Number | ProMark role (1: Employee, 2: User). {12} |
X-WebPart-Idoptional | Number | Unique web-part identifier. |
Parameter
| Field | Type | Description |
|---|---|---|
| request | Object | Main object containing the request data. |
| data | Object | Object containg data to be uploaded. |
| absences | Object[] | Collection of absence intervals. |
activityoptional | String | Activity id |
| attendanceDate | Date | Attendance date to be absented. |
| code | String | The reason code (identifier). |
| empId | String | The employee ID. |
endTimeoptional | Number | End time of day in seconds. |
hoursoptional | Number | The absence time expressed in seconds. It's not needed if reason code is set-up as being percent of normal time. |
projectoptional | String | Project id |
startTimeoptional | Number | Start time of day in seconds. |
| type | Number | Absence type (1: All-day, 2: Anytime, 3: Before Clock-in, 4: After Clock-out, 5: All-shift). 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
| Field | Type | Description |
|---|---|---|
| response | Object | Main object containing the response data. |
| data | Object | Object containing the requested data. |
| absences | Object[] | Collection of absence intervals. |
| attendanceDate | Date | Attendance date to be absented. |
| backColor | String | The background color in HEX of an absence. |
| code | String | The reason code (identifier). |
| description | String | Description of the reason for the absences |
| empId | String | The employee ID. |
endTimeoptional | Number | End time of day in seconds. |
| foreColor | String | The foreground color in HEX of an absence. |
hoursoptional | Number | The absence time expressed in seconds. It's not needed if reason code is set-up as being percent of normal time. |
| id | String | Absences unique ID |
| shortDescription | String | The reason short description. |
startTimeoptional | Number | Start time of day in seconds. |
| type | Number | Absence type (1: All-day, 2: Anytime, 3: Before Clock-in, 4: After Clock-out, 5: All-shift). 1-5 |
messageoptional | Object | Object containing response messages. |
| code | Number | Message code. |
| text | String | Message text. |
| type | String | Type of message. "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
| Field | Type | Description |
|---|---|---|
| response | Object | Main object containing the response data. |
| data | Object | Object containing the requested data (empty). |
| errorCode | Number | Error code. |
| errorMessage | String | 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"}}