Update Asset Hostname API

Hi all,
Struggling with this one…
We have some assets which dont have their hostname listed in InsightVM. This is to be expected and due to internal technical reasons.
I want to be able to update them by fetching data from one system and updating it on InsightVM, probably as part of a workflow every X hours. For now, im just trying to get basic. functionality working.

Couple of issues so far:

  • GETing an asset uses /api/3/assets/{id}
  • POSTing an asset uses /api/3/sites/{id}/assets with an id of the asset in the body of the request.
    • Nowhere in the GET or asset search does it list the SiteID associated with an Asset to be able to dynamically insert the SiteID.
  • When doing a test POST to update an asset with a known SiteID and AssetID, with the following example data:
    https://{fqdn}/api/3/sites/9/assets - POST
{
    "id": 2651,
    "date": "2024-03-04T00:31:57.082Z",
    "hostName": {
        "name": "testing",
        "source":"DNS"
    }
}

The API just CREATES a NEW asset, rather than updating the existing one.
The documentation states that the POST can be used for creating OR updating:
image

Does anyone know whether its possible to do what im trying to do here?

Thanks

1 Like

I’m attempting to do the same thing. So far no joy.