Forum Discussion
Project Online to retrieve baseline dates for tasks within projects.
- Feb 27, 2024
Hello AbleMPeter ,
If you want to navigate to a related data endpoint, you have to provide all keys - for example:
{pwaUrl}/_api/ProjectData/TaskBaselines(BaselineNumber=0,ProjectId=guid'9c5ee037-4c4e-ee11-b221-00155dd8b40c',TaskId=guid'a85ee037-4c4e-ee11-b221-00155dd8b40c')/Task
That would return the Task details for that 1 task though, not the task baseline details.
You can either get all task baseline details by going to:
{pwaUrl}/_api/ProjectData/TaskBaselines
Or grab a specific task's baseline details by going to - update the GUIDs:
{pwaUrl}/_api/ProjectData/TaskBaselines(BaselineNumber=0,ProjectId=guid'9c5ee037-4c4e-ee11-b221-00155dd8b40c',TaskId=guid'a85ee037-4c4e-ee11-b221-00155dd8b40c')
Paul
Can you help me to achieve this tasks?
Hello AbleMPeter ,
If you want to navigate to a related data endpoint, you have to provide all keys - for example:
{pwaUrl}/_api/ProjectData/TaskBaselines(BaselineNumber=0,ProjectId=guid'9c5ee037-4c4e-ee11-b221-00155dd8b40c',TaskId=guid'a85ee037-4c4e-ee11-b221-00155dd8b40c')/Task
That would return the Task details for that 1 task though, not the task baseline details.
You can either get all task baseline details by going to:
{pwaUrl}/_api/ProjectData/TaskBaselines
Or grab a specific task's baseline details by going to - update the GUIDs:
{pwaUrl}/_api/ProjectData/TaskBaselines(BaselineNumber=0,ProjectId=guid'9c5ee037-4c4e-ee11-b221-00155dd8b40c',TaskId=guid'a85ee037-4c4e-ee11-b221-00155dd8b40c')
Paul
- Paul_MatherMar 01, 2024MVP
Hello AbleMPeter ,
There isn't unfortunately but what about going to the root /TaskBaselines endpoint then using the Odata $filter query option - such as /TaskBaselines()?$filter=ProjectName eq 'projectName'
Paul
- AbleMPeterMar 01, 2024Copper Contributor
Paul_Mather ,Thanks for the reply and for providing the additional information.
I've experimented with the API endpoint {pwaUrl}/_api/ProjectData/TaskBaselines, and while it does provide all the project baselines, it seems to paginate the results, returning only 300 tasks at a time. This pagination could make fetching all the project baselines a time-consuming process. Additionally, I've explored the API endpoint {pwaUrl}/_api/ProjectData/TaskBaselines(BaselineNumber=0,ProjectId=guid'9c5ee037-4c4e-ee11-b221-00155dd8b40c',TaskId=guid'a85ee037-4c4e-ee11-b221-00155dd8b40c'), which offers baseline details for a specific task in the project. However, considering the potential volume of tasks in a project, invoking this API for each task individually might not be the most efficient approach.
Is it possible to retrieve baselines for a specific project by using an endpoint similar to /_api/ProjectData/Projects(guid'{ProjectId}')/Tasks In other words, I'm wondering if there's an API endpoint that allows us to fetch baselines based on the ProjectId, akin to how we can retrieve tasks for a particular project using the mentioned endpoint.