- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 12-18-2021 07:51 PM
< Next Post Previous Post >
ServiceNow Integration with MAC vendor - How to Get Mac vendor for the given MAC Address
What is a MAC vendor ?
MAC Vendor provides facility to identify the mac vendor based on mac address given.
Lets see how we can use MAC vendor in ServiceNow for asset management data.
I Came around one of the requirement on community to integrate MAC vendor with ServiceNow to populate certain fields in ServiceNow Asset management module. So, though of creating a article and found it so simple to do. Lets dive in to the steps with no due.
Step1 : Navigate to > macvendors
Register your self if needed or to use secure connection with Oauth. or you can even use no authentication as its open API.
Step 2 : Create a REST message as below.
> End point : https://api.macvendors.com/
> Auth Type : NO auth / use Oauth and set up the profile.
Step 3 : Create REST Method.
> Set the end point as > https://api.macvendors.com/ and add the variable with End point which will act as a substitution for MAC address. (dynamically)
> Set the method as GET.
> Auth Type : Inherit from parent
Step 4: Once all set, save the record.
From related links click on generate variable, this will generate all the variable which ever are specified in format > &{example_variable}.
in this case we have set the variable as 'mac'.
> Pass a test value which will be a mac address as shown in the below image. In the other words pass the mac address for which you need the vendor.
> In the above example i have passed > FC-A1-3E-2A-1C-33
Step 5: Result
Lets see wat do i get when i click on 'test'..
Tadddaaaaa.. Its >> Samsung Electronics Co.,Ltd
Step 6 : So how do I use this data in ServiceNow...
In the above example you can see how the end point and the mac variable that we passed got passed in the API to get us a response from Mac vendor API.
To use the received result in ServiceNow we make use of 'Preview Script Usage' this will provide the different type of script snippets that we can used any were in ServiceNow eg, business rules, workflows, UI action etc...
Step 7: To use the given script you need to make script alteration to pass the dynamic values based on table were ever your using it.
Find the Sample altered script which I will be using in the asset management table business rule after update of mac address.
try {
var r = new sn_ws.RESTMessageV2('Mac Vendor', 'GET Mac Vendor');
r.setStringParameterNoEscape('mac', current.mac_address); // YOUR MAC ADDRESS FIELD
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
var mac = responseBody.toString();
current.mac_vendor = mac; // YOUR MAC VENDOR FIELD
current.update();
}
catch(ex) {
var message = ex.message;
}
YOU CAN THANK ME BY HITTING THE HELPFUL 👍 BUTTON BELOW
Thanks,
MF Sohail Khilji.
LinkedIn > https://www.linkedin.com/in/mf-sohail-khilji/
<<<<<<<<<<<<<<<<<<<<<<< More Articles >>>>>>>>>>>>>>>>>>>>>>
- ServiceNow Integration with Splunk
- LDAP Integration with ServiceNow
- ServiceNow Integration with Veeam.
- Handling ServiceNow flow errors with a flow
- Show parent child incident relationships - display in field message
- ServiceNow SSO Logout Error (redirects to logout page) – Reason, Fixes and Cause.
- Multi Row Variable set ServiceNow MRVS - Creating - Scripting - Example - Limits
- How to find Log4j vulnerable severs in ServiceNow Using CMDB Query Builder (SecOps)
<<<<<<<<<<<<<<<<<<<<<<< More Articles >>>>>>>>>>>>>>>>>>>>>>
- 1,026 Views