Jump to content

LifeOfJonny

Hornbill Users
  • Content Count

    50
  • Joined

  • Last visited

  • Days Won

    1

LifeOfJonny last won the day on June 10

LifeOfJonny had the most liked content!

Community Reputation

3 Neutral

About LifeOfJonny

  • Rank
    Advanced Member

Profile Information

  • Location
    Hornbill Service Manager

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Gotten it working but how do I update owned_by its not on your list? or do I need to call different method to change that? Jonny
  2. I was thinking of building an array of hornbillAttribName and new value of any that had changed you see. So what your saying is I need to hardcode the field mappings between generalProperties or additionalProperties to update the array of values?
  3. I'm trying to write code to use updatemethod2, but its bit tricky when I want to pass a value to be updated to a updateAsset function and the field doesn't know if its a generalProperties or additionalProperties. I basically retrieve my using getAssetsFiltered, to get the exact asset I'm after, which returns the data as a json array. but it does not report where the values belongs (generalProperties or additionalProperties) How would you recommend going forward? Do I do one update per field changed field, this way I can control where there value goes in to generalProperties or additionalProperties. Ideally I want to create an array of values that have changed, and then throw that in to the function and it to then update the asset. Don't really want to be doing 3/4 calls to change 3/4 fields.
  4. Thanks for confirming, as the API says its optional, but as you say its actually required
  5. So when I do the updatemethod2 I need to provide its assetClass?
  6. Ah that makes sense. I'll update my code to use that then. What does the assetClass Atrribute do? it says "being created" yet its already created, cause I'm updating it.
  7. Ah, so the JSON properties need to be the database field names. Any reason to use updatemethod2 over updateAssetComputer?
  8. On updateAsset2, how do I tell the difference between a general or additional. Guessing additional is computer/mobile type field?
  9. Afternoon, I'm currently writing a powershell script to sync data from our asset database (Custom MSSQL DB) in to Hornbill. I can create the devices fine but I get the following error trying to update, even if you updating it with the same data. Its talking about acqMethod but not sure where its getting that for or what field where its not getting a integer, as I compared it to the API xmlmc and any field types that are integer are integers in the object. The version number does get incremented when trying to update. As I get the device from the API up the number and set it in the object. Error and code below FlowCode Exception (com.hornbill.servicemanager/entities/AssetsComputer/fc_ops/updateAssetComputer): nodeName: Invoke Flowcode: Update Asset; nodeId: b3817dd0-4812-4a98-9815-8b04e08bffd2; At 162/1: "Uncaught EspMethodCall::invoke: Operation[apps/com.hornbill.servicemanager/Asset::updateAsset] FlowCode Exception (com.hornbill.servicemanager/entities/Asset/fc_ops/updateAsset): Input parameter validation error: Non-digit characters found in the element <acqMethod>, the expected data type is 'integer'. The value was [undefined] at location '/methodCall/params/acqMethod'" throw(e); Data object for updating serialNumber : 0123123123 type : 18 version : 2 os : Windows osVersion : 10.0.18363.900 ownerName : LifeOfJonny ownerId : LifeOfJonny@LifeOfJonny.uk name : WCC-XqaVwFt0Keh - 0123123123 model : Surface Pro 6 manufacturer : Microsoft Corporation assetId : 8 Create code Function CreateComputer { param ([Parameter(Mandatory=$true)]$deviceObject) $deviceCreated = $false # Build XMLMC API call # params have to be in the expected order. Clear-Params Add-Param "name" $deviceObject.name if ($deviceObject.ownerId -ne "") { Add-Param "ownedById" $deviceObject.ownerId Add-Param "ownedByName" $deviceObject.ownerName Add-Param "ownedByType" "0" } Add-Param "type" $deviceObject.type Add-Param "version" $deviceObject.version Add-Param "manufacturer" $deviceObject.manufacturer Add-Param "model" $deviceObject.model Add-Param "osType" $deviceObject.os Add-Param "osVersion" $deviceObject.osVersion Add-Param "serialNumber" $deviceObject.serialNumber # Invoke XMLMC call, output returned as PSObject $xmlmcOutput = Invoke-XMLMC "apps/com.hornbill.servicemanager/AssetsComputer" "addAssetComputer" # Read output status if($xmlmcOutput.status -eq "ok") { # Data return is correct $deviceCreated = $true } else { # API call status not OK - return status and error to console "API Call Status : " + $xmlmcOutput.status "Error Returned : " + $xmlmcOutput.error } return $deviceCreated } Update Code Function UpdateComputer { param ([Parameter(Mandatory=$true)]$deviceObject) $deviceUpdated = $false $deviceObject # Build XMLMC API call # params have to be in the expected order. Clear-Params Add-Param "assetId" $deviceObject.assetId Add-Param "name" $deviceObject.name if ($deviceObject.ownerId -ne "") { Add-Param "ownedById" $deviceObject.ownerId Add-Param "ownedByName" $deviceObject.ownerName Add-Param "ownedByType" "0" } Add-Param "type" $deviceObject.type Add-Param "version" $deviceObject.version Add-Param "manufacturer" $deviceObject.manufacturer Add-Param "model" $deviceObject.model Add-Param "osType" $deviceObject.os Add-Param "osVersion" $deviceObject.osVersion Add-Param "serialNumber" $deviceObject.serialNumber # Invoke XMLMC call, output returned as PSObject $xmlmcOutput = Invoke-XMLMC "apps/com.hornbill.servicemanager/AssetsComputer" "updateAssetComputer" # Read output status if($xmlmcOutput.status -eq "ok") { # Data return is correct $deviceUpdated = $true } else { # API call status not OK - return status and error to console "API Call Status : " + $xmlmcOutput.status "Error Returned : " + $xmlmcOutput.error } return $deviceUpdated } Many Help would be most appreciated.
  10. Afternoon, I was using the database direct. I can't save or load Saved Queries (Manage Query's). Looking at the networking tab of Chrome I can see the web requests are getting 404. I have taken a screenshot the two requested URLs and the status code. Trying to save a simple select query Trying to open the list of queries Many Thanks Jonny
  11. Yes I can see it now, thank you :-)
×
×
  • Create New...