接入教程
1. 访问GitHub查看API文档
2. 注册Movebank账户获取API密钥
3. 使用GET请求查询物种轨迹数据
4. 通过参数过滤时间范围与地理区域
5. 下载JSON格式数据进行分析
6. 可选:上传自有追踪数据至平台
获取动物轨迹数据
import requests
url = 'https://api.example.com/movebank/api/studies/123/events'
headers = {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json'
}
params = {
'individual_local_identifiers': 'animal_001',
'start_date': '2023-01-01',
'end_date': '2023-01-31'
}
try:
response = requests.get(url, headers=headers, params=params)
response.raise_for_status()
data = response.json()
print(f'Retrieved {len(data)} movement records')
except requests.exceptions.RequestException as e:
print(f'Error fetching data: {e}')
查询研究项目元数据
<?php
$api_url = 'https://api.example.com/movebank/api/studies';
$api_key = 'YOUR_API_KEY';
$options = [
'http' => [
'method' => 'GET',
'header' => "Authorization: Bearer $api_key\r\n" .
"Accept: application/json\r\n"
]
];
$context = stream_context_create($options);
$response = file_get_contents($api_url, false, $context);
if ($response !== false) {
$studies = json_decode($response, true);
echo 'Available studies: ' . count($studies);
} else {
echo 'Failed to retrieve studies';
}
?>
获取特定物种的移动事件
const fetchMovements = async () => {
const url = 'https://api.example.com/movebank/api/events';
const params = new URLSearchParams({
'taxon_id': 'aves',
'limit': 50,
'offset': 0
});
try {
const response = await fetch(`${url}?${params}`, {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json'
}
});
if (!response.ok) {
throw new Error(`HTTP error: ${response.status}`);
}
const events = await response.json();
console.log(`Fetched ${events.length} bird movement events`);
return events;
} catch (error) {
console.error('Error fetching movement data:', error);
}
};
fetchMovements();
常见问题
如何获取API访问权限?
Movebank API目前提供免费访问,但需要注册研究账户并申请API密钥。请访问官方GitHub文档页面查看详细的认证流程和权限申请方法。
API支持哪些数据格式?
Movebank API主要支持JSON格式的数据返回,同时部分端点也提供CSV格式导出功能。所有API响应都遵循标准RESTful设计规范。
数据更新频率是多少?
动物追踪数据的更新频率取决于各个研究项目的上传计划,通常从实时更新到每月更新不等。API文档中会标注每个数据集的更新周期信息。
Aitishiku.com