Knowledge Base

Ask A Question



InsightVM API: How to get Site ID from Asset?

I am trying to get Site information for a known Asset using the API but am not finding a direct path to do so. The [getAsset]( endpoint response does not include Sites associated with the Asset from what I can see. [Asset Search]( does allow for a filter in the request body to include site-id, but that involves knowing the Site going in to the search. The response from this endpoint does not include the site-id even though you can use it to search. I really want to avoid getting all Sites and then iterating over those to get all Site Assets and working backwards from there. A few ideas came up as potential workarounds. One would be to use Tags on Assets where certain Tags are reserved for specific Sites. That is a less than ideal workaround since users could add Tags to their Assets on their own so could mistakenly add a Tag reserved for a Site they don't belong to. This article,, has a way to link Assets to Sites via SQL so it appears it can be done. Although not a good idea by any means and I don't even know if it would work, I thought about running this as a report and then grabbing the report results via the API to provide this relationship. Sites also show up in the UI when looking at an Asset, so obviously the relationship exists but I can't seem to get to it cleanly using the API.


Posted by Eric Urban 2 months ago