Skip to main content

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,

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:

https://api.freshservice.com/v2/#asset_attributes
https://api.freshservice.com/v2/#update_an_asset

Best regards
Daniel


Hi,

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 ;)

 

{
  "data": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n\n<head>\n    <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />\n    <title>The page you were looking for doesn't exist (404)</title>\n    <style type=\"text/css\">\n    body {\n        color: #333;\n        font-size: 12px;\n        font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", Arial, sans-serif;\n        background: #fafafa;\n        min-width: 90%;\n        -webkit-font-smoothing: antialiased;\n    }\n\n    h2 {\n        font-size: 24px;\n        font-weight: 600;\n        letter-spacing: 0.51px;\n        line-height: 35px;\n        text-align: center;\n        margin: 25px 0 0 0;\n    }\n\n    a#domainname {\n        font-size: 14px;\n        letter-spacing: 0.3px;\n        background-color: #24364A;\n        border-radius: 57px;\n        color: #fff;\n        text-decoration: none;\n        padding: 9px 21px;\n        display: inline-block;\n        margin-top: 10px;\n    }\n\n    a#domainname:hover {\n        background-color: #141c30;\n   


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.

 

kr


Hi everybody,

Below the response of Fresworks:

---------------------------------------------------------------------

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.

To know more, kindly refer to this API Document - https://api.freshservice.com/#authentication
 

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.

------------------------------------------------------------------------

Thanks for the help ;)


Reply