Exemples d'intégration
Découvrez comment intégrer SnapIndex dans vos applications
Python
import requests
def analyze_document(file_path):
with open(file_path, 'rb') as f:
files = {'file': f}
response = requests.post(
'https://api.snapindex.fr/api/upload',
headers={'X-API-KEY': 'votre-clé-api'},
files=files
)
return response.json()
JavaScript
async function analyzeDocument(file) {
const formData = new FormData();
formData.append('file', file);
const response = await fetch('https://api.snapindex.fr/api/upload', {
method: 'POST',
headers: {
'X-API-KEY': 'votre-clé-api'
},
body: formData
});
return await response.json();
}
PHP
function analyzeDocument($filePath) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.snapindex.fr/api/upload');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
'file' => new CURLFile($filePath)
]);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-API-KEY: votre-clé-api'
]);
$response = curl_exec($ch);
curl_close($ch);
return json_decode($response, true);
}