### Java Example Source: https://docs.signalhire.com/search-api/full-search-example This example demonstrates how to search for candidates using the SignalHire API and save them to a PostgreSQL database. ```java import java.net.http.*; import java.net.URI; import java.sql.*; import com.fasterxml.jackson.databind.ObjectMapper; import java.util.*; public class SignalHireSearch { private static final String API_KEY = "your_secret_api_key"; private static final String BASE_URL = "https://www.signalhire.com/api/v1/candidate"; private static final HttpClient client = HttpClient.newHttpClient(); private static final ObjectMapper mapper = new ObjectMapper(); static void saveBatch(Connection conn, List> profiles) throws Exception { String sql = """ INSERT INTO candidates (uid, full_name, location, open_to_work, raw_data) VALUES (?, ?, ?, ?, ?::jsonb) ON CONFLICT (uid) DO UPDATE SET full_name = EXCLUDED.full_name, location = EXCLUDED.location, open_to_work = EXCLUDED.open_to_work, raw_data = EXCLUDED.raw_data """; try (PreparedStatement stmt = conn.prepareStatement(sql)) { for (Map profile : profiles) { stmt.setString(1, (String) profile.get("uid")); stmt.setString(2, (String) profile.get("fullName")); stmt.setString(3, (String) profile.get("location")); stmt.setBoolean(4, Boolean.TRUE.equals(profile.get("openToWork"))); stmt.setString(5, mapper.writeValueAsString(profile)); stmt.addBatch(); } stmt.executeBatch(); } } static Map post(String path, Object body) throws Exception { String json = mapper.writeValueAsString(body); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(BASE_URL + path)) .header("apikey", API_KEY) .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(json)) .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); return mapper.readValue(response.body(), Map.class); } public static void searchAndSave(Map query) throws Exception { try (Connection conn = DriverManager.getConnection( "jdbc:postgresql://localhost/mydb", "user", "password")) { conn.setAutoCommit(false); int totalSaved = 0; // Initial search Map data = post("/searchByQuery", query); int requestId = (int) data.get("requestId"); int total = (int) data.get("total"); String scrollId = (String) data.get("scrollId"); System.out.println("Total profiles found: " + total); saveBatch(conn, (List) data.get("profiles")); conn.commit(); totalSaved += ((List) data.get("profiles")).size(); System.out.println("Saved " + totalSaved + " / " + total); // Scroll through remaining batches while (scrollId != null) { Map scrollData = post( "/scrollSearch/" + requestId, Map.of("scrollId", scrollId) ); List> profiles = (List) scrollData.get("profiles"); scrollId = (String) scrollData.get("scrollId"); saveBatch(conn, profiles); conn.commit(); totalSaved += profiles.size(); System.out.println("Saved " + totalSaved + " / " + total); } System.out.println("Done"); } } public static void main(String[] args) throws Exception { Map query = new HashMap<>(); query.put("currentTitle", "(Software AND Engineer) OR Developer"); query.put("location", "New York, New York, United States"); query.put("keywords", "PHP AND JavaScript"); query.put("size", 50); searchAndSave(query); } } ``` -------------------------------- ### Ruby Example Source: https://docs.signalhire.com/search-api/full-search-example This example demonstrates how to search for candidates using the SignalHire API and save them to a PostgreSQL database. ```ruby require 'net/http' require 'json' require 'pg' API_KEY = 'your_secret_api_key' BASE_URL = 'https://www.signalhire.com/api/v1/candidate' def api_post(path, body) uri = URI("#{BASE_URL}#{path}") http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri) request['apikey'] = API_KEY request['Content-Type'] = 'application/json' request.body = body.to_json JSON.parse(http.request(request).body) end def save_batch(conn, profiles) profiles.each do |profile| conn.exec_params( <<~SQL, INSERT INTO candidates (uid, full_name, location, open_to_work, raw_data) VALUES ($1, $2, $3, $4, $5) ON CONFLICT (uid) DO UPDATE SET full_name = EXCLUDED.full_name, location = EXCLUDED.location, open_to_work = EXCLUDED.open_to_work, raw_data = EXCLUDED.raw_data SQL [ profile['uid'], profile['fullName'], profile['location'], profile['openToWork'] ? 't' : 'f', profile.to_json ] ) end end def search_and_save(query) conn = PG.connect(dbname: 'mydb', user: 'user', password: 'password', host: 'localhost') total_saved = 0 # Initial search ``` -------------------------------- ### Node.js Example Source: https://docs.signalhire.com/search-api/full-search-example This example demonstrates how to search for candidates using the SignalHire API and save them to a PostgreSQL database. ```javascript const { Pool } = require('pg'); const pool = new Pool({ user: 'user', host: 'localhost', database: 'mydb', password: 'password', port: 5432, }); async function searchAndSave({ currentTitle, location, keywords, size, }) { const client = await pool.connect(); try { await client.query('BEGIN'); const res = await client.query( `INSERT INTO candidates (uid, full_name, location, open_to_work, raw_data) VALUES ($1, $2, $3, $4, $5) ON CONFLICT (uid) DO UPDATE SET full_name = EXCLUDED.full_name, location = EXCLUDED.location, open_to_work = EXCLUDED.open_to_work, raw_data = EXCLUDED.raw_data RETURNING *`, [ profile.uid, profile.fullName, profile.location, profile.openToWork, JSON.stringify(profile), ] ); await client.query('COMMIT'); } catch (err) { await client.query('ROLLBACK'); throw err; } finally { client.release(); await pool.end(); } } searchAndSave({ currentTitle: '(Software AND Engineer) OR Developer', location: 'New York, New York, United States', keywords: 'PHP AND JavaScript', size: 50, }).catch(console.error); ``` -------------------------------- ### Request Example - Java Source: https://docs.signalhire.com/search-api/search-by-query Example of how to make a search request using Java. ```java import java.net.http.*; import java.net.URI; HttpClient client = HttpClient.newHttpClient(); String body = """ { "currentTitle": "(Software AND Engineer) OR Developer", "location": "New York, New York, United States", "keywords": "PHP AND JavaScript" } """; HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://www.signalhire.com/api/v1/candidate/searchByQuery")) .header("apikey", "your_secret_api_key") .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(body)) .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); ``` -------------------------------- ### Full Search and Save Example Source: https://docs.signalhire.com/search-api/full-search-example This example shows how to perform a search query, retrieve results in batches, save them, and scroll through all available data. ```ruby data = api_post('/searchByQuery', query) request_id = data['requestId'] total = data['total'] scroll_id = data['scrollId'] puts "Total profiles found: #{total}" conn.transaction { save_batch(conn, data['profiles']) } total_saved += data['profiles'].size puts "Saved #{total_saved} / #{total}" # Scroll through remaining batches while scroll_id data = api_post("/scrollSearch/#{request_id}", { scrollId: scroll_id }) scroll_id = data['scrollId'] conn.transaction { save_batch(conn, data['profiles']) } total_saved += data['profiles'].size puts "Saved #{total_saved} / #{total}" end conn.close puts 'Done' end search_and_save( currentTitle: '(Software AND Engineer) OR Developer', location: 'New York, New York, United States', keywords: 'PHP AND JavaScript', size: 50 ) ``` -------------------------------- ### Request Example - Ruby Source: https://docs.signalhire.com/search-api/search-by-query Example of how to make a search request using Ruby. ```ruby require 'net/http' require 'json' uri = URI('https://www.signalhire.com/api/v1/candidate/searchByQuery') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri) request['apikey'] = 'your_secret_api_key' request['Content-Type'] = 'application/json' request.body = { currentTitle: '(Software AND Engineer) OR Developer', location: 'New York, New York, United States', keywords: 'PHP AND JavaScript' }.to_json response = http.request(request) ``` -------------------------------- ### Node.js Example Source: https://docs.signalhire.com/search-api/full-search-example This Node.js script demonstrates the same functionality as the Python example, using `axios` for HTTP requests and `pg` for PostgreSQL interaction, including saving batches and scrolling through results. ```javascript const axios = require('axios'); const { Pool } = require('pg'); const API_KEY = 'your_secret_api_key'; const BASE_URL = 'https://www.signalhire.com/api/v1/candidate'; const HEADERS = { apikey: API_KEY, 'Content-Type': 'application/json' }; const pool = new Pool({ connectionString: 'postgresql://user:password@localhost/mydb' }); async function saveBatch(client, profiles) { for (const profile of profiles) { await client.query( `INSERT INTO candidates (uid, full_name, location, skills, open_to_work, raw_data) VALUES ($1, $2, $3, $4, $5, $6) ON CONFLICT (uid) DO UPDATE SET full_name = EXCLUDED.full_name, location = EXCLUDED.location, skills = EXCLUDED.skills, open_to_work = EXCLUDED.open_to_work, raw_data = EXCLUDED.raw_data`, [ profile.uid, profile.fullName ?? null, profile.location ?? null, JSON.stringify(profile.skills ?? []), profile.openToWork ?? false, JSON.stringify(profile), ] ); } } async function searchAndSave(query) { const client = await pool.connect(); let totalSaved = 0; try { // Initial search const initial = await axios.post(`${BASE_URL}/searchByQuery`, query, { headers: HEADERS }); const { requestId, total } = initial.data; let scrollId = initial.data.scrollId; console.log(`Total profiles found: ${total}`); await client.query('BEGIN'); await saveBatch(client, initial.data.profiles); await client.query('COMMIT'); totalSaved += initial.data.profiles.length; console.log(`Saved ${totalSaved} / ${total}`); // Scroll through remaining batches while (scrollId) { const response = await axios.post( `${BASE_URL}/scrollSearch/${requestId}`, { scrollId }, { headers: HEADERS } ); scrollId = response.data.scrollId; await client.query('BEGIN'); await saveBatch(client, response.data.profiles); await client.query('COMMIT'); totalSaved += response.data.profiles.length; console.log(`Saved ${totalSaved} / ${total}`); } console.log('Done'); } finally { client.release(); } } searchAndSave({ currentTitle: '(Software AND Engineer) OR Developer', location: 'New York, New York, United States', keywords: 'PHP AND JavaScript', size: 50, }); ``` -------------------------------- ### Request Example - Node.js Source: https://docs.signalhire.com/search-api/search-by-query Example of how to make a search request using Node.js. ```javascript const axios = require('axios'); const response = await axios.post( 'https://www.signalhire.com/api/v1/candidate/searchByQuery', { currentTitle: '(Software AND Engineer) OR Developer', location: 'New York, New York, United States', keywords: 'PHP AND JavaScript' }, { headers: { apikey: 'your_secret_api_key' } } ); ``` -------------------------------- ### Request Example - Python Source: https://docs.signalhire.com/search-api/search-by-query Example of how to make a search request using Python. ```python import requests response = requests.post( "https://www.signalhire.com/api/v1/candidate/searchByQuery", headers={"apikey": "your_secret_api_key"}, json={ "currentTitle": "(Software AND Engineer) OR Developer", "location": "New York, New York, United States", "keywords": "PHP AND JavaScript" } ) ``` -------------------------------- ### Get Profiles Request Example Source: https://docs.signalhire.com/company-api/company-profiles Example of how to request employee profiles for a company asynchronously. ```bash curl -X GET \ -H 'apikey: your_secret_api_key' \ 'https://www.signalhire.com/api/v1/company/getProfiles?id=accenture&status=both&callbackUrl=https://yourdomain.com/callback' ``` -------------------------------- ### Request Example - cURL Source: https://docs.signalhire.com/search-api/search-by-query Example of how to make a search request using cURL. ```bash curl -X POST https://www.signalhire.com/api/v1/candidate/searchByQuery \ -H 'apikey: your_secret_api_key' \ --data '{ \ "currentTitle": "(Software AND Engineer) OR Developer", \ "location": "New York, New York, United States", \ "keywords": "PHP AND JavaScript" \ }' ``` -------------------------------- ### Find software engineers or developers with PHP and JavaScript skills Source: https://docs.signalhire.com/search-api/boolean-query This example demonstrates how to use Boolean operators to search for specific job titles and skills. ```json { "currentTitle": "(\"Software Engineer\") OR Developer", "keywords": "PHP AND JavaScript" } ``` -------------------------------- ### Find managers excluding assistants at Google or Microsoft Source: https://docs.signalhire.com/search-api/boolean-query This example shows how to exclude certain roles and search within specific companies using Boolean operators. ```json { "currentTitle": "Manager NOT Assistant", "currentCompany": "Google OR Microsoft" } ``` -------------------------------- ### Get Remaining Credits Endpoint Source: https://docs.signalhire.com/faq Example of how to check remaining credits for different types using the Get Remaining Credits endpoint. ```bash GET /api/v1/credits GET /api/v1/credits?withoutContacts=true ``` -------------------------------- ### Get Profile Count Request Example Source: https://docs.signalhire.com/company-api/company-profiles Example of how to request the count of profiles associated with a company. ```bash curl -X GET \ -H 'apikey: your_secret_api_key' \ 'https://www.signalhire.com/api/v1/company/getCount?id=1033&status=both' ``` -------------------------------- ### Coordinates Example Source: https://docs.signalhire.com/search-api/search-by-query Example of how to use the 'coordinates' parameter to search around multiple geographic points. ```json { "coordinates": [ { "latitude": 41.9028, "longitude": 12.4964 }, { "latitude": 45.4642, "longitude": 9.1900 } ] } ``` -------------------------------- ### HTTP Response Header Example Source: https://docs.signalhire.com/authentication Example of an HTTP response header indicating the remaining credit balance. ```http HTTP/2 201 Content-Type: application/json X-Credits-Left: 243 ``` -------------------------------- ### Response Example (HTTP 200) Source: https://docs.signalhire.com/search-api/search-by-query Example of a successful HTTP 200 response from the search API. ```http HTTP/2 200 Content-Type: application/json X-Credits-Left: 243 ``` -------------------------------- ### cURL Request Example Source: https://docs.signalhire.com/person-api/retrieve-person Example of how to make a POST request to the search endpoint using cURL. ```bash curl -X POST https://www.signalhire.com/api/v1/candidate/search \ -H 'apikey: your_secret_api_key' \ --data '{ "items": [ "https://www.linkedin.com/in/profile1", "email@example.com", "+44 0 123 456 789", "10000000000000000000000000000001" ], "callbackUrl": "https://www.yourdomain.com/yourCallbackUrl" }' ``` -------------------------------- ### Node.js Example Source: https://docs.signalhire.com/authentication Example of how to make a POST request to the SignalHire API using Node.js and axios, including the apikey header. ```javascript const axios = require('axios'); const response = await axios.post( 'https://www.signalhire.com/api/v1/candidate/search', { items: [...], callbackUrl: 'https://yourdomain.com/callback' }, { headers: { apikey: 'your_secret_api_key' } } ); ``` -------------------------------- ### cURL Example Source: https://docs.signalhire.com/authentication Example of how to make a POST request to the SignalHire API using cURL, including the apikey header. ```bash curl -X POST https://www.signalhire.com/api/v1/candidate/search \ -H 'apikey: your_secret_api_key' \ --data '{"items": [...], "callbackUrl": "https://yourdomain.com/callback"}' ``` -------------------------------- ### cURL Request Example Source: https://docs.signalhire.com/company-api/company-info Example of how to fetch company information using cURL. ```bash curl -X GET \ -H 'apikey: your_secret_api_key' \ 'https://www.signalhire.com/api/v1/company/info?id=1033' ``` -------------------------------- ### Java Request Example Source: https://docs.signalhire.com/person-api/retrieve-person Example of how to make a POST request to the search endpoint using Java's HttpClient. ```java import java.net.http.*; import java.net.URI; HttpClient client = HttpClient.newHttpClient(); String body = """ { "items": [ "https://www.linkedin.com/in/profile1", "email@example.com", "+44 0 123 456 789", "10000000000000000000000000000001" ], "callbackUrl": "https://www.yourdomain.com/yourCallbackUrl" } """; HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://www.signalhire.com/api/v1/candidate/search")) .header("apikey", "your_secret_api_key") .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(body)) .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); ``` -------------------------------- ### Callback Format Example Source: https://docs.signalhire.com/person-api/retrieve-person Example of the JSON payload received at the callback URL once processing is complete. ```json [ { "item": "https://www.linkedin.com/in/profile1", "status": "success", "candidate": { "fullName": "Profile1", "contacts": [...], ... } }, { "item": "email@email.com", "status": "failed" }, { "item": "+44 0 808 189 3171", "status": "success", "candidate": { "fullName": "Profile2", ... } }, { "item": "10000000000000000000000000000001", "status": "credits_are_over" } ] ``` -------------------------------- ### Ruby Request Example Source: https://docs.signalhire.com/person-api/retrieve-person Example of how to make a POST request to the search endpoint using Ruby's Net::HTTP. ```ruby require 'net/http' require 'json' uri = URI('https://www.signalhire.com/api/v1/candidate/search') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri) request['apikey'] = 'your_secret_api_key' request['Content-Type'] = 'application/json' request.body = { items: [ 'https://www.linkedin.com/in/profile1', 'email@example.com', '+44 0 123 456 789', '10000000000000000000000001' ], callbackUrl: 'https://www.yourdomain.com/yourCallbackUrl' }.to_json response = http.request(request) ``` -------------------------------- ### Node.js Request Example Source: https://docs.signalhire.com/person-api/retrieve-person Example of how to make a POST request to the search endpoint using Node.js and axios. ```javascript const axios = require('axios'); const response = await axios.post( 'https://www.signalhire.com/api/v1/candidate/search', { items: [ 'https://www.linkedin.com/in/profile1', 'email@example.com', '+44 0 123 456 789', '10000000000000000000000000000001' ], callbackUrl: 'https://www.yourdomain.com/yourCallbackUrl' }, { headers: { apikey: 'your_secret_api_key' } } ); ``` -------------------------------- ### Ruby Example Source: https://docs.signalhire.com/authentication Example of how to make a POST request to the SignalHire API using Ruby's Net::HTTP, including the apikey header. ```ruby require 'net/http' require 'json' uri = URI('https://www.signalhire.com/api/v1/candidate/search') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri) request['apikey'] = 'your_secret_api_key' request['Content-Type'] = 'application/json' request.body = { items: [...], callbackUrl: 'https://yourdomain.com/callback' }.to_json response = http.request(request) ``` -------------------------------- ### Python Request Example Source: https://docs.signalhire.com/company-api/company-info Example of how to fetch company information using Python with the requests library. ```python import requests response = requests.get( "https://www.signalhire.com/api/v1/company/info", headers={"apikey": "your_secret_api_key"}, params={"id": "1033"} ) ``` -------------------------------- ### Java Example Source: https://docs.signalhire.com/authentication Example of how to make a POST request to the SignalHire API using Java's HttpClient, including the apikey header. ```java import java.net.http.*; import java.net.URI; HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://www.signalhire.com/api/v1/candidate/search")) .header("apikey", "your_secret_api_key") .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString( "{\"items\": [...], \"callbackUrl\": \"https://yourdomain.com/callback\"}" )) .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); ``` -------------------------------- ### Node.js Request Example Source: https://docs.signalhire.com/company-api/company-info Example of how to fetch company information using Node.js with axios. ```javascript const axios = require('axios'); const response = await axios.get( 'https://www.signalhire.com/api/v1/company/info', { headers: { apikey: 'your_secret_api_key' }, params: { id: '1033' } } ); ``` -------------------------------- ### Example Search Profile Object Source: https://docs.signalhire.com/search-api/search-profile-object This is an example of the profile object returned by the Search API. ```json { "uid": "10000000000000000000000000001006", "fullName": "Aaron Smith", "location": "London, United Kingdom", "experience": [ { "company": "Saward Dawson", "title": "Accountant" }, { "company": "Previous Corp", "title": "Junior Accountant" } ], "skills": ["Accounting", "Analysis", "Excel"], "contactsFetched": "2024-03-15 10:22:00", "openToWork": false } ``` -------------------------------- ### Response Example (HTTP 200) - JSON Body Source: https://docs.signalhire.com/search-api/search-by-query Example JSON body for a successful HTTP 200 response. ```json { "requestId": 3, "total": 12, "scrollId": "abc123", "profiles": [ { "uid": "10000000000000000000000000001006", "fullName": "Aaron Smith", "location": "London, United Kingdom", "experience": [ { "company": "Saward Dawson", "title": "Accountant" } ], "skills": ["Accounting", "Analysis"], "contactsFetched": null, "openToWork": false } ] } ``` -------------------------------- ### cURL Request Example Source: https://docs.signalhire.com/search-api/scroll-search Example of how to make a POST request to the scrollSearch endpoint using cURL. ```bash curl -X POST https://www.signalhire.com/api/v1/candidate/scrollSearch/3 \ -H 'apikey: your_secret_api_key' \ --data '{"scrollId": "abc123"}' ``` -------------------------------- ### Python Request Example Source: https://docs.signalhire.com/search-api/scroll-search Example of how to make a POST request to the scrollSearch endpoint using Python's requests library. ```python import requests response = requests.post( "https://www.signalhire.com/api/v1/candidate/scrollSearch/3", headers={"apikey": "your_secret_api_key"}, json={"scrollId": "abc123"} ) ``` -------------------------------- ### Node.js Request Example Source: https://docs.signalhire.com/search-api/scroll-search Example of how to make a POST request to the scrollSearch endpoint using Node.js and axios. ```javascript const axios = require('axios'); const response = await axios.post( 'https://www.signalhire.com/api/v1/candidate/scrollSearch/3', { scrollId: 'abc123' }, { headers: { apikey: 'your_secret_api_key' } } ); ``` -------------------------------- ### Java Request Example Source: https://docs.signalhire.com/company-api/company-info Example of how to fetch company information using Java's built-in HTTP client. ```java import java.net.http.*; import java.net.URI; HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://www.signalhire.com/api/v1/company/info?id=1033")) .header("apikey", "your_secret_api_key") .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); ``` -------------------------------- ### Ruby Request Example Source: https://docs.signalhire.com/company-api/company-info Example of how to fetch company information using Ruby's Net::HTTP library. ```ruby require 'net/http' uri = URI('https://www.signalhire.com/api/v1/company/info?id=1033') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Get.new(uri) request['apikey'] = 'your_secret_api_key' response = http.request(request) ``` -------------------------------- ### Request Example Source: https://docs.signalhire.com/person-api/without-waterfall This example shows how to make a synchronous request to the Person API using `withoutWaterfall: true`. ```bash curl -X POST https://www.signalhire.com/api/v1/candidate/search \ -H 'apikey: your_secret_api_key' \ --data '{ "items": [ "https://www.linkedin.com/in/jennwolf", "10000000000000000000000000001001", "+123 45 6777" ], "withoutWaterfall": true }' ``` ```python import requests response = requests.post( "https://www.signalhire.com/api/v1/candidate/search", headers={"apikey": "your_secret_api_key"}, json={ "items": [ "https://www.linkedin.com/in/jennwolf", "10000000000000000000000000001001", "+123 45 6777" ], "withoutWaterfall": True } ) ``` ```javascript const axios = require('axios'); const response = await axios.post( 'https://www.signalhire.com/api/v1/candidate/search', { items: [ 'https://www.linkedin.com/in/jennwolf', '10000000000000000000000000001001', '+123 45 6777' ], withoutWaterfall: true }, { headers: { apikey: 'your_secret_api_key' } } ); ``` ```java import java.net.http.*; import java.net.URI; HttpClient client = HttpClient.newHttpClient(); String body = """ { "items": [ "https://www.linkedin.com/in/jennwolf", "10000000000000000000000000001001", "+123 45 6777" ], "withoutWaterfall": true } """; HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://www.signalhire.com/api/v1/candidate/search")) .header("apikey", "your_secret_api_key") .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(body)) .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); ``` ```ruby require 'net/http' require 'json' uri = URI('https://www.signalhire.com/api/v1/candidate/search') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri) request['apikey'] = 'your_secret_api_key' request['Content-Type'] = 'application/json' request.body = { items: [ 'https://www.linkedin.com/in/jennwolf', '10000000000000000000000000001001', '+123 45 6777' ], withoutWaterfall: true }.to_json response = http.request(request) ``` -------------------------------- ### Java Request Example Source: https://docs.signalhire.com/search-api/scroll-search Example of how to make a POST request to the scrollSearch endpoint using Java's HttpClient. ```java import java.net.http.*; import java.net.URI; HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://www.signalhire.com/api/v1/candidate/scrollSearch/3")) .header("apikey", "your_secret_api_key") .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString("{\"scrollId\": \"abc123\"}")) .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); ``` -------------------------------- ### Get Profiles Response Example (HTTP 200) Source: https://docs.signalhire.com/company-api/company-profiles Example of a successful response when initiating a request to fetch company profiles. ```json { "searchId": 1 } ``` -------------------------------- ### Get Profile Count Response Example (HTTP 200) Source: https://docs.signalhire.com/company-api/company-profiles Example of a successful response when requesting the count of company profiles. ```json { "total_profiles": 2, "profiles_credits_available": 50, "contacts_credits_available": 200 } ``` -------------------------------- ### Python Example Source: https://docs.signalhire.com/search-api/full-search-example This Python script shows how to perform an initial search, save the first batch, and then use `scrollSearch` to retrieve and save subsequent batches, committing to the database after each batch. ```python import requests import psycopg2 import json API_KEY = "your_secret_api_key" BASE_URL = "https://www.signalhire.com/api/v1/candidate" HEADERS = {"apikey": API_KEY, "Content-Type": "application/json"} def save_batch(cur, profiles: list): for profile in profiles: cur.execute( """ INSERT INTO candidates (uid, full_name, location, skills, open_to_work, raw_data) VALUES (%s, %s, %s, %s, %s, %s) ON CONFLICT (uid) DO UPDATE SET full_name = EXCLUDED.full_name, location = EXCLUDED.location, skills = EXCLUDED.skills, open_to_work = EXCLUDED.open_to_work, raw_data = EXCLUDED.raw_data """, ( profile["uid"], profile.get("fullName"), profile.get("location"), json.dumps(profile.get("skills", [])), profile.get("openToWork", False), json.dumps(profile), ) ) def search_and_save(query: dict): conn = psycopg2.connect("postgresql://user:password@localhost/mydb") cur = conn.cursor() total_saved = 0 # Initial search response = requests.post(f"{BASE_URL}/searchByQuery", headers=HEADERS, json=query) response.raise_for_status() data = response.json() request_id = data["requestId"] scroll_id = data.get("scrollId") total = data["total"] print(f"Total profiles found: {total}") save_batch(cur, data.get("profiles", [])) conn.commit() total_saved += len(data.get("profiles", [])) print(f"Saved {total_saved} / {total}") # Scroll through remaining batches while scroll_id: response = requests.post( f"{BASE_URL}/scrollSearch/{request_id}", headers=HEADERS, json={"scrollId": scroll_id} ) response.raise_for_status() data = response.json() save_batch(cur, data.get("profiles", [])) conn.commit() total_saved += len(data.get("profiles", [])) scroll_id = data.get("scrollId") print(f"Saved {total_saved} / {total}") cur.close() conn.close() print("Done") search_and_save({ "currentTitle": "(Software AND Engineer) OR Developer", "location": "New York, New York, United States", "keywords": "PHP AND JavaScript", "size": 50 }) ``` -------------------------------- ### Python Request Example Source: https://docs.signalhire.com/person-api/retrieve-person Example of how to make a POST request to the search endpoint using Python's requests library. ```python import requests response = requests.post( "https://www.signalhire.com/api/v1/candidate/search", headers={"apikey": "your_secret_api_key"}, json={ "items": [ "https://www.linkedin.com/in/profile1", "email@example.com", "+44 0 123 456 789", "10000000000000000000000000000001" ], "callbackUrl": "https://www.yourdomain.com/yourCallbackUrl" } ) ``` -------------------------------- ### Python Example Source: https://docs.signalhire.com/authentication Example of how to make a POST request to the SignalHire API using Python's requests library, including the apikey header. ```python import requests response = requests.post( "https://www.signalhire.com/api/v1/candidate/search", headers={"apikey": "your_secret_api_key"}, json={ "items": [...], "callbackUrl": "https://yourdomain.com/callback" } ) ``` -------------------------------- ### HTTP 200 Response Example Source: https://docs.signalhire.com/person-api/without-waterfall An example of a successful HTTP 200 response header. ```http HTTP/2 200 Content-Type: application/json X-Credits-Left: 241 ``` -------------------------------- ### Request Example (Sync without Callback) Source: https://docs.signalhire.com/person-api/without-contacts Examples of how to make a synchronous request without contacts and without a callback server using cURL, Python, Node.js, Java, and Ruby. ```bash curl -X POST https://www.signalhire.com/api/v1/candidate/search \ -H 'apikey: your_secret_api_key' \ --data '{ \ "items": ["https://www.linkedin.com/in/profile1"], \ "withoutContacts": true, \ "withoutWaterfall": true \ }' ``` ```python import requests response = requests.post( "https://www.signalhire.com/api/v1/candidate/search", headers={"apikey": "your_secret_api_key"}, json={ "items": ["https://www.linkedin.com/in/profile1"], "withoutContacts": True, "withoutWaterfall": True } ) ``` ```javascript const axios = require('axios'); const response = await axios.post( 'https://www.signalhire.com/api/v1/candidate/search', { items: ['https://www.linkedin.com/in/profile1'], withoutContacts: true, withoutWaterfall: true }, { headers: { apikey: 'your_secret_api_key' } } ); ``` ```java import java.net.http.*; import java.net.URI; HttpClient client = HttpClient.newHttpClient(); String body = """ { "items": ["https://www.linkedin.com/in/profile1"], "withoutContacts": true, "withoutWaterfall": true } """; HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://www.signalhire.com/api/v1/candidate/search")) .header("apikey", "your_secret_api_key") .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(body)) .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); ``` ```ruby require 'net/http' require 'json' uri = URI('https://www.signalhire.com/api/v1/candidate/search') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri) request['apikey'] = 'your_secret_api_key' request['Content-Type'] = 'application/json' request.body = { items: ['https://www.linkedin.com/in/profile1'], withoutContacts: true, withoutWaterfall: true }.to_json response = http.request(request) ``` -------------------------------- ### JSON Response Example Source: https://docs.signalhire.com/company-api/company-info Example of the JSON payload returned for a successful company information request. ```json { "name": "Accenture", "linkedInId": "1033", "industry": "Information Technology and Services", "description": "Accenture is a global professional services company...", "founded": 1989, "logo": "https://media.licdn.com/dms/image/C560BAQHx.../company-logo_200_200/", "url": "https://www.linkedin.com/company/accenture", "website": "http://www.accenture.com", "phone": null, "type": "Public Company", "staffCount": 546636, "staffCountRange": 10001, "staffingCompany": false, "specialities": [ "Management Consulting", "Systems Integration and Technology", "Business Process Outsourcing", "Application and Infrastructure Outsourcing" ], "confirmedLocations": [ { "country": "IE", "city": "Dublin 2", "line1": "Grand Canal Harbour", "headquarter": true, "streetAddressOptOut": false }, { "country": "US", "geographicArea": "California", "city": "San Francisco", "postalCode": "94105", "line1": "415 Mission Street", "line2": "Floor 31-34", "headquarter": false, "streetAddressOptOut": false } ] } ```