Trustip
HomeFeaturesAboutPricing
  • Get Started
  • Code Examples
    • PHP
    • Laravel
    • Node js
    • JavaScript
  • API Rate Limits
Powered by GitBook
On this page

Was this helpful?

  1. Code Examples

JavaScript

You can call this API using JavaScript's fetch() function. Here's an example:


const apiKey = 'YOUR_API_KEY';
const ipAddress = 'IP_ADDRESS';

fetch(`https://api.trustip.io/v1/check.php?key=${apiKey}&ip=${ipAddress}`)
  .then(response => response.text())
  .then(data => console.log(data))
  .catch(error => console.error(error));

Replace YOUR_API_KEY and IP_ADDRESS with your actual API key and IP address, respectively. This code sends a GET request to the API endpoint and logs the response data to the console. If an error occurs, it will be logged to the console as well. Note that if you're using this code in a browser, you may need to configure CORS (Cross-Origin Resource Sharing) headers on the server to allow the request to go through.

PreviousNode jsNextAPI Rate Limits

Last updated 1 year ago

Was this helpful?