- Revenera Community
- :
- Code Insight
- :
- Code Insight Forum
- :
- Unable to download project report using REST API
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Unable to download project report using REST API
I am seeing 502 error when I am trying to download the project report using REST API.
I tried to isolate the cases for which this might be happening, and narrowed to 2 particular requests, that are throwing the 502 error.
Response Error :
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head>
<title>502 Proxy Error</title>
</head>
<body>
<h1>Proxy Error</h1>
<p>The proxy server received an invalid
response from an upstream server.<br />
The proxy server could not handle the request
<em><a href="/codeinsight/api/project/generateReport">GET /codeinsight/api/project/generateReport</a></em>.
<p>
Reason: <strong>Error reading from remote server</strong></p>
</p>
</body>
</html>
Few Observations
- When I try to login into the portal and download the reports for the above mentioned projectId, they get downloaded successfully.
- These reports are slightly larger in size (4.69Mb). And there might be a timeout set on the Http GET request, which is preventing these reports from getting downloaded.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Hi @rhiremath,
The API you are using has been deprecated. Please refer to our latest API documentation for more details:
https://codeinsightapi-2023r1.redoc.ly/tag/Deprecated-APIs#operation/generateReport_1
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
@tphamda : Thanks for pointing me to the new documentation. I am looking at - https://codeinsightapi-2023r1.redoc.ly/tag/Project-API#operation/downloadReport
- I do know how to get the project_id. But what is report_id? How do I get that?
- I want to download the project_report for a certain project. How do I do this?
- Also, how do I get the taskId?
- Basically, if I want to achieve : https://flexeraipbunew.marvell.com/codeinsight/api/project/generateReport?projectId=1151&reportType=PROJECT , in the newer API version, how do I do it? Its not very clear from the documentation.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
The report IDs for the default reports are as follows:
- Project Report: 1
- Audit Report: 2
- Notices Report: 3
(Note: If you have a custom report added, the report ID will be mentioned when you register the report.) You can also use the Get Report By ID API to find out which ID is mapped to which report:
https://codeinsightapi-2023r1.redoc.ly/tag/Reports#operation/getReport
Overall, you will want to first generate the report with:
https://codeinsightapi-2023r1.redoc.ly/tag/Project-API#operation/generateReport
The success response of the generate call is the taskId which should be used during the download. You can then check the response's status code – if it is 200, then the task is complete, and you can proceed to downloading the report. To download the report, you can use the Download Report API:
https://codeinsightapi-2023r1.redoc.ly/tag/Project-API#operation/downloadReport
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
@tphamda : Thanks for the response. It is helpful.
The way, we have designed right now, we are generating the project report using the older API.
For download, we are designing a separate flow with the new API. So, I do not have have a direct access to the "taskId ", because I am not doing it as a part of the same codebase.
So, is there a way of doing one of the following:
- Can I find the taskId of a generated report of a certain project by some other means (API)?
- Can I download the report without the taskId, by mentioning something like reportType=PROJECT (Like the older API) ?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
@rhiremath, unfortunately, I am not aware of other API methods to get the taskId from the latest report generated. If it helps at all, all task IDs are available in the DB, specifically under the PSE_SCHEDULER_TASKS table.
However, we do have an existing request for downloading a report for a project using only the projectId and reportID, which will use the latest report generated. If you are interested in this feature, please open a new support case with us.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
@tphamda : Thanks for the response. Just wanted to verify if the new REST APIs will work for the Flexera Installation that we have presently. The vession is : v2020 R2 (7.12.0 Build 96)
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
@rhiremath, the new APIs were added in version 2021 R1, so you will need to upgrade to use them. You can find the relevant release notes here:
https://docs.revenera.com/fnci2021r1/rn/Content/helplibrary/New_APIs.htm
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Thanks @tphamda . So a follow up question on that. Would upgrading the installation to "2021 R1" break the previous version of APIs? Basically, would the previous APIs keep working once we upgrade?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
@rhiremath, the previous APIs may still function (they have not been changed other than marked as deprecated), but there were existing memory and performance issues with the previous APIs. In short, we will not be able to assist with any issues you run into with the previous APIs.
