Get Specified Time Record

Return a specific time record for the specified tenant.

Command

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

Parameters

Name

Required

Data Type

Description

Parameter Type

tenantId

Yes

String

Unique identifier of the tenant.

Path

id

Yes

String

Unique identifier of the time record.

Path

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. Valid values:

  • SUCCESS - The operation was a success.

  • ERROR - A validation error occurred.

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.

template

The name of the template associated with the time record.

templateLabel

The label of the template 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.

startTimestamp

The DateTime of the start of the time record.

endTimestamp

The DateTime of the end of the time record.

timeBundleRef

The ID of the associated time bundle.

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.

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.

messages

If the status is SUCCESS, this field is always blank. If the status is ERROR, a validation error occurred. For example, the time record ID in the URL is invalid.

count

The number of records returned.

Examples

Sample API Call

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

Successful Responses

Response Body Sample

An internal error prevented the server from fulfilling the{
    "hostId": "e78358806ceaef67465d6d789eb478b5",
    "status": "SUCCESS",
    "content": {
        "timeRecordId": "z210125193616606887320bf",
            "startTimeEventId": "z210125193545828875780bf",
            "endTimeEventId": "z210125193559772877130bf",
            "rawTimeEventId": null,
            "hours": 3.5000000000,
            "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 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": "synthetic-person-object",
            "timeBundleRef": "z210125193601678879870bf",
            "chunkStatus": "OK"
    },
    "messages": [],
    "count": 1
}

Error Responses

Response Body Error Sample - Invalid Time Record ID in URL

{
    "hostId": "e78358806ceaef67465d6d789eb478b5",
    "status": "ERROR",
    "content": null,
    "messages": [
        {
            "type": "ERROR",
            "message": "Failed to load resource of type TimeRecord with Arguments [z2011132228456262022878d].",
            "code": "error.resourceNotFound",
            "arguments": {
                "type": "TimeRecord",
                "id": "z2011132228456262022878d"
            },
            "key": "TimeRecord"
        }
    ],
    "count": -1
}