Jump to content

Syntax for updateAsset2 generalProperties


Recommended Posts

What is the "generalProperties" parameter expecting for updateAsset2?

As a test I am providing it '{"h_description":"Test", "h_room":"Test"}', but this does not appear to make the expected amendments to the Description and Room fields. Despite this it's not returning any errors either, so it is not clear to me what is wrong with this format, or what additional information I might need to provide in the JSON string.

It would be very useful to have examples on the API documentation for the API calls where you might be passing multiple properties through one API parameter.

While I am here, I might as well clarify that I started looking into the updateAsset2 API call with the intention of trying to change the Type of an asset. My colleague who manages the Asset Management section has created a new type under the "Computer System" class, and wants to change the type of some existing assets to this new type. Is this possible considering they are still the same class?

Link to comment
Share on other sites

Hi @Steve Giller is there any additional information you need to provide the "additionalProperties" parameter? I'm trying to update the Network IP and MAC Address fields as well but they are not updating when providing the following JSON string:

[{"name":"Network IP Address","value":"ExampleIP"},{"name":"MAC Address","value":"ExampleMAC"}]

Just to confirm I have also set the "assetClass" parameter to "computer", which I assume is required so it knows which related table to try populate.

Link to comment
Share on other sites

Can someone please tell me how to update the "MAC Address" and "Network IP Address" using the additionalProperties parameter on updateAsset2? Is it just not configured correctly to update fields with spaces in their display names?

I've since additionally tried no spaces, as well as replacing spaces with "--", "-" and "_". I've also tried adding the "Watts" field (because it is a field name with no spaces) to the JSON string and found it successfully updated that field while still not updating the others. So I feel that rules out there being an issue with the JSON string I'm providing, or the other parameters I am not filling in.

Alternatively I have found that I can successfully update these fields using the data/entityUpdateRecord API, but I read elsewhere that it may be ill-advised to use this due to other related tables not being updated as part of this operation. However, my query about exactly what I need to be weary of breaking when using this has not been answered either. I've noticed it doesn't populate the history page on the asset in asset manager, but I am making sure to update the "last updated" and "last updated by" fields as part of the API call.

Link to comment
Share on other sites

  • 5 months later...

I've been asked to mass update some asset information in our CMDB and following the information about the future of Hornbill APIs in this thread, I'm again looking to use the "correct" API updateAsset2 rather than entityUpdateRecord. However the former is still proving to be unreliable for updating asset information (having received no response above, I carried on using entityUpdateRecord to update "MAC Address" and "Network IP Address" fields I was having trouble with previously).

Despite updateAsset2 now being on the list of "customer-facing APIs" I'm still finding the same issue I highlighted above (i.e. the JSON syntax appears to only accept the display name of the field rather than the database name, but if the display name has a space in it, it doesn't seem to process it).

The fields I'm looking to update this time are Additional properties "OS Description", "OS Version" and "Network Windows Domain". To test my hypothesis about the spaces in the display names, I added an entry for "Model" in the middle of the JSON string and it successfully updated the Model field but not the others. Even if I'm wrong about the spaces, this should at least rule out there being any issue with the JSON string, API key permissions etc.

Please can someone confirm whether there is an issue with updateAsset2 updating certain fields, or highlight if there is anything I'm doing incorrectly. I have added an example JSON string I'm providing the AdditionalProperties parameter below:

[
    {
        "name":  "OS Description",
        "value":  "OS Description Example"
    },
    {
        "name":  "OS Version",
        "value":  "OS Version Example"
    },
    {
        "name":  "Network Windows Domain",
        "value":  "Network Windows Domain Example"
    }
]

On a side note, will there be some kind of "Get Asset" API added to the public facing APIs? I've been given a list of assets to update by asset name, so I need a way to retrieve the Asset ID to be able to feed it to UpdateAsset2. For now I will continue to use getAssetsFiltered for this, but I see it is not on the list.

Link to comment
Share on other sites

Thank you for the suggestion Steve, but this doesn't address the larger issue in that I'm trying to bring it to Hornbill's attention that this API (which is one of the officially supported, public facing APIs) seemingly isn't working 100% correctly.

I'd be happy to know if I'm just entering something wrong rather than it being a bug with the API, but either way please can this be confirmed? I appreciate if you're the person to be able to answer this, but if so I'd very much appreciate this being passed on to an appropriate colleague.

I see the Import Tool is seemingly still using data:entityUpdateRecord. I'm curious to know what will happen with these tools if access to these APIs is removed? Will the required APIs be configured somehow to only be accessible with the tools and not for general use by Hornbill customers?

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...