Skip to main content

How do I get the Description data from a ProjectRequest form via REST?

Comments

10 comments

  • Robert Aronovici

    Hello Daniel,

    Here are the snippets:

    HTTPS:

    GET /api/project-request/bedb9177b1874106ad9913738d13d290?modelproperties=name,description HTTP/1.1
    Host: {YOUR-PI-DOMAIN-URL}
    api-token: {YOUR-PI-API-KEY}
    Cache-Control: no-cache

    jQuery:
    var settings = {
    "async": true,
    "crossDomain": true,
    "url": "{YOUR-PI-DOMAIN-URL}/api/project-request/bedb9177b1874106ad9913738d13d290?modelproperties=name%2Cdescription",
    "method": "GET",
    "headers": {
    "api-token": "{YOUR-PI-API-KEY}",
    "cache-control": "no-cache"
    }
    }

    $.ajax(settings).done(function (response) {
    console.log(response);
    });

    Here is the reference: https://www.projectinsight.net/api-docs/help/get-project-request-id

    If you have any further questions, please let us know!

    Thank you,



    Robert

    0
  • Daniel Heller

    Robert,

    That works for one project request.  Is there a way to retrieve ALL project requests without having to generate a GET statement for each one?

    Thanks,

    Dan

    0
  • Daniel Heller

    Or, if I could return the Id numbers of all available Project Requests, then I could possibly loop through the Id's in the LOAD statement.

    Thanks,

    Dan

    0
  • Robert Aronovici

    Daniel,

    Make sure to use the API Reference guide to help you with the methods available.

    https://www.projectinsight.net/api-docs/help/overview

    You can use the project-request/list method, but you'll need to pass a string of Project Request Ids (GUID) in the query param. Currently, there is no search method to do a look up of Project Requests. You can also use the Project Search method project/search and then in your code you can filter out for Project Requests that have been created from Projects.

    If you have any further questions, please let me know.

    Thanks,

     

     

    Robert

    0
  • Daniel Heller

    If I use the ...projectinsight.net/api/project-request/list, it returns an error message  with "Connection failed" 404 Not Found.

    Using project/search doesn't return any of the "Project Request ID's".

    Any other suggestions?

    Thanks,

    Dan

    0
  • Robert Aronovici

    Daniel,

    You'll need to pass in the Id's as a list if you want to return the specific Project Requests. You can run a Project Request report within Project Insight to retrieve a list of Id's and test this method out (see screenshot).


    You can then make 'GET' call (see snippet) passing "ids" as a query param.
    HTTPS:
    GET /api/project-request/list?ids=bedb9177-b187-4106-ad99-13738d13d290,7c204ffb-5bb9-4529-9e53-277624c01a20,56f6ed19-97ca-493d-8503-28b852621d19 HTTP/1.1
    Host: {YOUR-PI-SUB-DOMAIN}
    api-token: {YOUR-API-TOKEN}
    Cache-Control: no-cache

    To return specific properties from the response object, you'll want to specify the modelProperties to be returned, which can be reviewed by click here.

    HTTPS:
    GET /api/project/search?modelproperties=projectrequest HTTP/1.1
    Host: {PI-SUB-DOMAIN}
    api-token: {YOUR-API-TOKEN}
    Cache-Control: no-cache

    If you have any further questions, please let us know!

    Thank you,

     

     

    Robert

    0
  • Daniel Heller

    I was able to return the Project Request Description as needed by looping through all the Project Request Ids in my connection string.  Now I would like to automate the process of retrieving the Project Request Ids.  Is there a way to auto-generate and export the Excel report to have this saved to a UNC path on my machine?  Or, is this ONLY a manual process?

    Thanks,

    Dan

    0
  • Wes Kliewer

    Yes, you can use Excel's built-in data retrieval method to retrieve the data directly into your spreadsheet. You'll find that Microsoft uses the exact same interface for both Power BI and Excel. Further information is in the article Get Project Insight Data Into Power BI Using REST.

    0
  • Daniel Heller

    Wes,

    Unfortunately, I receive the following error when I click the link you provided.

    "You're not authorized to access this page".  Do you have a direct link to this article?

    Thanks,

    Dan

    0
  • Wes Kliewer

    Sorry Dan and thank you for responding to this so that I could fix it. Please try the link again. I had updated the article and it was in the "Draft" mode. It is now publicly available.

    0

Please sign in to leave a comment.

Powered by Zendesk