Change asset type field depending on the hostname using automation
Hi everybody,
Does anybody know how I can change the asset type depending on the hostname using automations, or any other way?
all our laptop hostnames begin with LT
all our desktop hostnames begin with PC
all our server hostnames begin with SRV
Any help would be greatly appreciated
Kind regards,
Page 1 / 1
Hi @Bregt,
you can check the hostname using an api request (+ parser node) as there is no native placeholder for hostname. Afterwards depending on the result you need to send a call using “UPDATE” to that asset. It could work, but I’m not entirely sure.
You should test and check the API documentation here:
You can do this by creating a scheduled workflow, or if there is a certain trigger when you want this to happen (for example when the asset is created) an event triggered workflow.
There is no set asset type action available as an action, so you have to do this using a PUT API call.
Your body would look like this:
{ "asset_type_id" :{{id-here}} }
Finally, your workflow should look like this:
If you need further assistance, let me know ;)
Hi @bram.veldhoen,
I am getting the following error, btw very noob here ;)
where can I find the asset id? i only know the name...
Always getting error 404
now getting status 403:
404 = Not found so something in your URL has to be wrong 403 = Access denied, so your API key doesn’t have the correct permission to use this api endpoint or on this module (assets)
You can extract the asste id by opening the asset and check the URL in the browser.
Hi @DanielRuff, What rights does this need to have? I tried about everything.
Kind Regards
My api key’s user has full access to everything.
Is it possible that this is the whitelisting? or do I need to use an other secret somewhere?
kr
Automating the change of asset type fields based on the hostname can optimize system management by ensuring correct asset classification. For LokLok APK users, this can help streamline app performance across different devices by dynamically adjusting settings, ensuring smoother operation and consistent user experiences across varying platforms. Learn more
Hi @Bregt, you must have write permissions in the asset management. That should be enough. If you cannot send out the API call please insert a screenshot of the payload, endpoint and error/result of the call.
Hi, we found the error. in Freshservice as well in Postman, using the api key gives an error, only basic auth seems to work. I will be making a request to Freshworks directly.
In Freshservice, for API calls related to our platform, we only support Basic Authentication. However, when making API requests to external systems via the Web Request node, other authorization options, including API Key, are provided to accommodate various external API standards.
If you are integrating with an external source that uses API Key authentication, you can select that option. Currently Freshservice API calls only support Basic Auth.
I trust that this response has addressed your inquiry. Should you have further questions, please do not hesitate to reach out; we will gladly assist you.