💡 Ejemplo completo
tip
El siguiente ejemplo es completo y funcional, incluye todas las tablas y propiedades necesarias. Puede copiarlo y probar su funcionamiento.
Ejemplo de tablas - [Expandir]
"tables": {
"bank_accounts": [
{
"bank_account_id": 1,
"name": "Cuenta Principal"
}
],
"banks": [
{
"bank_id": 1,
"name": "BBVA"
}
],
"brands": [
{
"brand_id": 1,
"name": "Procenex"
}
],
"categories": [
{
"category_id": 1,
"name": "Limpieza"
}
],
"clients": [
{
"client_id": 1,
"legal_name": "Cliente Test S.R.L",
"tax_condition_code": "iva_responsable_inscripto",
"identification": "30-11111111-5",
"payment_term_id": 1,
"address": "Calle 123",
"locality_id": 1,
"locality": "La Plata",
"postal_code": 1900,
"state_id": 1,
"state": "Buenos Aires",
"latitude": -34.92145,
"longitude": -57.95453,
"first_opening_time": "09:00",
"first_closing_time": "18:00",
"second_opening_time": null,
"second_closing_time": null,
"phone": "+54 011 555-555",
"email": "[email protected]",
"contact": "Juan Pérez",
"adjustment_type": "discount-percentage",
"adjustment_value": 10.00,
"zone_id": 1,
"sales_agent_id": 1,
"payment_collections_agent_id": 1,
"price_list_id": 1,
"ending_balance": 0.00,
"credit_limit": 50000.00,
"pending_clearance_amount": 0.00,
"last_sale_at": "2024-01-01T00:00:00-03:00",
"observations": "Oficinas en 1er piso",
}
],
"clients_debts": [
{
"client_debt_id": 1,
"client_id": 1,
"invoice_code": "AA-0001",
"invoice_created_at": "2024-01-01T00:00:00.000Z",
"invoice_due_date": "2024-02-01T00:00:00.000Z",
"description": "Factura pendiente",
"total_amount": 1000,
"paid_amount": 500
}
],
"payment_terms": [
{
"payment_term_id": 1,
"description": "CTA. CTE. 30 dÃas",
"adjustment_type": "discount-percentage",
"adjustment_value": 10.00,
"days_to_invoice_expiration": 30
}
],
"collections_agents": [
{
"collections_agent_id": 1,
"name": "Agente Cobrador Test"
}
],
"groups": [
{
"group_id": 1,
"name": "Grupo Test"
}
],
"localities": [
{
"locality_id": 1,
"name": "Localidad Test",
"state_id": 1,
"postal_code": "1234",
"phone_prefix": "341"
}
],
"price_lists": [
{
"price_list_id": 1,
"name": "Lista Test",
"include_iva": false
}
],
"prices": [
{
"price_id": 1,
"product_id": 1,
"price_list_id": 596,
"price": 150.56
}
],
"products": [
{
"product_id": 1,
"description": "Producto Test",
"group_id": 1,
"sub_group_id": 1,
"iva": 21,
"barcode": "7790001000001",
"stock": 100,
"brand_id": 1,
"category_id": 1,
"unit_type_id": 1,
"quantity_per_unit": 1,
"weight": 0,
"minimum_quantity_to_select": 0,
"default_discount": 10.00,
"maximum_discount": 20.00,
"price_multiplier": 1.00
}
],
"sales_agents": [
{
"sales_agent_id": 1,
"name": "Vendedor Test"
}
],
"states": [
{
"state_id": 1,
"name": "Estado Test"
}
],
"sub_groups": [
{
"sub_group_id": 1,
"group_id": 1,
"name": "SubGrupo Test"
}
],
"unit_types": [
{
"unit_type_id": 1,
"name": "Unidad"
}
],
"zones": [
{
"zone_id": 1,
"name": "Zona Norte"
}
]
}
- JS (Fetch)
Envió de registros (ejemplo)
const API_URL = 'http://api.meridianosoft.com.ar/api/v1/combined_resources/replace';
const API_TOKEN = 'su-token-privado';
const headers = new Headers();
headers.append('Content-Type', 'application/json');
headers.append('Authorization', `Bearer ${API_TOKEN}`);
const body = JSON.stringify({...}); // Ver ejemplo de tablas
const request_options = {
method: 'POST',
headers: headers,
body: body,
redirect: 'follow'
};
try {
const response = await fetch(API_URL, request_options);
const result = await response.json();
if(response.ok === false){
throw new Error(result.message);
}
console.log('¡Registros actualizados con éxito!');
} catch (error) {
console.error('Error al actualizar registros:', error.message);
}