Articles on: Developers

How to use the ScrapIn API?

To use the ScrapIn API effectively, it's essential to familiarize yourself with its REST architecture and JSON-based communication. The API provides various endpoints for tasks like extracting person or company data social profiles, reverse domain lookup, person search..

Each request and response is formatted in JSON, and standard HTTP response codes are used to indicate the success or failure of requests.

For a comprehensive guide and step-by-step instructions on using the ScrapIn API, visit the official documentation.. Detailed documentation, including how to authenticate and handle errors, is available to guide you through integrating the API into your software.

Here some code snippets that show you how to use the ScrapIn API:

Nodejs - Axios



const axios = require('axios');

const APIKEY = '<YOUR_API_KEY>'
let email = 'ilies@visum.run'

let config = {
  method: 'get',
  url: 'https://api.scrapin.io/enrichment?apikey=' + APIKEY '&mail=' + email,
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});


Nodejs - Request



var request = require('request');

const APIKEY = '<YOUR_API_KEY>'
var email = 'ilies@visum.run'

var options = {
  'method': 'GET',
  'url': 'https://api.scrapin.io/enrichment?apikey=' + APIKEY '&mail=' + email,
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});


Python - Requests



import requests

APIKEY = '<YOUR_API_KEY>'
email = 'ilies@visum.run'

url = "https://api.scrapin.io/enrichment?apikey=" + APIKEY + "&mail=" + email

response = requests.request("GET", url)

print(response.text)


Ruby - Net::HTTP



require "uri"
require "net/http"

APIKEY = '<YOUR_API_KEY>'
email = 'ilies@visum.run'

url = URI("https://api.scrapin.io/enrichment?apikey=" + APIKEY + "&mail=" + email)

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)

response = https.request(request)
puts response.read_body


Rust - reqwest



#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;

const APIKEY: &str = "<YOUR_API_KEY>";
    let email = "ilies@visum.run";

let url = format!("https://api.scrapin.io/enrichment?apikey={}&mail={}", APIKEY, email);
    let request = client.request(reqwest::Method::GET, &url);

let response = request.send().await?;
    let body = response.text().await?;

println!("{}", body);

Ok(())
}
In this code, the api_key and email variables are defined, and the URL string is created using the format! macro to concatenate the variables with the URL. The api_key and email are inserted into the URL using {} as placeholders.


Java - OkHttp



import okhttp3.*;

public class Main {
    public static void main(String[] args) {
        OkHttpClient client = new OkHttpClient().newBuilder()
                .build();
        MediaType mediaType = MediaType.parse("text/plain");
        RequestBody body = RequestBody.create(mediaType, "");

final String API_KEY = "<YOUR_API_KEY>";
        final String email = "ilies@visum.run";

String url = "https://api.scrapin.io/enrichment?apikey=" + API_KEY + "&mail=" + email;

Request request = new Request.Builder()
                .url(url)
                .method("GET", body)
                .build();

try {
            Response response = client.newCall(request).execute();
            // Process the response here
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}


Java - Unirest



import kong.unirest.HttpResponse;
import kong.unirest.Unirest;

public class Main {
    public static void main(String[] args) {
        Unirest.setTimeouts(0, 0);

final String API_KEY = "<YOUR_API_KEY>";
        final String email = "ilies@visum.run";

String url = "https://api.scrapin.io/enrichment?apikey=" + API_KEY + "&mail=" + email;

HttpResponse<String> response = Unirest.get(url)
                .asString();

System.out.println(response.getBody());
    }
}

Updated on: 06/10/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!