A new Flexera Community experience is coming on November 25th. Click here for more information.
Hi Forum,
We are testing to pull a custom report get dumped in a specific path at regular intervals. Its working fine with the existing fnms api and when we try calling it from Flexera One API platform we are getting the below error.
Following the thread in https://docs.flexera.com/flexera/EN/FlexeraAPI/GenerateAccessToken.htm#gettingstarted_2697534192_1116484
Using the command to generate Access token getting the error as below.
PS E:\PRODDump> curl -s -i -X POST https://login.flexera.com/oidc/token -d "grant_type=refresh_token&refresh_token=vxyvalue"
Invoke-WebRequest : Missing an argument for parameter 'SessionVariable'. Specify a parameter of type 'System.String' and try again.
At line:1 char:6
+ curl -s -i -X POST https://login.flexera.com/oidc/token -d "grant_typ ...
+ ~~
+ CategoryInfo : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException
+ FullyQualifiedErrorId : MissingArgument,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
Please suggest.
Regards,
Jun 16, 2021 08:49 AM
Hi ,
found where this is going wrong and instead of simply mention 'curl' i have used "curl.exe" and issue got resolved.
will try the next step for getting the custom report dump.
regards,
Jun 16, 2021 10:30 AM
The "cURL" tool referred to on the Generating an Access Token from Refresh Token page is the following tool: https://curl.se/
The output you've shown here suggests you are using the Windows PowerShell "curl" alias, which is an alias for the PowerShell Invoke-WebRequest cmdlet. That is quite different from the cURL tool: it serves a similar purpose (i.e. making HTTP requests), but takes a different set of parameters. If you want to use the PowerShell curl command (aka Invoke-WebRequest) instead of the cURL tool then you would need to work out a different set of parameters.
Jun 16, 2021 08:26 PM
Hi @ChrisG ,
thank you for the swift response. i've even tried Invoke-WebRequest and couldn't succeed as i'm not sure what parameters have to be set. But now i was able to generate the access token and see that the validity of the access token expires in 3600 seconds is this the default life time? Please help with the further guidelines using the access token as we are trying to get a custom report we have in our reports using the flexera one API.
Using the below code as suggested in https://docs.flexera.com/FlexeraOneAPI/ITAMDataAPI/#api-Files-filesShow we are trying to get the custom report but unsuccessful.
curl -X GET\ -H "Authorization: Bearer [[abc123]]"\ -H "Accept: application/json,application/vnd.goa.error"\ "https://api.flexera.com/fnms/v1/orgs/{123}/files/{custom report name(with spaces)}"
but getting error:
Could not resolve host: \
<html>
<head><title>400 Bad Request</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
</body>
</html>
Please suggest.
Regards,
Jun 18, 2021 03:59 AM - edited Jun 18, 2021 04:09 AM
@winvarma - I expect the "Could not resolve host: \" error you are getting will be because of the stray "\" characters you have in your command.
In short, I don't think you should have these characters in there:
If you are entering this command on a single line, I expect you will want to use something like the following:
curl -X GET -H "Authorization: Bearer [[abc123]]" -H "Accept: application/json,application/vnd.goa.error" "https://api.flexera.com/fnms/v1/orgs/{123}/files/{custom report name(with spaces)}"
The quoting shown here should work in most common shells.
Jun 21, 2021 05:04 AM
@ChrisG Can this API be used to retrieve any custom report, similar to the existing SOAP API? Based on the docs, and my own experience, the files endpoint only works to retrieve the files generated by the inventoriesIndex API. However, I see you're including a custom report name. I tried this (both with and without spaces) but I keep getting a "filename not found" error (my report is called "VM Report"). Here's my PowerShell:
Invoke-WebRequest -Headers $Header -Uri "https://api.flexera.com/fnms/v1/orgs/<myOrg>/files/VM%20Report"
Jun 21, 2021 02:31 PM
@ticalotta - as far as I know there is not an API available on https://api.flexera.com/ to retrieve Flexera One ITAM custom report data. Take a look at the following site for information about Flexera One ITAM APIs that are currently available: IT Asset Management Data API.
There are various ideas logged in Flexera Ideas about APIs that could be added, but I don't think there is one there yet covering adding a supported API to retrieve custom report data. If that would be useful for you, do consider creating an Idea for people to vote on.
Jun 21, 2021 11:29 PM
Hi @ticalotta @ChrisG ,
As suggested , i Have created an Idea https://flexerasfdc.ideas.aha.io/ideas/FXONE-I-135 for getting custom reports from Flexera One using API where its not currently supported.
Please provide your vote.
Regards,
Jun 22, 2021 02:27 AM