接入教程
1. 注册并获取API密钥
2. 调用人员或公司信息查询端点
3. 设置您的社交网络参数
4. 请求暖启动引荐路径
5. 集成返回数据到您的应用
6. 根据需求调整查询参数
使用Village API获取公司信息
import requests
url = "https://api.example.com/v1/companies/enrich"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
payload = {
"domain": "example.com",
"include_contacts": True
}
response = requests.post(url, headers=headers, json=payload)
if response.status_code == 200:
data = response.json()
print(f"Company: {data.get('name')}")
print(f"Industry: {data.get('industry')}")
else:
print(f"Error: {response.status_code}")
print(response.text)
通过Village API查找个人简介
<?php
$url = 'https://api.example.com/v1/people/enrich';
$apiKey = 'YOUR_API_KEY';
$data = [
'email' => 'person@example.com',
'include_connections' => true
];
$options = [
'http' => [
'header' => "Authorization: Bearer {$apiKey}\r\n" .
"Content-Type: application/json\r\n",
'method' => 'POST',
'content' => json_encode($data)
]
];
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
if ($response !== false) {
$result = json_decode($response, true);
echo "Name: " . ($result['full_name'] ?? 'N/A') . "\n";
echo "Company: " . ($result['current_company'] ?? 'N/A') . "\n";
} else {
echo "API request failed.\n";
}
?>
使用Village API建立联系路径
const fetchConnectionPaths = async () => {
const url = 'https://api.example.com/v1/connections/paths';
const options = {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
source_person_id: 'person_123',
target_person_id: 'person_456',
max_path_length: 3
})
};
try {
const response = await fetch(url, options);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
console.log('Connection paths:', data.paths);
console.log('Total paths found:', data.total_paths);
return data;
} catch (error) {
console.error('Error fetching connection paths:', error);
}
};
// Call the function
fetchConnectionPaths();
常见问题
Village API的主要功能是什么?
Village API提供个人和公司信息丰富功能,并通过用户的社交网络建立暖启动路径。它可以帮助获取详细的背景信息,并利用现有联系人网络建立联系,适用于招聘、销售拓展和业务开发等场景。
如何获取API密钥?
您需要访问Village API的官方网站(https://docs.village.ai)注册账户并创建项目,即可在开发者控制台中获取API密钥。请妥善保管您的API密钥,不要在前端代码中公开。
API请求有哪些限制?
Village API对请求频率和数据返回量有一定限制,具体限制根据您的订阅计划而定。建议查阅官方文档中的速率限制部分,并合理实施重试机制和错误处理。免费计划通常有较低的调用限制。
Aitishiku.com