Tutorial: How to Use an IP Location Finding API with JavaScript

To use an IP location finding API, you need to send a GET request to the API's endpoint. Here's how you can do it using JavaScript (Node.js):

                        
const fetch = require('node-fetch'); // node-fetch must be installed

const ip = 'IP_Address'; // Replace with the IP Address you want to lookup
const token = 'YOUR_API_KEY'; // Replace with your actual API key

fetch(`https://api.findip.net/${ip}/?token=${token}`)
    .then(response => response.json())
    .then(data => {
        console.log(`City Name: ${data.city.names.en}`);
        console.log(`Continent Code: ${data.continent.code}`);
        console.log(`Country Name: ${data.country.names.en}`);
        console.log(`Latitude: ${data.location.latitude}`);
        console.log(`Longitude: ${data.location.longitude}`);
        console.log(`Time Zone: ${data.location.time_zone}`);
        console.log(`Weather Code: ${data.location.weather_code}`);
        console.log(`Subdivisions: ${data.subdivisions.map(subdivision => subdivision.names.en)}`);
        console.log(`Autonomous System Number: ${data.traits.autonomous_system_number}`);
        console.log(`Autonomous System Organization: ${data.traits.autonomous_system_organization}`);
        console.log(`Connection Type: ${data.traits.connection_type}`);
        console.log(`ISP: ${data.traits.isp}`);
        console.log(`User Type: ${data.traits.user_type}`);
    })
    .catch(err => console.error(err));
                    

Remember to replace 'IP_Address' and 'YOUR_API_KEY' with the actual IP address you want to verify and your actual API key.