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">
<title>502 Proxy Error</title>
<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>.
Reason: <strong>Error reading from remote server</strong></p>
- 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.
@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.
I am trying to find same api for flexnet version 6.14.1 can you help in sharing api document for 6.14.1 version or getting report api please I did not find anything on net.
The REST API for v6 does not have the same capabilities as v7. To generate a report for v6, you can instead use scriptRunner with the Report Script Utility that I attached. I have also attached instructions on how to use the script. This will generate reports in the <Install Dir>\scriptRunner\bin\ directory.
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:
Overall, you will want to first generate the report with:
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:
@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) ?
@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.
@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:
@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.
Hi, I have a few follow up questions on the same installation of Flexera that we have right now.
Our current installation is : v2020 R2 (7.12.0 Build 96)
In the above ticket you specified that we can upgrade to: 2021 R1
But I also see that there is an installation : 2023.R2, which seems to be the latest.
Can you please provide recommendation on which version I should upgrade to.
I have the following requirements because of which I want to upgrade:
+ I would like the upgraded REST APIs since the older version APIs are not working as expected.
+ I would like SPDX support. I our current installation, SPDX support does not work. Is there a solution to this issue?
In addition to the above queries, one of our engineers evaluated 2021R3, and had the following observations. Are these issues fixed in the latest release?:
- Does not distinguish between SPDX GPL-2.0 and GPL-2.0-or-later.
- Similar to above, Flexera generally has issues detecting correct GPL license version. For example, detecting as “v2 or later” when it’s just v2, scenarios like that.
- Because version detection is not very accurate, user has to manually go through all files.
- I think there were false positives for Apple MIT License.
@rhiremath, for detection issues, the first thing to check is to make sure you have the latest Electronic Update applied. You can check the Last Data Update under the Menu button (hamburger icon). You can also view the release notes for each Electronic Update here:
If you are not on the latest update, you will need to update through the Administration page and then perform a full rescan. If you already have the latest update applied, we would need to investigate each discrepancy. I would recommend opening a support case for this and providing the associated files being scanned so that we can reproduce the issue on our end. Additionally, you can also provide us with the component ID so that we can check if the issue is in our data library.
We would recommend upgrading to the latest version, 2023 R2.
For SPDX support, we have a number of custom reports available for download, including an SPDX Report (refer to the README on how to install):
You can find more available reports here:
Thanks for your inputs and suggestions @tphamda . We are now looking to upgrade our Flexera Installations so that we can make use of the latest upgrades, APIs and fixes.
Can you please share the latest API documentation with me as well?
In addition to this, I would need assistance in few of the Flexera operations. For eg, If I want to make the all the files from an advanced search criteria to be a part of a new inventory using REST API, how can I do about doing this? Is there a team that assists with such use cases?
You can find our latest API docs here: https://codeinsightapi-2023r2.redoc.ly/
Regarding your request for assistance, custom implementation as well as training is handled by our Services team. Please note that a services engagement would incur a cost, but let us know if you would be interested in this.