Forum Discussion

AbleMPeter's avatar
AbleMPeter
Copper Contributor
Feb 21, 2025

MSP online: How to fetch all the TASK relationship?

How to fetch all the TASK relationship (Predecessor, lag, dependency type (SS,FS) using RestAPI? 

    • AbleMPeter's avatar
      AbleMPeter
      Copper Contributor

      We are currently using the MS Project Server API to retrieve tasks and their associated task links for a specific project. At the moment, I make individual API calls for each task and its predecessors, which leads to thousands of requests—for example, 3,000 tasks result in over 6,000 API calls. This approach causes significant performance issues.

      I am using these endpoints:

      • To fetch task predecessors:
        pwa/_api/ProjectServer/Projects('{ProjectId}')/Tasks('{taskId}')/Predecessors
      • To fetch task links:
        pwa/_api/ProjectServer/Projects('{ProjectId}')/TaskLinks('{taskLinkId}')/Start
      1. Is there an alternative method or endpoint that would allow me to retrieve all tasks and task links for a project in a single or significantly reduced number of requests?
      2. Also is there any proper documentation for this APIs?
      • RodFromm's avatar
        RodFromm
        Steel Contributor

        Is there a reason you have to call each task individually?  If not, refer to my post to get all TaskLinks in one call, or you could write a function to retrieve them one project at a time?  It's hard to provide an answer without knowing what your process/requirements.  Regarding documentation.....good luck MS Project Online is not supported and documentation is sparse at best.

Resources