MAC address vendor lookup

MAC address vendor lookup

Development

Retrieve vendor details and other information regarding a given MAC address or an OUI

Visit API

πŸ“š Documentation & Examples

Everything you need to integrate with MAC address vendor lookup

πŸš€ Quick Start Examples

MAC address vendor lookup Javascript Examplejavascript
// MAC address vendor lookup API Example
const response = await fetch('https://macaddress.io', {
    method: 'GET',
    headers: {
        'Content-Type': 'application/json'
    }
});

const data = await response.json();
console.log(data);

How to use macaddress.io API with JavaScript

Macaddress.io provides a public API to lookup MAC addresses and retrieve information about devices. In this blog post, we will explore how to use the API with JavaScript.

Getting started

Before you can use the macaddress.io API, you need to obtain an API key. You can sign up for a free account on their website and obtain the API key by following the instructions provided.

Once you have the API key, you can use it to make requests to the API using JavaScript.

Example code

Here are some example code snippets that demonstrate how to use the macaddress.io API with JavaScript.

Lookup vendor information for a MAC address

const api_key = 'your-api-key'
const mac_address = '00:0a:95:9d:68:16'

fetch(`https://api.macaddress.io/v1?apiKey=${api_key}&output=json&search=${mac_address}`)
   .then(response => response.json())
   .then(data => {
       console.log(data.vendorDetails.companyName)
   })

In this code snippet, we use the fetch API to make a request to the macaddress.io API endpoint. We pass in our API key and the MAC address we want to lookup vendor information for.

The response from the API is returned as JSON data. We parse the JSON data and log the vendor company name to the console.

Lookup MAC address vendor information using Promise

const api_key = 'your-api-key'
const mac_address = '00:0a:95:9d:68:16'

function getVendorDetails(mac_address) {
   return new Promise((resolve, reject) => {
       fetch(`https://api.macaddress.io/v1?apiKey=${api_key}&output=json&search=${mac_address}`)
           .then(response => response.json())
           .then(data => {
               resolve(data.vendorDetails)
           })
           .catch(error => {
               reject(error)
           })
   })
}

getVendorDetails(mac_address)
   .then(vendorDetails => {
       console.log(vendorDetails.companyName)
   })
   .catch(error => {
       console.error(error)
   })

This code snippet demonstrates how to use the macaddress.io API with JavaScript async/await by wrapping the API call within a promise.

We define a function called getVendorDetails that takes a MAC address as an argument. Inside the function, we make a request to the macaddress.io API endpoint using the fetch API. We then parse the JSON data and resolve the vendor details.

We call the getVendorDetails function with the MAC address to lookup and use the then method to log the company name to the console.

Conclusion

Using the macaddress.io API with JavaScript is straightforward. You simply need to obtain an API key, make a request to the API endpoint with the key, and parse the JSON data returned by the endpoint.

We hope this blog post has been helpful in getting you started with the macaddress.io API using JavaScript. For more information on the API, you can refer to their official documentation.

πŸ“Š 30-Day Uptime History

Daily uptime tracking showing online vs offline minutes

Jun 2Jun 4Jun 6Jun 8Jun 10Jun 12Jun 14Jun 16Jun 18Jun 20Jun 22Jun 24Jun 26Jun 28Jul 104008001440Minutes
Online
Offline

Related APIs in Development