General - Get reasons

API Url

Used for loading reasons depending on request. Employee restrictions will be applied on the returned reasons.

GET
http://localhost:16010/ProMarkREST/rest/General/employees/{empId}/reasons

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.

Path parameters

FieldTypeDescription
empIdoptionalString

Employee Identifier

Query parameters

FieldTypeDescription
absenceTypeoptionalString

Absence type for which you need the reason list (1: All-day, 2: Anytime, 3: Before Clock-in, 4: After Clock-out, 5: All-shift). (Used only if type is "AA")

dateoptionalDate

Attendance date for which you need to insert the request. Default is TODAY.

transSeqoptionalNumber

Identifier of the registration you are querying for. It will be added to the results in case it's missing, even if the employee does not ususally have access to it (might be set by manager).

typeoptionalString

Reason type for which you need the reason list ("CIE": Clock-in early, "CIL": Clock-in late, "CIA": Clock-in again, "CIS": Clock-in fixed, "COE": Clock-out early,"COL": Clock-out late, "COS": Clock-out fixed), "ESR": Employee shift rating, "AA": Absence (by default).

Success 200

FieldTypeDescription
responseObject

Main object containing the response data.

  dataObject

Object containing the requested data.

    reasonsObject[]

Collection of reasons.

      allowDistributionoptionalLogical

I have the option to choose more than one secondary reason for time distribution.

      backColoroptionalString

The reason backcolor as HEX (without #).

      codeString

The reason code (identifier).

      defaultEndTimeoptionalNumber

Default interval end time in seconds after midnight. Only for 'useInterval' = true.

      defaultHoursoptionalNumber

Default hours in seconds. Only for 'useInterval' = false && 'percent' = undefined.

      defaultStartTimeoptionalNumber

Default interval start time in seconds after midnight. Only for 'useInterval' = true.

      descriptionString

The reason description.

      extraDataTypeoptionalString

Extra data answear type(0=Not used, 1=Free text, 2=Normal time interval, 3=Secondary reason).

      foreColoroptionalString

The reason forecolor as HEX (without #).

      percentoptionalNumber

Percent out of normal time. There are reasons where absence time is set-up as beging a percent out of the normal time, so user does not need to insert the absence hours.

      projectTimeoptionalBoolean

If absence reason is allowed to have Project time or not.

      questionoptionalString

Extra data question.

      scopeoptionalNumber

Reason scope for absence reasons (0: All day, 1: Partial, 2: Both).

      secondaryReasonGroupoptionalObject[]

Secondary reason group.

      secondaryReasonsoptionalObject[]

Collection of secondary reasons.

        descriptionString

Secondary reason description.

        idString

Secondary reason identifier.

      shortDescriptionString

The reason short description.

      typeString

The type of reason.

      useIntervaloptionalBoolean

true= Enter absence time as time interval instead of absence hours.

  messageoptionalObject

Object containing response messages.

    codeNumber

Message code.

    textString

Message text.

    typeString

Type of message.

Allowed values:"warning""info"

Success example on clock-in early reasons:

HTTP/1.1 200 OK
{
"response": {
"data": {
"reasons": [{
"type": "CIE",
"code": "BS",
"description": "Baby sickness",
"shortDescription": "BS",
"question": "Secondary reason",
"extraDataType": 3,
"allowDistribution": false,
"secondaryReasons": [
{
"id": 2153649592,
"description": "Temperature is between 38 - 40 degrees"
},
{
"id": 2153649593,
"description": "Temperature is between 40 - 99 degrees"
}
]
}
]
},
"errorCode": 0,
"errorMessage": ""
}
}

Success example on absence reasons:

HTTP/1.1 200 OK
{
"response": {
"data": {
"reasons": [
{
"type": "AA",
"code": "HF",
"description": "Half-day holiday",
"shortDescription": "Half",
"foreColor": "FFFF00",
"backColor": "808000",
"extraDataType": 0,
"percent": 50
},
{
"type": "AA",
"code": "SS",
"description": "Sickness",
"shortDescription": "Sick",
"foreColor": "FFFF00",
"backColor": "FF0000",
"extraDataType": 0,
"useInterval": false,
"projectTime": true
}
]
},
"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 404 Not found
{
"response": {
"data": {},
"errorCode": 75,
"errorMessage": "Employee does not exist"
}
}