REST API Obtain Timesheet Information
search cancel

REST API Obtain Timesheet Information

book

Article ID: 255879

calendar_today

Updated On:

Products

Clarity PPM SaaS

Issue/Introduction

What filter can be used to obtain timesheets in a particular timesheet period?

Environment

Release : 16.1.0

Resolution

1. Run the following query:

select pruid,prid, prstart, prfinish
from PRTIMEPERIOD 
order by prid

2. Use one or more of the following to ensure the correct time periods and corresponding data are retrieved:

--a
https://serverexample/ppm/rest/v1/timePeriods 

--b
https://serverexample/ppm/rest/v1/timesheets?fields=uniqueName,timePeriodStart,timePeriodFinish

--c
https://serverexample/ppm/rest/v1/timesheets?fields=uniqueName,timePeriodId,timePeriodStart,timePeriodFinish&filter=(timePeriodFinish >= '2022-10-04T00:00:00') and (timePeriodFinish <= '2022-12-04T00:00:00') and (uniqueName = 'testuser')


Additional Information

--get contractors with timesheet
/ppm/rest/v1/resources?fields=uniqueName,employmentType&filter=(employmentType = '301')

--get date ranges
/ppm/rest/v1/timesheets?fields=uniqueName,employmentType,timePeriodId,timePeriodStart,timePeriodFinish&filter=(timePeriodFinish >= '2022-10-04T00:00:00') and (timePeriodFinish <= '2022-12-04T00:00:00')

--get projects that are active
/ppm/rest/v1/projects?fields=code,name,isActive&filter=(isActive = 'true')

--get timeentry and task information
/ppm/rest/v1/timesheets/5aaaaaa/timeEntries/5bbbbbb
/ppm/rest/v1/timesheets/5aaaaaa/timeEntries/5bbbbbb?fields=taskCode,taskId,phaseId,parentTaskId,parentTaskName

Q. Phase id returns as null. How can this be populated?

The task hierarchy needs to be established. Once established, the phase name, phaseID can be reviewed/obtained.

The following query can be used:

select a.name, a.code,
b.prid, b.prprojectid, b.prname, b.prexternalid, b.prwbslevel
from
inv_investments a,
prtask b
where b.prprojectid = a.id
and b.prwbslevel in (0,1,2)
and b.prprojectid = 5xxxxxx