Endpoints
Consulta de saldo disponível
[POST] https://sandbox-api.workbankvirtual.com.br/api/tegge/v1/availablebalance
Parâmetros
Header
x-api-key | chave pública |
---|---|
x-api-token | token de acesso |
Responses
200: OK | Retorna confirmação de consulta |
---|---|
401: Unauthorized | Não foi possível autenticar |
403: Forbidden | Acesso não permitido |
Exemplo de corpo da requisição
{
“cpf”: “12345678901” // string
}
–header ‘x-api-key: <chave_publica>’
–header ‘x-api-token: <token>’
–header ‘Content-Type: application/json’
–data ‘{
“cpf”: “<cpf>”
}’
{
try
{
string url = “https://sandbox-api.workbankvirtual.com.br/api/tegge/v1/availablebalance”;
string publicKey = “<chave_publica>”;
string token = “<token>”;
_httpClient.DefaultRequestHeaders.Add(“x-api-key”, publicKey);
_httpClient.DefaultRequestHeaders.Add(“x-api-token”, token);
var content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(requestData), System.Text.Encoding.UTF8, “application/json”);
var response = await _httpClient.PostAsync(url, content);
if (response.IsSuccessStatusCode)
{
string responseBody = await response.Content.ReadAsStringAsync();
return Ok(responseBody);
}
else
{
return BadRequest($”Erro na requisição: {response.StatusCode}”);
}
}
catch (Exception ex)
{
return StatusCode(500, $”Erro na requisição: {ex.Message}”);
}
}
<?php
$url = ‘https://sandbox-api.workbankvirtual.com.br/api/tegge/v1/availablebalance’;
$data = [
‘cpf’ => ‘<cpf>’
];
$apiKey = ‘<chave_publica>’;
$apiToken = ‘<token>’;
$headers = [
‘x-api-key: ‘ . $apiKey,
‘x-api-token: ‘ . $apiToken,
‘Content-Type: application/json’
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpcode >= 200 && $httpcode < 300) {
echo “Requisição bem-sucedida. Resposta: ” . $response;
} else {
echo “Erro na requisição. Código HTTP: ” . $httpcode;
}
import requests
url = ‘https://sandbox-api.workbankvirtual.com.br/api/tegge/v1/availablebalance’
data = {
‘cpf’: ‘<cpf>’
}
headers = {
‘x-api-key’: ‘<chave_publica>’,
‘x-api-token’: ‘<token>’,
‘Content-Type’: ‘application/json’
}
response = requests.post(url, json=data, headers=headers)
if response.status_code == 200:
print(‘Requisição bem-sucedida. Resposta:’, response.json())
else:
print(‘Erro na requisição. Código HTTP:’, response.status_code)
Consulta de taxas
GET https://sandbox-api.workbankvirtual.com.br/api/tegge/v1/rates
‘https://sandbox-api.workbankvirtual.com.br/api/tegge-hml/v1/rates?deadline=<prazo_escolhido>’
–header ‘x-api-key: <chave_publica>’
–header ‘x-api-token: <token>’
{
string apiUrl = “https://sandbox-api.workbankvirtual.com.br/api/auth-hml/v1/token”;
string clientKey = “”;
string publicKey = “”;
string username = “”;_httpClient.DefaultRequestHeaders.Add(“clientKey”, clientKey);
_httpClient.DefaultRequestHeaders.Add(“publicKey”, publicKey);
_httpClient.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue(“application/json”));var requestBody = new
{
username = username
};var jsonBody = JsonSerializer.Serialize(requestBody);
var content = new StringContent(jsonBody, Encoding.UTF8, “application/json”);
HttpResponseMessage response = await _httpClient.PostAsync(apiUrl, content);
if (response.IsSuccessStatusCode)
{
string responseContent = await response.Content.ReadAsStringAsync();
return Ok(responseContent);
}
else
{
return BadRequest(“Erro na requisição: ” + response.StatusCode);
}
}
<?php
$apiKey = ‘<chave_publica>’;
$apiToken = ‘<token>’;
$deadline = ‘<prazo_escolhido>’;
$url = “https://sandbox-api.workbankvirtual.com.br/api/tegge-hml/v1/rates?deadline={$deadline}”;
$options = [
‘http’ => [
‘header’ => “x-api-key: {$apiKey}rn” .
“x-api-token: {$apiToken}rn”,
‘method’ => ‘GET’
]
];
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
if ($response) {
echo “Resposta da API:n”;
echo $response;
} else {
echo “Erro na requisição.n”;
}
?>
import requests
apiKey = ‘<chave_publica>’
apiToken = ‘<token>’
deadline = ‘<prazo_escolhido>’
url = f’https://sandbox-api.workbankvirtual.com.br/api/tegge-hml/v1/rates?deadline={deadline}’
headers = {
‘x-api-key’: apiKey,
‘x-api-token’: apiToken
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
print(“Resposta da API:”)
print(response.json())
else:
print(“Erro na requisição.”)
Simulação de Proposta
POSThttps://sandbox-api.workbankvirtual.com.br/api/tegge/v1/fgts/simulate
–header ‘x-api-key: <chave_publica>’
–header ‘x-api-token: <token>’
–header ‘Content-Type: application/json’
–data ‘{
“search_by_installment”: true,
“value”: 0,
“desired_installments”: [
{
“total_amount”: 100.11,
“due_date”: “2024-08-16”
}
],
“id_rate”: 5
}’
{
try
{
_httpClient.DefaultRequestHeaders.Clear();
_httpClient.DefaultRequestHeaders.Add(“x-api-key”, apiKey);
_httpClient.DefaultRequestHeaders.Add(“x-api-token”, token);
_httpClient.DefaultRequestHeaders.Add(“Content-Type”, “application/json”);
var requestContent = new
{
search_by_installment = true,
value = 0,
desired_installments = new[]
{
new
{
total_amount = 100.11,
due_date = “2024-08-16”
}
},
id_rate = 5
};
var json = Newtonsoft.Json.JsonConvert.SerializeObject(requestContent);
var data = new StringContent(json, Encoding.UTF8, “application/json”);
string url = “https://sandbox-api.workbankvirtual.com.br/api/tegge-hml/v1/fgts/simulate”;
HttpResponseMessage response = await _httpClient.PostAsync(url, data);
if (response.IsSuccessStatusCode)
{
string result = await response.Content.ReadAsStringAsync();
return Ok(result);
}
else
{
return StatusCode((int)response.StatusCode, “Erro na requisição.”);
}
}
catch (Exception ex)
{
return StatusCode(500, $”Erro interno: {ex.Message}”);
}
}
<?php
$url = ‘https://sandbox-api.workbankvirtual.com.br/api/tegge-hml/v1/fgts/simulate’;
$headers = array(
‘x-api-key: <chave_publica>’,
‘x-api-token: <token>’,
‘Content-Type: application/json’
);
$data = array(
“search_by_installment” => true,
“value” => 0,
“desired_installments” => array(
array(
“total_amount” => 100.11,
“due_date” => “2024-08-16”
)
),
“id_rate” => 5
);
$options = array(
‘http’ => array(
‘header’ => implode(“rn”, $headers),
‘method’ => ‘POST’,
‘content’ => json_encode($data)
)
);
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
if ($response) {
echo $response;
} else {
echo “Erro na requisição”;
}
?>
import requests
import json
def simulate_fgts():
url = ‘https://sandbox-api.workbankvirtual.com.br/api/tegge-hml/v1/fgts/simulate’
headers = {
‘x-api-key’: ‘<chave_publica>’,
‘x-api-token’: ‘<token>’,
‘Content-Type’: ‘application/json’
}
payload = {
“search_by_installment”: True,
“value”: 0,
“desired_installments”: [
{
“total_amount”: 100.11,
“due_date”: “2024-08-16”
}
],
“id_rate”: 5
}
try:
response = requests.post(url, headers=headers, json=payload)
if response.status_code == 200:
return response.json()
else:
return f”Erro na requisição: {response.text}”
except requests.RequestException as e:
return f”Erro na requisição: {str(e)}”
result = simulate_fgts()
print(result)
Inserir Proposta
POSThttps://sandbox-api.workbankvirtual.com.br/api/tegge/v1/fgts/insert
–header ‘x-api-key: ‘
–header ‘x-api-token: ‘
–header ‘Content-Type: application/json’
–data-raw ‘{
“id_rate”: 10,
“client”: {
“name”: “ENZO RODRIGUES FELICIAO DE SOUZA”,
“mother_name”: “JOANA DA SILVA”,
“birthday”: “2000-09-08”,
“profession_code”: “Outros”,
“nationality”: “brasileira”,
“maritial_status”: “single”,
“gender”: “FEMININO”,
“document_type”: “rg”,
“document_number”: “8888233”,
“issue_body”: “SSP”,
“cpf”: “24771899304”,
“email”: “teste@teste.com.br”,
“phone”: “31997883309”
},
“address”: {
“street”: “RUA MARANHÃO”,
“state”: “MG”,
“city”: “BELO HORIZONTE”,
“neighborhood”: “SANTA EFIGÊNIA”,
“number”: “”,
“postal_code”: “30150330”
},
“simulation”: {
“installments”: [
{
“total_amount”: 987.13,
“due_date”: “2024-01-01”
},
{
“total_amount”: 648.62,
“due_date”: “2025-01-01”
},
{
“total_amount”: 502.38,
“due_date”: “2026-01-01”
},
{
“total_amount”: 307.48,
“due_date”: “2027-01-01”
}
],
“annual_rate”: 0.23726114,
“disbursement_date”: “2023-09-08”,
“issue_date”: “2023-09-08”
},
“payment”: {
“bank”: {
“number”: “001”,
“agency”: “2333”,
“account”: “32333”,
“account_digit”: “2”
}
}
}’
{
try
{
var url = “https://sandbox-api.workbankvirtual.com.br/api/tegge/v1/fgts/insert”;
var payload = new
{
id_rate = 10,
client = new
{
name = “ENZO RODRIGUES FELICIAO DE SOUZA”,
mother_name = “JOANA DA SILVA”,
// … (adicionar os demais campos)
},
// … (adicionar os demais campos)
};
var jsonPayload = JsonConvert.SerializeObject(payload);
var content = new StringContent(jsonPayload, Encoding.UTF8, “application/json”);
var client = _httpClientFactory.CreateClient();
client.DefaultRequestHeaders.Add(“x-api-key”, apiKey);
client.DefaultRequestHeaders.Add(“x-api-token”, apiToken);
var response = await client.PostAsync(url, content);
if (response.IsSuccessStatusCode)
{
var responseContent = await response.Content.ReadAsStringAsync();
return Ok(responseContent);
}
else
{
return StatusCode((int)response.StatusCode, “Erro na requisição.”);
}
}
catch (Exception ex)
{
return StatusCode(500, $”Erro interno: {ex.Message}”);
}
}
<?php
function insertFGTSData($apiKey, $apiToken) {
$url = ‘https://sandbox-api.workbankvirtual.com.br/api/tegge/v1/fgts/insert’;
$headers = [
‘x-api-key: ‘ . $apiKey,
‘x-api-token: ‘ . $apiToken,
‘Content-Type: application/json’
];
$data = [
‘id_rate’ => 10,
‘client’ => [
‘name’ => ‘ENZO RODRIGUES FELICIAO DE SOUZA’,
‘mother_name’ => ‘JOANA DA SILVA’,
// Adicione os demais campos aqui
],
// Adicione os demais campos aqui
];
$options = [
‘http’ => [
‘header’ => implode(“rn”, $headers),
‘method’ => ‘POST’,
‘content’ => json_encode($data)
]
];
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === false) {
return “Erro na requisição”;
} else {
return $result;
}
}
// Substitua ‘sua_chave_publica’ e ‘seu_token’ pelos valores reais
$apiKey = ‘sua_chave_publica’;
$apiToken = ‘seu_token’;
$response = insertFGTSData($apiKey, $apiToken);
echo $response;
?>
import requests
import json
def insert_fgts_data(api_key, api_token):
url = ‘https://sandbox-api.workbankvirtual.com.br/api/tegge/v1/fgts/insert’
headers = {
‘x-api-key’: api_key,
‘x-api-token’: api_token,
‘Content-Type’: ‘application/json’
}
payload = {
“id_rate”: 10,
“client”: {
“name”: “ENZO RODRIGUES FELICIAO DE SOUZA”,
“mother_name”: “JOANA DA SILVA”,
# Adicione os demais campos aqui
},
# Adicione os demais campos aqui
}
try:
response = requests.post(url, headers=headers, json=payload)
if response.ok:
return response.json()
else:
return f”Erro na requisição: {response.status_code}”
except requests.RequestException as e:
return f”Erro na requisição: {str(e)}”
# Substitua ‘sua_chave_publica’ e ‘seu_token’ pelos valores reais
api_key = ‘sua_chave_publica’
api_token = ‘seu_token’
result = insert_fgts_data(api_key, api_token)
print(result)
Consulta de Propostas
GEThttps://sandbox-api.workbankvirtual.com.br/api/tegge/v1/proposal
–header ‘x-api-token: <chave_publica>’
–header ‘x-api-key: <token>’
{
private readonly string _baseUrl = “https://sandbox-api.workbankvirtual.com.br”;
private readonly string _publicKey = “<chave_publica>”; // Substitua com sua chave pública
private readonly string _apiKey = “<token>”; // Substitua com seu token
private readonly HttpClient _client;
public ProposalController()
{
_client = new HttpClient { BaseAddress = new Uri(_baseUrl) };
_client.DefaultRequestHeaders.Add(“x-api-token”, _publicKey);
_client.DefaultRequestHeaders.Add(“x-api-key”, _apiKey);
}
{
try
{
string url = $”/api/tegge/v1/proposal?startDate={Uri.EscapeDataString(startDate)}&endDate={Uri.EscapeDataString(endDate)}”;
HttpResponseMessage response = await _client.GetAsync(url);
if (response.IsSuccessStatusCode)
{
string responseBody = await response.Content.ReadAsStringAsync();
return Ok(responseBody);
}
else
{
return StatusCode((int)response.StatusCode, $”Falha na solicitação: {response.StatusCode} – {response.ReasonPhrase}”);
}
}
catch (Exception ex)
{
return BadRequest($”Erro ao fazer a solicitação: {ex.Message}”);
}
}
}
<?php
$baseUrl = ‘https://sandbox-api.workbankvirtual.com.br’;
$publicKey = ‘<chave_publica>’; // Substitua com sua chave pública
$apiKey = ‘<token>’; // Substitua com seu token
$startDate = urlencode(‘<data_inicio>’); // Substitua com a data de início desejada
$endDate = urlencode(‘<data_fim>’); // Substitua com a data de fim desejada
$url = “{$baseUrl}/api/tegge/v1/proposal?startDate={$startDate}&endDate={$endDate}”;
$headers = [
‘http’ => [
‘method’ => ‘GET’,
‘header’ => “x-api-token: {$publicKey}rn” . “x-api-key: {$apiKey}rn”
]
];
$context = stream_context_create($headers);
$response = file_get_contents($url, false, $context);
if ($response !== false) {
echo “Resposta da API: ” . $response;
} else {
echo “Falha na solicitação”;
}
import urllib.request
base_url = ‘https://sandbox-api.workbankvirtual.com.br’
public_key = ‘<chave_publica>’ # Substitua com sua chave pública
api_key = ‘<token>’ # Substitua com seu token
start_date = ‘<data_inicio>’ # Substitua com a data de início desejada
end_date = ‘<data_fim>’ # Substitua com a data de fim desejada
url = f”{base_url}/api/tegge/v1/proposal?startDate={start_date}&endDate={end_date}”
headers = {
‘x-api-token’: public_key,
‘x-api-key’: api_key
}
req = urllib.request.Request(url, headers=headers)
try:
with urllib.request.urlopen(req) as response:
data = response.read()
print(“Resposta da API:”, data.decode(‘utf-8’))
except urllib.error.HTTPError as e:
print(“Erro HTTP:”, e.code)
print(“Resposta:”, e.read().decode(‘utf-8’))
except urllib.error.URLError as e:
print(“Erro de URL:”, e.reason)
Endpoints
Consulta de saldo disponível
[POST] https://sandbox-api.workbankvirtual.com.br/api/tegge/v1/availablebalance
Parâmetros
Header
x-api-key | chave pública |
---|---|
x-api-token | token de acesso |
Responses
200: OK | Retorna confirmação de consulta |
---|---|
401: Unauthorized | Não foi possível autenticar |
403: Forbidden | Acesso não permitido |
Exemplo de corpo da requisição
{
“cpf”: “12345678901” // string
}
–header ‘x-api-key: <chave_publica>’
–header ‘x-api-token: <token>’
–header ‘Content-Type: application/json’
–data ‘{
“cpf”: “<cpf>”
}’
{
try
{
string url = “https://sandbox-api.workbankvirtual.com.br/api/tegge/v1/availablebalance”;
string publicKey = “<chave_publica>”;
string token = “<token>”;
_httpClient.DefaultRequestHeaders.Add(“x-api-key”, publicKey);
_httpClient.DefaultRequestHeaders.Add(“x-api-token”, token);
var content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(requestData), System.Text.Encoding.UTF8, “application/json”);
var response = await _httpClient.PostAsync(url, content);
if (response.IsSuccessStatusCode)
{
string responseBody = await response.Content.ReadAsStringAsync();
return Ok(responseBody);
}
else
{
return BadRequest($”Erro na requisição: {response.StatusCode}”);
}
}
catch (Exception ex)
{
return StatusCode(500, $”Erro na requisição: {ex.Message}”);
}
}
<?php
$url = ‘https://sandbox-api.workbankvirtual.com.br/api/tegge/v1/availablebalance’;
$data = [
‘cpf’ => ‘<cpf>’
];
$apiKey = ‘<chave_publica>’;
$apiToken = ‘<token>’;
$headers = [
‘x-api-key: ‘ . $apiKey,
‘x-api-token: ‘ . $apiToken,
‘Content-Type: application/json’
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpcode >= 200 && $httpcode < 300) {
echo “Requisição bem-sucedida. Resposta: ” . $response;
} else {
echo “Erro na requisição. Código HTTP: ” . $httpcode;
}
import requests
url = ‘https://sandbox-api.workbankvirtual.com.br/api/tegge/v1/availablebalance’
data = {
‘cpf’: ‘<cpf>’
}
headers = {
‘x-api-key’: ‘<chave_publica>’,
‘x-api-token’: ‘<token>’,
‘Content-Type’: ‘application/json’
}
response = requests.post(url, json=data, headers=headers)
if response.status_code == 200:
print(‘Requisição bem-sucedida. Resposta:’, response.json())
else:
print(‘Erro na requisição. Código HTTP:’, response.status_code)
Consulta de taxas
GET https://sandbox-api.workbankvirtual.com.br/api/tegge/v1/rates
‘https://sandbox-api.workbankvirtual.com.br/api/tegge-hml/v1/rates?deadline=<prazo_escolhido>’
–header ‘x-api-key: <chave_publica>’
–header ‘x-api-token: <token>’
{
string apiUrl = “https://sandbox-api.workbankvirtual.com.br/api/auth-hml/v1/token”;
string clientKey = “”;
string publicKey = “”;
string username = “”;_httpClient.DefaultRequestHeaders.Add(“clientKey”, clientKey);
_httpClient.DefaultRequestHeaders.Add(“publicKey”, publicKey);
_httpClient.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue(“application/json”));var requestBody = new
{
username = username
};var jsonBody = JsonSerializer.Serialize(requestBody);
var content = new StringContent(jsonBody, Encoding.UTF8, “application/json”);
HttpResponseMessage response = await _httpClient.PostAsync(apiUrl, content);
if (response.IsSuccessStatusCode)
{
string responseContent = await response.Content.ReadAsStringAsync();
return Ok(responseContent);
}
else
{
return BadRequest(“Erro na requisição: ” + response.StatusCode);
}
}
<?php
$apiKey = ‘<chave_publica>’;
$apiToken = ‘<token>’;
$deadline = ‘<prazo_escolhido>’;
$url = “https://sandbox-api.workbankvirtual.com.br/api/tegge-hml/v1/rates?deadline={$deadline}”;
$options = [
‘http’ => [
‘header’ => “x-api-key: {$apiKey}rn” .
“x-api-token: {$apiToken}rn”,
‘method’ => ‘GET’
]
];
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
if ($response) {
echo “Resposta da API:n”;
echo $response;
} else {
echo “Erro na requisição.n”;
}
?>
import requests
apiKey = ‘<chave_publica>’
apiToken = ‘<token>’
deadline = ‘<prazo_escolhido>’
url = f’https://sandbox-api.workbankvirtual.com.br/api/tegge-hml/v1/rates?deadline={deadline}’
headers = {
‘x-api-key’: apiKey,
‘x-api-token’: apiToken
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
print(“Resposta da API:”)
print(response.json())
else:
print(“Erro na requisição.”)
Simulação de Proposta
POSThttps://sandbox-api.workbankvirtual.com.br/api/tegge/v1/fgts/simulate
–header ‘x-api-key: <chave_publica>’
–header ‘x-api-token: <token>’
–header ‘Content-Type: application/json’
–data ‘{
“search_by_installment”: true,
“value”: 0,
“desired_installments”: [
{
“total_amount”: 100.11,
“due_date”: “2024-08-16”
}
],
“id_rate”: 5
}’
{
try
{
_httpClient.DefaultRequestHeaders.Clear();
_httpClient.DefaultRequestHeaders.Add(“x-api-key”, apiKey);
_httpClient.DefaultRequestHeaders.Add(“x-api-token”, token);
_httpClient.DefaultRequestHeaders.Add(“Content-Type”, “application/json”);
var requestContent = new
{
search_by_installment = true,
value = 0,
desired_installments = new[]
{
new
{
total_amount = 100.11,
due_date = “2024-08-16”
}
},
id_rate = 5
};
var json = Newtonsoft.Json.JsonConvert.SerializeObject(requestContent);
var data = new StringContent(json, Encoding.UTF8, “application/json”);
string url = “https://sandbox-api.workbankvirtual.com.br/api/tegge-hml/v1/fgts/simulate”;
HttpResponseMessage response = await _httpClient.PostAsync(url, data);
if (response.IsSuccessStatusCode)
{
string result = await response.Content.ReadAsStringAsync();
return Ok(result);
}
else
{
return StatusCode((int)response.StatusCode, “Erro na requisição.”);
}
}
catch (Exception ex)
{
return StatusCode(500, $”Erro interno: {ex.Message}”);
}
}
<?php
$url = ‘https://sandbox-api.workbankvirtual.com.br/api/tegge-hml/v1/fgts/simulate’;
$headers = array(
‘x-api-key: <chave_publica>’,
‘x-api-token: <token>’,
‘Content-Type: application/json’
);
$data = array(
“search_by_installment” => true,
“value” => 0,
“desired_installments” => array(
array(
“total_amount” => 100.11,
“due_date” => “2024-08-16”
)
),
“id_rate” => 5
);
$options = array(
‘http’ => array(
‘header’ => implode(“rn”, $headers),
‘method’ => ‘POST’,
‘content’ => json_encode($data)
)
);
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
if ($response) {
echo $response;
} else {
echo “Erro na requisição”;
}
?>
import requests
import json
def simulate_fgts():
url = ‘https://sandbox-api.workbankvirtual.com.br/api/tegge-hml/v1/fgts/simulate’
headers = {
‘x-api-key’: ‘<chave_publica>’,
‘x-api-token’: ‘<token>’,
‘Content-Type’: ‘application/json’
}
payload = {
“search_by_installment”: True,
“value”: 0,
“desired_installments”: [
{
“total_amount”: 100.11,
“due_date”: “2024-08-16”
}
],
“id_rate”: 5
}
try:
response = requests.post(url, headers=headers, json=payload)
if response.status_code == 200:
return response.json()
else:
return f”Erro na requisição: {response.text}”
except requests.RequestException as e:
return f”Erro na requisição: {str(e)}”
result = simulate_fgts()
print(result)
Inserir Proposta
POSThttps://sandbox-api.workbankvirtual.com.br/api/tegge/v1/fgts/insert
–header ‘x-api-key: ‘
–header ‘x-api-token: ‘
–header ‘Content-Type: application/json’
–data-raw ‘{
“id_rate”: 10,
“client”: {
“name”: “ENZO RODRIGUES FELICIAO DE SOUZA”,
“mother_name”: “JOANA DA SILVA”,
“birthday”: “2000-09-08”,
“profession_code”: “Outros”,
“nationality”: “brasileira”,
“maritial_status”: “single”,
“gender”: “FEMININO”,
“document_type”: “rg”,
“document_number”: “8888233”,
“issue_body”: “SSP”,
“cpf”: “24771899304”,
“email”: “teste@teste.com.br”,
“phone”: “31997883309”
},
“address”: {
“street”: “RUA MARANHÃO”,
“state”: “MG”,
“city”: “BELO HORIZONTE”,
“neighborhood”: “SANTA EFIGÊNIA”,
“number”: “”,
“postal_code”: “30150330”
},
“simulation”: {
“installments”: [
{
“total_amount”: 987.13,
“due_date”: “2024-01-01”
},
{
“total_amount”: 648.62,
“due_date”: “2025-01-01”
},
{
“total_amount”: 502.38,
“due_date”: “2026-01-01”
},
{
“total_amount”: 307.48,
“due_date”: “2027-01-01”
}
],
“annual_rate”: 0.23726114,
“disbursement_date”: “2023-09-08”,
“issue_date”: “2023-09-08”
},
“payment”: {
“bank”: {
“number”: “001”,
“agency”: “2333”,
“account”: “32333”,
“account_digit”: “2”
}
}
}’
{
try
{
var url = “https://sandbox-api.workbankvirtual.com.br/api/tegge/v1/fgts/insert”;
var payload = new
{
id_rate = 10,
client = new
{
name = “ENZO RODRIGUES FELICIAO DE SOUZA”,
mother_name = “JOANA DA SILVA”,
// … (adicionar os demais campos)
},
// … (adicionar os demais campos)
};
var jsonPayload = JsonConvert.SerializeObject(payload);
var content = new StringContent(jsonPayload, Encoding.UTF8, “application/json”);
var client = _httpClientFactory.CreateClient();
client.DefaultRequestHeaders.Add(“x-api-key”, apiKey);
client.DefaultRequestHeaders.Add(“x-api-token”, apiToken);
var response = await client.PostAsync(url, content);
if (response.IsSuccessStatusCode)
{
var responseContent = await response.Content.ReadAsStringAsync();
return Ok(responseContent);
}
else
{
return StatusCode((int)response.StatusCode, “Erro na requisição.”);
}
}
catch (Exception ex)
{
return StatusCode(500, $”Erro interno: {ex.Message}”);
}
}
<?php
function insertFGTSData($apiKey, $apiToken) {
$url = ‘https://sandbox-api.workbankvirtual.com.br/api/tegge/v1/fgts/insert’;
$headers = [
‘x-api-key: ‘ . $apiKey,
‘x-api-token: ‘ . $apiToken,
‘Content-Type: application/json’
];
$data = [
‘id_rate’ => 10,
‘client’ => [
‘name’ => ‘ENZO RODRIGUES FELICIAO DE SOUZA’,
‘mother_name’ => ‘JOANA DA SILVA’,
// Adicione os demais campos aqui
],
// Adicione os demais campos aqui
];
$options = [
‘http’ => [
‘header’ => implode(“rn”, $headers),
‘method’ => ‘POST’,
‘content’ => json_encode($data)
]
];
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === false) {
return “Erro na requisição”;
} else {
return $result;
}
}
// Substitua ‘sua_chave_publica’ e ‘seu_token’ pelos valores reais
$apiKey = ‘sua_chave_publica’;
$apiToken = ‘seu_token’;
$response = insertFGTSData($apiKey, $apiToken);
echo $response;
?>
import requests
import json
def insert_fgts_data(api_key, api_token):
url = ‘https://sandbox-api.workbankvirtual.com.br/api/tegge/v1/fgts/insert’
headers = {
‘x-api-key’: api_key,
‘x-api-token’: api_token,
‘Content-Type’: ‘application/json’
}
payload = {
“id_rate”: 10,
“client”: {
“name”: “ENZO RODRIGUES FELICIAO DE SOUZA”,
“mother_name”: “JOANA DA SILVA”,
# Adicione os demais campos aqui
},
# Adicione os demais campos aqui
}
try:
response = requests.post(url, headers=headers, json=payload)
if response.ok:
return response.json()
else:
return f”Erro na requisição: {response.status_code}”
except requests.RequestException as e:
return f”Erro na requisição: {str(e)}”
# Substitua ‘sua_chave_publica’ e ‘seu_token’ pelos valores reais
api_key = ‘sua_chave_publica’
api_token = ‘seu_token’
result = insert_fgts_data(api_key, api_token)
print(result)
Consulta de Propostas
GEThttps://sandbox-api.workbankvirtual.com.br/api/tegge/v1/proposal
–header ‘x-api-token: <chave_publica>’
–header ‘x-api-key: <token>’
{
private readonly string _baseUrl = “https://sandbox-api.workbankvirtual.com.br”;
private readonly string _publicKey = “<chave_publica>”; // Substitua com sua chave pública
private readonly string _apiKey = “<token>”; // Substitua com seu token
private readonly HttpClient _client;
public ProposalController()
{
_client = new HttpClient { BaseAddress = new Uri(_baseUrl) };
_client.DefaultRequestHeaders.Add(“x-api-token”, _publicKey);
_client.DefaultRequestHeaders.Add(“x-api-key”, _apiKey);
}
{
try
{
string url = $”/api/tegge/v1/proposal?startDate={Uri.EscapeDataString(startDate)}&endDate={Uri.EscapeDataString(endDate)}”;
HttpResponseMessage response = await _client.GetAsync(url);
if (response.IsSuccessStatusCode)
{
string responseBody = await response.Content.ReadAsStringAsync();
return Ok(responseBody);
}
else
{
return StatusCode((int)response.StatusCode, $”Falha na solicitação: {response.StatusCode} – {response.ReasonPhrase}”);
}
}
catch (Exception ex)
{
return BadRequest($”Erro ao fazer a solicitação: {ex.Message}”);
}
}
}
<?php
$baseUrl = ‘https://sandbox-api.workbankvirtual.com.br’;
$publicKey = ‘<chave_publica>’; // Substitua com sua chave pública
$apiKey = ‘<token>’; // Substitua com seu token
$startDate = urlencode(‘<data_inicio>’); // Substitua com a data de início desejada
$endDate = urlencode(‘<data_fim>’); // Substitua com a data de fim desejada
$url = “{$baseUrl}/api/tegge/v1/proposal?startDate={$startDate}&endDate={$endDate}”;
$headers = [
‘http’ => [
‘method’ => ‘GET’,
‘header’ => “x-api-token: {$publicKey}rn” . “x-api-key: {$apiKey}rn”
]
];
$context = stream_context_create($headers);
$response = file_get_contents($url, false, $context);
if ($response !== false) {
echo “Resposta da API: ” . $response;
} else {
echo “Falha na solicitação”;
}
import urllib.request
base_url = ‘https://sandbox-api.workbankvirtual.com.br’
public_key = ‘<chave_publica>’ # Substitua com sua chave pública
api_key = ‘<token>’ # Substitua com seu token
start_date = ‘<data_inicio>’ # Substitua com a data de início desejada
end_date = ‘<data_fim>’ # Substitua com a data de fim desejada
url = f”{base_url}/api/tegge/v1/proposal?startDate={start_date}&endDate={end_date}”
headers = {
‘x-api-token’: public_key,
‘x-api-key’: api_key
}
req = urllib.request.Request(url, headers=headers)
try:
with urllib.request.urlopen(req) as response:
data = response.read()
print(“Resposta da API:”, data.decode(‘utf-8’))
except urllib.error.HTTPError as e:
print(“Erro HTTP:”, e.code)
print(“Resposta:”, e.read().decode(‘utf-8’))
except urllib.error.URLError as e:
print(“Erro de URL:”, e.reason)