Reputation: 37
I'm trying to add timesheet entries against some specific task which is available in the MS Project Server 2013. I have ways of creating TASK in Project Server using REST endpoints, but could not find a way straight forward for the timesheet. I have gathered few details out of some scrutiny at my end:
To See the Complete Meta Data: http://>/PWA/_api/ProjectData/$metadata - You can get the field details, Where as I need to know in specific the Entity for TimeSheet. To See the Complete Time Sheet Period Available: http://>/PWA/_api/ProjectServer/TimeSheetPeriods - You can see all the available TimeSheet Periods.
I know TimeSheet stays as separate entity and doesn't belong to usual Project Entities.
My Query here to know in specific the Entity that is dealt for timesheet add & update. Please help me with endpoints including the save, publish and checkout!
Upvotes: 1
Views: 2223
Reputation: 21
In case you don't have a TimeSheet because the call returns a null object, you have to create it. Just POST a /TimeSheetPeriods('periodid')/createTimeSheet()
Upvotes: 0
Reputation: 63
Incase anyone is still struggling with this as I was.... here's what worked for me. To replace the actual work for a given day in a task - to enter your time:
Uri:
http://<sitecollection>/<site>/_api/ProjectServer/TimeSheetPeriods('periodid')/TimeSheet/Lines('lineid')/Work('yyyy-MM-dd')
Method: PATCH
Headers:
Accept - application/json;odata=verbose
Content-type - application/json;odata=verbose
Odata-version - 3.0
If-Match: *
Body:
{
"__metadata": {
"type": "PS.TimeSheetWork"
},
"ActualWork": "10"
}
I entered in my times as 10 hrs.
Upvotes: 3
Reputation: 150
How are you adding the tasks? Http requests? Did you develop some app?
I tried a few ways to add actuals to timesheets already created using REST endpoints, via Postman, without success. It always responds with this error: "The security validation for this page is invalid.", I think I'm missing some headers.
This endpoints were as close as i got:
Submit Timesheet
POST - http://>/pwa/_api/ProjectServer/TimeSheetPeriods('periodid')/TimeSheet/submit(comment)Update Timesheet
POST - http://>/pwa/_api/ProjectServer/TimeSheetPeriods('periodid')/TimeSheet/update()
I saw this endpoints here.
Hope this helps!
Upvotes: 1