NPAT Posted July 15, 2024 Posted July 15, 2024 Hello, I am looking for the API endpoint that will allow me to retrieve all assets at a particular site via API. I have tried entityBrowseRecords2 but it says h_site is not allowed. I have also tried searching for h_site in h_cmdb_assets but it says h_cmdb_assets does not exist.
Steve Giller Posted July 16, 2024 Posted July 16, 2024 11 hours ago, NPAT said: I have also tried searching for h_site in h_cmdb_assets but it says h_cmdb_assets does not exist. Also, h_cmdb_assets definitely exists, and it has an h_site column (and h_site_id) so the question here is what do you mean by 'searching for' and where/how are you searching?
NPAT Posted July 16, 2024 Author Posted July 16, 2024 @Victor @Steve Giller I want to use an API and specify a site, then get back all the assets at that site. I have seen the entity Asset (h_cmdb_assets) contains site, but Site is not a searchable field on that Entity as far as I can see?
NPAT Posted July 16, 2024 Author Posted July 16, 2024 I've managed to do it by getting all assets via API and filtering the response my side. There must be a more efficient way?
NPAT Posted July 16, 2024 Author Posted July 16, 2024 1 minute ago, Victor said: ... again, what is the payload you use? @Victor { "@service": "data", "@method": "entityBrowseRecords2", "params": { "application": "com.hornbill.servicemanager", "entity": "Asset", "searchFilter": [ { "column": "h_site", "value": ["siteName"] } ] } }
Gareth Cantrell Posted July 16, 2024 Posted July 16, 2024 @NPAT I usually use data?method=entityGetBrowseMetaData before using method=entityBrowseRecords2. This will tell you which fields of the entity you can use in the searchFilter and which fields will be returned in the result. { "@service": "data", "@method": "entityGetBrowseMetaData", "params": { "application": "com.hornbill.servicemanager", "entity": "Asset" } } As an aside, neither h_site not h_site_id are defined as a searchable fields for the Asset entity.
NPAT Posted July 16, 2024 Author Posted July 16, 2024 Thanks @Gareth Cantrell So it's not possible to search for assets at a certain site at this moment?
Victor Posted July 16, 2024 Posted July 16, 2024 @NPAT these are the (current) searchable colums for the Asset entity: https://docs.hornbill.com/servicemanager-api-api/entities/asset/index
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