Get All Time Records

Return a list of the time records for the specified tenant.

Command

GET https://{server}/api/v1/{tenantId}/timeRecords

Parameters

Name

Required

Data Type

Description

Parameter Type

tenantId

Yes

String

Unique identifier of the tenant.

Path

expand

No

String

Adds additional detail to the output. Valid options:

  • statusDetail

  • attributes

Can be comma-separated into the same query. For example:

timeRecords?expand=attributes,statusDetail

Query

filter

No

String

Spring Expression Language (EL) filter. Allows you to filter by a set of records (for example: name eq 'name'). The following fields are filterable:

  • personId

  • startTimeEventId

  • endTimeEventId

  • status

  • sourceId

  • template

  • templateCode

  • createdBy

  • createdTime

  • lastModifiedBy

  • lastModifiedTime

For more details on using the filter query parameter, see Filtering Guidelines.

Query

offset

No

String

The number of items to skip before starting to collect the result set. Used with limit.

Query

limit

No

String

The maximum number of results to return. Used with offset. Together, they determine the start index and number of records to return. For example, to return records 5 through 15 that have been sorted by name, use the following:

timeRecords?offset=5&limit=10&orderBy=name

Query

orderBy

No

String

Order by fields, sort order.

Query

select

No

String

Select the specific fields to be returned.

Query

count

No

String

The number of records to fetch from the database.

Query

groupBy

No

String

Categorization of results (group by a field).

Query

Responses

Status and Error Codes

See Common Status and Error Codes.

Successful Response Body

Field

Description

hostId

The identifier of the host instance that is returning the request.

status

The status of the request. For a successful operation, this value is always 'SUCCESS'.

content

Returns an array of records.

Field

Description

timeRecordId

The globally unique database-level identifier of the time record.

startTimeEventId

The globally unique database-level identifier of the start time event.

endTimeEventId

The globally unique database-level identifier of the end time event.

hours

The total number of hours of the time record. The value is the difference between the startTimestamp and endTimestamp.

tenantId

The ID of the tenant.

status

The status of the time record. See Enumerations for more information on valid status values.

statusDetail

Additional detail about the status when there’s a validation error. Valid values:

Field

Description

type

The applicationName of the apiKeys endpoint.

code

The error code of the status detail.

text

Text of the error code.

sourceId

The applicationName of the apiKeys endpoint.

timeType

A designation for the type of time record. For example, Break or Attendance.

systemGeneratedFlag

Indicates whether the time record was generated by pairing two time events.

personId

The globally unique database-level identifier of the person.

startTimestamp

The DateTime of the start of the time record.

endTimestamp

The DateTime of the end of the time record.

template

The name of the template associated with the time record.

templateLabel

The label of the template associated with the time record.

timeRecordChunkId

The unique ID of the time record chunk. Identifies the person, frequency and date associated with the time record.

attributes

Additional custom attributes for the time record. The structure is dependent on the attributes defined in the time template.

createdTime

The DateTime the time event was created.

lastModifiedTime

The DateTime the time event was last modified.

createdBy

The ID of the person who created the time event.

lastModifiedBy

The ID of the person who last modified the time event.

timeBundleRef

The ID of the associated time bundle.

resourceDetailId

The globally unique database-level identifier of the resource detail record.

chunkStatus

The status of the time records that are in the same series of time record data with the same timeRecordChunkID. Valid values:

Value

Description

OK

All data in the series is valid

ERROR

There is a validation error in at least one item in the the series of time recods.

userEditedFlag

Indicates whether the record was edited by a user.

recordType

Indicates whether the record was created using hours or start and end timestamps.

sequence

The order the record appears in the UI.

messages

If the status is SUCCESS, this field is always blank.

count

The number of records returned.

Examples

Sample API Call

GET https://tps-api.cfapps.sap.hana.ondemand.com/api/v1/pX2f8122a19/timeRecords
X-Application-Key: 30b5f27a684744116537882dda0e50efb8c5a6e26a7b7ad2f3fcb2c24436a840
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsImprdSI6Imh0dHB=

Successful Responses

Response Body Sample

{
    "hostId": "133efae08ca785e4163703aafe9e97eb",
    "status": "SUCCESS",
    "content": [
        {
            "timeRecordId": "z2110191749136207353962a",
            "startTimeEventId": "z21101822235704359570608",
            "endTimeEventId": "z2110191714439175567262b",
            "hours": 9.7500000000,
            "tenantId": "catX105ea2abf0",
            "status": "PROCESSED",
            "sourceId": "TPS",
            "timeType": "Work",
            "systemGeneratedFlag": true,
            "personId": "z21100118340397426541850",
            "startTimestamp": "2021-02-27 08:45:00.000 +0530",
            "endTimestamp": "2021-02-27 18:30:00.000 +0530",
            "template": "TimeBundleAutoverificationTemplateWithCombinerRule0009",
            "templateLabel": "TimeBundleAutoverificationTemplateWithCombinerRule0009",
            "timeRecordChunkId": "z21100118340397426541850.DAILY.2021-02-27+0000",
            "createdTime": "2021-10-19 17:49:13.817 +0000",
            "lastModifiedTime": "2021-10-19 17:49:14.383 +0000",
            "createdBy": "tenant_admin",
            "lastModifiedBy": "tenant_admin",
            "timeBundleRef": "z2110191749141197357562a",
            "resourceDetailId": "z21101521380050230939008",
            "chunkStatus": "OK"
        }
    ],
    "messages": [],
    "count": 1
}

Response Body Sample - Expanded Status Detail

{
    "hostId": "cf08754dce6c14913b56892892f20a43",
    "status": "SUCCESS",
    "content": [
        {
            "timeRecordId": "z210125193616606887320bf",
            "startTimeEventId": "z210125193545828875780bf",
            "endTimeEventId": "z210125193559772877130bf",
            "rawTimeEventId": null,
            "hours": 3.5000000000,
            "tenantId": "pX2f8122a19",
            "status": "PENDING_ATTRIBUTE",
            "statusDetail": [
                {
                    "type": "ERROR",
                    "code": null,
                    "text": "Missing required attribute(s): [Work_Division]"
                }
            ],
            "sourceId": "TPS",
            "timeType": "Work",
            "systemGeneratedFlag": true,
            "tenantExternalId": null,
            "personId": "z210125181919519751250bf",
            "template": "TE_TO_TB_BusinessRules_No_Default_Mandatory",
            "templateLabel": "Time Event To Time Bundle With Business Rules",
            "timeRecordChunkId": "z210125181919519751250bf.DAILY.2020-06-04+0000",
            "attributes": {},
            "startTimestamp": "2020-06-04 08:15:00.000 +0000",
            "endTimestamp": "2020-06-04 11:45:00.000 +0000",
            "createdTime": "2020-06-04 11:46:16.850 +0000",
            "lastModifiedTime": "2020-06-04 11:46:19.130 +0000",
            "createdBy": "z2011131740531275383178f",
            "lastModifiedBy": "tenant_admin",
            "timeBundleRef": "z210125193601678879870bf",
            "chunkStatus": "ERROR"
        }
    ],
    "messages": [],
    "count": 1
}

Response Body Sample - Expanded Attributes

{
    "hostId": "cf08754dce6c14913b56892892f20a43",
    "status": "SUCCESS",
    "content": [
        {
            "timeRecordId": "z210125193616617887330bf",
            "startTimeEventId": "z210125193609703880890bf",
            "endTimeEventId": "z210125193615255885660bf",
            "rawTimeEventId": null,
            "hours": 4.0000000000,
            "tenantId": "pX2f8122a19",
            "status": "PROCESSED",
            "statusDetail": [],
            "sourceId": "TPS",
            "timeType": "Work",
            "systemGeneratedFlag": true,
            "tenantExternalId": null,
            "personId": "z210125181919519751250bf",
            "template": "TE_TO_TB_BusinessRules_No_Default_Mandatory",
            "templateLabel": "Time Event To Time Bundle With Business Rules",
            "timeRecordChunkId": "z210125181919519751250bf.DAILY.2020-06-04+0000",
            "attributes": {
                "WorkSchedule": "workSchedule[workScheduleId eq 'z210125181918690749200bf'].",
                "CorporateCalendar": "corporateCalendar[corporateCalendarId eq 'z210125181918869749740bf']."
            },
            "startTimestamp": "2020-06-04 12:45:00.000 +0000",
            "endTimestamp": "2020-06-04 16:45:00.000 +0000",
            "createdTime": "2020-06-04 16:46:16.933 +0000",
            "lastModifiedTime": "2020-06-04 16:46:19.057 +0000",
            "createdBy": "z2011131740531275383178f",
            "lastModifiedBy": "synthetic-person-object",
            "timeBundleRef": "z210125193601678879870bf",
            "chunkStatus": "OK"
        }
    ],
    "messages": [],
    "count": 1
}