LifeOfJonny Posted February 12 Share Posted February 12 Hi, I have created a PowerShell script, which gets data from our asset system and inserts/updates the Hornbill Asset system, using the Hornbill API. When it checks each asset to see if anything needs updating, one out of the 1000s will error with the below, but it's never the same asset each time it runs, it'll be random device with a different serial number. The lookup uses the devices serial number to find the asset in hornbill, then update accordingly. { "Status": "fail", "Params": "", "Error": "FlowCode Exception (com.hornbill.servicemanager/entities/Asset/fc_ops/getAssetsFiltered): Security Error: 1" } Is anyone able to elaborate what this error actually means? Jonny Link to comment Share on other sites More sharing options...
LifeOfJonny Posted February 20 Author Share Posted February 20 This is the function that calls the API, encase it's needed, but like I said it different assets serials that error, and some times when the script it ran, it doesn't error at all, but usually it errors once or twice a run. Function GetComputerBySerial { param ([Parameter(Mandatory=$true)]$serial) $assetDevice = $null # Build XMLMC API call # params have to be in the expected order. $filter = '[{"column_name":"h_serial_number","column_value":"'+$serial+'","operator":"Equals","isGeneralProperty":false}]' Clear-Params Add-Param "resultType" "data" Add-Param "assetClass" "computer" Add-Param "filters" $filter # Invoke XMLMC call, output returned as PSObject $xmlmcOutput = Invoke-XMLMC "apps/com.hornbill.servicemanager/Asset" "getAssetsFiltered" $jsonData = ConvertTo-Json -InputObject $xmlmcOutput # Read output status if($xmlmcOutput.status -eq "ok") { # Data return is corrects if ($null -ne $xmlmcOutput.params.data) { $assetDevice = (ConvertFrom-Json $xmlmcOutput.params.data)[0] } else { return $false } } else { # API call status not OK - return status and error to console WriteOut "API Call Status : $($xmlmcOutput.status)" WriteOut "Error Returned : $($xmlmcOutput.error)" WriteOut "Error as JSON : $($jsonData)" } return $assetDevice } Link to comment Share on other sites More sharing options...
Steve Giller Posted February 20 Share Posted February 20 As far as I'm aware "Security Error: 1" indicates that the system is unable to verify the session. Unfortunately this is always a generic message to avoid exposing security information. This could be as simple as a very brief connection drop preventing your session being authenticated for that transaction, so I think the best course of action would be to trap that error and re-present the data when the call returns a failure with this error (ensuring that this does not create a loop, of course.) Link to comment Share on other sites More sharing options...
LifeOfJonny Posted February 20 Author Share Posted February 20 2 hours ago, Steve Giller said: As far as I'm aware "Security Error: 1" indicates that the system is unable to verify the session. Unfortunately this is always a generic message to avoid exposing security information. This could be as simple as a very brief connection drop preventing your session being authenticated for that transaction, so I think the best course of action would be to trap that error and re-present the data when the call returns a failure with this error (ensuring that this does not create a loop, of course.) I shall script around the problem like you proposed. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now