none
Rest queries on ProjectOnline should use _API/ProjectData or _API/ProjectServer? RRS feed

  • Question

  • I've been trying to identify what is the correct way to get data from Project Online for some time now (I just want to get data, not update it). I can find documentation on ProjectData and a lot of examples using it. But it requires permission edition on the Project Online configuration.

    I Barely can find any example or documentation for the ProjectServer and its endpoints seem to have fewer options than ProjectData.

    Which one should be used to GET info from the ProjectOnline and why?

    Doc for ProjectData: https://docs.microsoft.com/en-us/previous-versions/office/project-odata/jj163015(v%3doffice.15)

    Thursday, January 17, 2019 3:37 PM

Answers

  • Hi,

    with _api/ProjectServer you will get data in security context and you don't need a specific license. These are two important advantages. Example: _api/ProjectServer/Projects()?$Select=Id,Name will give the user a list of all Project Names he or she has access to. Disadvantage: you can not get a list of all tasks. You need to get a specific ProjectId to get project's tasks like _api/ProjectServer/Projects('2076eb54-99ed-e811-81d4-4c72b96bea39')/Tasks. Another challenge are values of Enterprise Custom Fields, since no names are displayed, but internal Ids. Just try _api/ProjectServer/Projects('2076eb54-99ed-e811-81d4-4c72b96bea39')/IncludeCustomFields to see what I am writing about. A third challenge: For Enterprise Custom Fields with lookup tables you will only get the internal Id of the lookup table entries.

    With _api/ProjectData, there is no security model applied. If you allow "Global Permissions - General - Access Project Server Reporting Service", user will have access to all information across instance. Moreover, you will need Project Premium license for these users, as far as I know. But you will get all information in a readable way and can e.g. see all tasks or assignments without digging through projects.

    _api/ProjectData is just optimized for reporting, therefore the additional global permission.

    So to wrap up: What way you need to take depends on your requirements.

    Regards
    Barbara

    Thursday, January 17, 2019 4:20 PM
    Moderator
  • Following on from Barbara's great reply, it really depends what you are trying to do? Just read only view on the data - then the _api/ProjectData reporting API is the one to use, if you are programmatically working with the data then the _api/ProjectServer is the API to use.

    To confirm, users who are accessing the _api/ProjectData reporting API, they will need Project Online Professional or higher: https://docs.microsoft.com/en-us/office365/servicedescriptions/project-online-service-description/project-online-service-description#feature-availability-across-project-online-standalone-plans - see OData feeds under the Reporting and business intelligence section.

    Paul


    Paul Mather | Twitter | http://pwmather.wordpress.com | CPS | MVP | Downloads

    Thursday, January 17, 2019 6:14 PM
    Moderator
  • Hello,

    Thanks following my blog, I hope you find it useful!

    Correct, if the users know they have access to the OData Reporting API, they could query all the data in Excel / Power BI etc. for all projects / resources.

    Paul


    Paul Mather | Twitter | http://pwmather.wordpress.com | CPS | MVP | Downloads

    Friday, January 18, 2019 12:29 PM
    Moderator

All replies

  • Hi,

    with _api/ProjectServer you will get data in security context and you don't need a specific license. These are two important advantages. Example: _api/ProjectServer/Projects()?$Select=Id,Name will give the user a list of all Project Names he or she has access to. Disadvantage: you can not get a list of all tasks. You need to get a specific ProjectId to get project's tasks like _api/ProjectServer/Projects('2076eb54-99ed-e811-81d4-4c72b96bea39')/Tasks. Another challenge are values of Enterprise Custom Fields, since no names are displayed, but internal Ids. Just try _api/ProjectServer/Projects('2076eb54-99ed-e811-81d4-4c72b96bea39')/IncludeCustomFields to see what I am writing about. A third challenge: For Enterprise Custom Fields with lookup tables you will only get the internal Id of the lookup table entries.

    With _api/ProjectData, there is no security model applied. If you allow "Global Permissions - General - Access Project Server Reporting Service", user will have access to all information across instance. Moreover, you will need Project Premium license for these users, as far as I know. But you will get all information in a readable way and can e.g. see all tasks or assignments without digging through projects.

    _api/ProjectData is just optimized for reporting, therefore the additional global permission.

    So to wrap up: What way you need to take depends on your requirements.

    Regards
    Barbara

    Thursday, January 17, 2019 4:20 PM
    Moderator
  • Following on from Barbara's great reply, it really depends what you are trying to do? Just read only view on the data - then the _api/ProjectData reporting API is the one to use, if you are programmatically working with the data then the _api/ProjectServer is the API to use.

    To confirm, users who are accessing the _api/ProjectData reporting API, they will need Project Online Professional or higher: https://docs.microsoft.com/en-us/office365/servicedescriptions/project-online-service-description/project-online-service-description#feature-availability-across-project-online-standalone-plans - see OData feeds under the Reporting and business intelligence section.

    Paul


    Paul Mather | Twitter | http://pwmather.wordpress.com | CPS | MVP | Downloads

    Thursday, January 17, 2019 6:14 PM
    Moderator
  • Hi Barbara, thanks for the reply. It was very helpful already!

    I usually develop JS/HTML reports to be placed on Project Detail Pages, so most of my reports are filtered by a specific project (like: ProjectServer/Projects(guid\'' + projectId + '\')?$select=ProjectSiteUrl).

    Can I get information from TaskBaselineTimephasedDataSet and TaskTimephasedDataSet with ProjectServer?
    I found those endpoints only with ProjectData.

    /pwa/_api/ProjectData/[en-us]/TaskBaselineTimephasedDataSet

    /pwa/_api/ProjectData/[en-us]/TaskTimephasedDataSet

    Is there any documentation where I can find what data is available and what are the endpoints to get it with ProjectServer?

    Thanks Again!

    Friday, January 18, 2019 12:19 PM
  • Hi Paul!

    I'm a great fan of your blog. It has helped me many times while developing reports :)

    Thanks for the link, I usually just read data so it seems that I'll be using ProjectData.

    I have just one more question, what happens if I give the permission to read OData to my users and one of them found out that he can use that to read data? He will be able to read data from any project right? (even the ones he shouldn't.)

    Friday, January 18, 2019 12:26 PM
  • Hello,

    You can for assignment data but not for Task data as far as I know: https://msdn.microsoft.com/en-us/office/project/api/timephase

    Paul


    Paul Mather | Twitter | http://pwmather.wordpress.com | CPS | MVP | Downloads

    Friday, January 18, 2019 12:27 PM
    Moderator
  • Hello,

    Thanks following my blog, I hope you find it useful!

    Correct, if the users know they have access to the OData Reporting API, they could query all the data in Excel / Power BI etc. for all projects / resources.

    Paul


    Paul Mather | Twitter | http://pwmather.wordpress.com | CPS | MVP | Downloads

    Friday, January 18, 2019 12:29 PM
    Moderator
  • Hi,

    the missing permission model with OData (/ProjectData) is exactly the reason why I prefer /ProjectServer. Unfortunately, there is less data available. E.g. timephased data are missing completely.

    Regards
    Barbara

    Friday, January 18, 2019 1:31 PM
    Moderator