<?php
$apiKey = 'sua_api_key_aqui';
$url = 'https://api.beduc.com.br/v1/candidates';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-API-Key: ' . $apiKey,
'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$data = json_decode($response, true);
if ($httpCode === 200) {
foreach ($data['data'] as $candidate) {
echo "Nome: " . $candidate['nome'] . "\n";
}
} else {
echo "Erro: " . $data['message'];
}
?>
const apiKey = 'sua_api_key_aqui';
const url = 'https://api.beduc.com.br/v1/candidates/123';
fetch(url, {
method: 'GET',
headers: {
'X-API-Key': apiKey,
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(data => {
if (data.success) {
console.log('Cidadão:', data.data);
} else {
console.error('Erro:', data.message);
}
})
.catch(error => {
console.error('Erro na requisição:', error);
});
import requests
import json
api_key = 'sua_api_key_aqui'
url = 'https://api.beduc.com.br/v1/candidates'
data = {
'nome': 'João Silva',
'email': 'joao@email.com',
'cpf': '123.456.789-00',
'data_nascimento': '1990-01-01'
}
headers = {
'X-API-Key': api_key,
'Content-Type': 'application/json'
}
response = requests.post(url, json=data, headers=headers)
if response.status_code == 201:
candidate = response.json()['data']
print(f"Cidadão criado: {candidate['nome']}")
else:
print(f"Erro: {response.json()['message']}")
curl -X GET "https://api.beduc.com.br/v1/candidates" \
-H "X-API-Key: sua_api_key_aqui" \
-H "Content-Type: application/json"
curl -X POST "https://api.beduc.com.br/v1/candidates" \
-H "X-API-Key: sua_api_key_aqui" \
-H "Content-Type: application/json" \
-d '{
"nome": "João Silva",
"email": "joao@email.com",
"cpf": "123.456.789-00"
}'
const axios = require('axios');
const apiKey = 'sua_api_key_aqui';
const url = 'https://api.beduc.com.br/v1/candidates/123';
const updateData = {
telefone: '(11) 99999-9999',
endereco: 'Rua das Flores, 123'
};
axios.put(url, updateData, {
headers: {
'X-API-Key': apiKey,
'Content-Type': 'application/json'
}
})
.then(response => {
console.log('Cidadão atualizado:', response.data.data);
})
.catch(error => {
console.error('Erro:', error.response.data.message);
});