---
title: "Capturing weekly or biweekly office timesheets"
slug: "capturing-weekly-or-biweekly-office-timesheets"
updated: 2024-03-13T15:27:19Z
published: 2024-03-13T15:27:19Z
canonical: "developers.cmicglobal.com/capturing-weekly-or-biweekly-office-timesheets"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://developers.cmicglobal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Capturing weekly or biweekly office timesheets

Capturing weekly or biweekly office timesheets in CMiC, these can be posted, unposted, unapproved.

## Step 1: Retrieve the job cost distribution

Find job using company code e.g. compCode=001

```
?finder=findByKeys;compCode=001
```

**Request**

```
curl --location --request GET 'https://mobtest.cmiccloudr12.com/cmictestrti/jc-rest-api/rest/1/jcjob?finder=findByKeys;compCode=001' \
--header 'Authorization: Basic Your-User:Pass'
```

## Step 2: Retrieve JC Job Phases

Retrieve cost codes related to the selected job using the finder query parameter e.g.

```
?finder=selectJobPhases;compCode=001,jobCode=00100
```

**Request**

```
curl --location --request GET 'https://mobtest.cmiccloudr12.com/cmictestrti/jc-rest-api/rest/1/jcjobcostcodes?finder=selectJobPhases;compCode=001,jobCode=00100' \
--header 'Authorization: Basic Your-User:Pass'
```

## Step 3: Retrieve JC Job Categories

Find job category code for a specific job and cost code using finder e.g.

```
?finder=selectJobCategory;compCode=001,jobCode=00100,costCode=15100
```

**Request**

```
curl --location --request GET 'https://mobtest.cmiccloudr12.com/cmictestrti/jc-rest-api/rest/1/jcjobcategory?finder=selectJobCategory;compCode=001,jobCode=00100,costCode=15100' \
--header 'Authorization: Basic Your-User:Pass'
```

## Step 4: Retrieve an employee

Retrieve employee information to be used when creating a time sheet.

As an example we will use employee number 02085 and retrieve the following fields:

| Attribute | Description |
| --- | --- |
| EmpNo | Employee number |
| EmpJobCompCode | Default Company the employee belongs to. |
| EmpWcbCode | WCB according to timesheet job |
| EmpUnionized | Union Employee - ‘Y’ or ‘N’ |
| EmpUniCode | Union Code the employee belongs to. |
| EmpUniName | Union name |
| EmpTrdCode | Trade Code |
| EmpTrdName | Trade name |

As an example query parameters would look like:

```
?finder=PyEmployeeFinder;EmpNoVar=02085&fields=EmpNo,EmpJobCompCode,EmpWcbCode,EmpUnionized,EmpUniCode,EmpUniName,EmpTrdCode,EmpTrdName&onlyData=true
```

**Request**

```
curl --location --request GET 'https://mobtest.cmiccloudr12.com/cmictestrti/hcm-rest-api/rest/1/pyemployee?finder=PyEmployeeFinder;EmpNoVar=02085&fields=EmpNo,EmpJobCompCode,EmpWcbCode,EmpUnionized,EmpUniCode,EmpUniName,EmpTrdCode,EmpTrdName&onlyData=true' \
--header 'Authorization: Basic Your-User:Pass'
```

## Step 5: Retrieve PY Unions

Retrieving employee's union information using q parameter. E.g.

```
?q=UniCode=1644
```

**Request**

```
curl --location --request GET '/hcm-rest-api/rest/1/pyunions?q=UniCode=1644' \
--header 'Authorization: Your-User:Pass'
```

## Step 6: Retrieve PY Trades

Retrieving employee's trade information using q parameter. E.g.

```
?q=TrdCode=U001
```

**Request**

```
curl --location --request GET '/hcm-rest-api/rest/1/pytrades?q=TrdCode=U001' \
--header 'Authorization: Your-User:Pass'
```

## Step 7: Create a PY Employee Weekly Timesheet

**Request**

```
curl --location --request POST 'https://mobtest.cmiccloudr12.com/cmictestrti/hcm-rest-api/rest/' \
--header 'Content-Type: application/vnd.oracle.adf.batch+json' \
--header 'Authorization: Basic Your-User:Pass' \
--data-raw '{
    "parts": [{
            "id": "part1",
            "path": "/1/pyemptimesheet",
            "operation": "create",
            "payload": {
                "TshCompCode": "001",
                "TshPrnCode": "WK",
                "TshPprYear": 2022,
                "TshPprPeriod": 29,
                "TshDocumentNo": "D01",
                "TshBatchPostFlag": "N",
                "TshDate": "2022-07-18",
                "TshEmpNo": "02085",
                "TshTypeCode": "J",
                "TshJobdeptwoId": "00100",
                "TshPhsacctwiId": "15100",
                "TshCatexpId": "M",
                "TshNormalHours": 8,
                "TshDotHours": 0,
                "TshOtHours": 0,
                "TshOhType": null,
                "TshOtherHours": 0,
                "TshWcbCode": "5506",
                "TshWorkCompCode": "001",
                "TshExpAmount": null,
                "TshExpCode": null,
                "TshExpQuantity": null,
                "TshExpRate": null,
                "TshUnionCode": "1644",
                "TshTradeCode": "U001",
                "TshVUuid": "8b1d7922-ba6d-4fa1-a380-e329b592676f"

            }
        }, {
            "id": "part2",
            "path": "/1/pyemptimesheet",
            "operation": "create",
            "payload": {
                "TshCompCode": "001",
                "TshPrnCode": "WK",
                "TshPprYear": 2022,
                "TshPprPeriod": 28,
                "TshDocumentNo": "D02",
                "TshBatchPostFlag": "N",
                "TshDate": "2022-07-19",
                "TshEmpNo": "02085",
                "TshTypeCode": "J",
                "TshJobdeptwoId": "00100",
                "TshPhsacctwiId": "15100",
                "TshCatexpId": "M",
                "TshNormalHours": 8,
                "TshDotHours": 0,
                "TshOtHours": 0,
                "TshOhType": null,
                "TshOtherHours": 0,
                "TshWcbCode": "5506",
                "TshWorkCompCode": "001",
                "TshExpAmount": null,
                "TshExpCode": null,
                "TshExpQuantity": null,
                "TshExpRate": null,
                "TshUnionCode": "1644",
                "TshTradeCode": "U001",
                "TshVUuid": "e9ababce-3bcf-4d08-bcb5-79b3486d482f"

            }
        }, {
            "id": "part3",
            "path": "/1/pyemptimesheet",
            "operation": "create",
            "payload": {
                "TshCompCode": "001",
                "TshPrnCode": "WK",
                "TshPprYear": 2022,
                "TshPprPeriod": 28,
                "TshDocumentNo": "D03",
                "TshBatchPostFlag": "N",
                "TshDate": "2022-07-20",
                "TshEmpNo": "02085",
                "TshTypeCode": "J",
                "TshJobdeptwoId": "00100",
                "TshPhsacctwiId": "15100",
                "TshCatexpId": "M",
                "TshNormalHours": 8,
                "TshDotHours": 0,
                "TshOtHours": 0,
                "TshOhType": null,
                "TshOtherHours": 0,
                "TshWcbCode": "5506",
                "TshWorkCompCode": "001",
                "TshExpAmount": null,
                "TshExpCode": null,
                "TshExpQuantity": null,
                "TshExpRate": null,
                "TshUnionCode": "1644",
                "TshTradeCode": "U001",
                "TshVUuid": "88136217-cc58-45ac-b1e1-fff73a313c00"

            }
        }, {
            "id": "part4",
            "path": "/1/pyemptimesheet",
            "operation": "create",
            "payload": {
                "TshCompCode": "001",
                "TshPrnCode": "WK",
                "TshPprYear": 2022,
                "TshPprPeriod": 28,
                "TshDocumentNo": "D04",
                "TshBatchPostFlag": "N",
                "TshDate": "2022-07-21",
                "TshEmpNo": "02085",
                "TshTypeCode": "J",
                "TshJobdeptwoId": "00100",
                "TshPhsacctwiId": "15100",
                "TshCatexpId": "M",
                "TshNormalHours": 8,
                "TshDotHours": 0,
                "TshOtHours": 0,
                "TshOhType": null,
                "TshOtherHours": 0,
                "TshWcbCode": "5506",
                "TshWorkCompCode": "001",
                "TshExpAmount": null,
                "TshExpCode": null,
                "TshExpQuantity": null,
                "TshExpRate": null,
                "TshUnionCode": "1644",
                "TshTradeCode": "U001",
                "TshVUuid": "04ba3b6f-b832-4888-b831-e0b95101ca42"

            }
        }, {
            "id": "part5",
            "path": "/1/pyemptimesheet",
            "operation": "create",
            "payload": {
                "TshCompCode": "001",
                "TshPrnCode": "WK",
                "TshPprYear": 2022,
                "TshPprPeriod": 28,
                "TshDocumentNo": "D05",
                "TshBatchPostFlag": "N",
                "TshDate": "2022-07-22",
                "TshEmpNo": "02085",
                "TshTypeCode": "J",
                "TshJobdeptwoId": "00100",
                "TshPhsacctwiId": "15100",
                "TshCatexpId": "M",
                "TshNormalHours": 8,
                "TshDotHours": 0,
                "TshOtHours": 0,
                "TshOhType": null,
                "TshOtherHours": 0,
                "TshWcbCode": "5506",
                "TshWorkCompCode": "001",
                "TshExpAmount": null,
                "TshExpCode": null,
                "TshExpQuantity": null,
                "TshExpRate": null,
                "TshUnionCode": "1644",
                "TshTradeCode": "U001",
                "TshVUuid": "e6c08951-9f76-4cb8-9f01-98d4e25d19a3"

            }
        }
    ]
}
'
```
