logo

NJP

ServiceNow Integration with MAC vendor - Get Mac vendor for the given MAC Address.

Import · Dec 19, 2021 · article

ServiceNow Integration with MAC vendor - How to Get Mac vendor for the given MAC Address

image

What is a MAC vendor ?

MAC Vendor provides facility to identify the mac vendor based on mac address given.

image

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.

image

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

image

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}.

image

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

image

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...

image

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 image BUTTON BELOW

Thanks,

MF Sohail Khilji.

LinkedIn >https://www.linkedin.com/in/mf-sohail-khilji/

<<<<<<<<<<<<<<<<<<<<<<< More Articles >>>>>>>>>>>>>>>>>>>>>>

<<<<<<<<<<<<<<<<<<<<<<< More Articles >>>>>>>>>>>>>>>>>>>>>>

View original source

https://www.servicenow.com/community/sam-articles/servicenow-integration-with-mac-vendor-get-mac-vendor-for-the/ta-p/2319457