Ejemplos con Lenguajes
Ejemplos con PHP, JAVA y JavaScript
Crear empresa
curl --location --request POST
'https://www.facilwebnube.com/apidianv2/public/api/ubl2.1/config/{nit_empresa}/{digito_verificación}' \
--header 'Content-Type: application/json' \
--header 'cache-control: no-cache' \
--header 'Connection: keep-alive' \
--header 'Accept-Encoding: gzip, deflate' \
--header 'Host: localhost' \
--header 'accept: application/json' \
--header 'X-CSRF-TOKEN;' \
--data-raw '{
"type_document_identification_id": 6,
"type_organization_id": 1,
"type_regime_id": 1,
"type_liability_id": 117,
"business_name": "NOMBRE EMPRESA",
"merchant_registration": "0098151",
"municipality_id": 439,
"address": "CL 18A No. 11 - 20",
"phone": "00000000",
"email": "EMPRESA@dominio.com",
"id_administrator": 1,
"type_plan": 1,
"mail_host": "in-v3.mailjet.com",
"mail_port": "587",
"mail_username": "email_empresa@dominio.com",
"mail_password": "dbc30602d6e6f15ce2d82fc58ed2b9e6",
"mail_encryption": "tls"
}'
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n
\"type_document_identification_id\": 6,\r\n \"type_organization_id\": 1,\r\n \"type_regime_id\":
1,\r\n \"type_liability_id\": 117,\r\n \"business_name\": \"NOMBRE EMPRESA\",\r\n
\"merchant_registration\": \"0098151\",\r\n \"municipality_id\": 439,\r\n \"address\": \"CL 18A No.
11 - 20\",\r\n \"phone\": \"3106031839\", \r\n \"email\": \"EMPRESA@dominio.com\",\r\n
\"id_administrator\": 1,\r\n \"type_plan\": 1,\r\n \"mail_host\": \"in-v3.mailjet.com\",\r\n
\"mail_port\": \"587\",\r\n \"mail_username\": \"email_empresa@dominio.com\",\r\n
\"mail_password\": \"dbc30602d6e6f15ce2d82fc58ed2b9e6\",\r\n \"mail_encryption\": \"tls\"\r\n}");
Request request = new Request.Builder()
.url("https://www.facilwebnube.com/apidianv2/public/api/ubl2.1/config/{nit_empresa}/{digito_verificación}")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("cache-control", "no-cache")
.addHeader("Connection", "keep-alive")
.addHeader("Accept-Encoding", "gzip, deflate")
.addHeader("Host", "localhost")
.addHeader("accept", "application/json")
.addHeader("X-CSRF-TOKEN", "")
.build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("cache-control", "no-cache");
myHeaders.append("Connection", "keep-alive");
myHeaders.append("Accept-Encoding", "gzip, deflate");
myHeaders.append("Host", "api.dominio.com");
myHeaders.append("accept", "application/json");
myHeaders.append("X-CSRF-TOKEN", "");
var raw = JSON.stringify({
"type_document_identification_id": 6,
"type_organization_id": 1,
"type_regime_id": 1,
"type_liability_id": 117,
"business_name": "NOMBRE EMPRESA",
"merchant_registration": "0098151",
"municipality_id": 439,
"address": "CL 18A No. 11 - 20",
"phone": "3106031839",
"email": "EMPRESA@dominio.com",
"id_administrator": 1,
"type_plan": 1,
"mail_host": "in-v3.mailjet.com",
"mail_port": "587",
"mail_username": "email_empresa@dominio.com",
"mail_password": "dbc30602d6e6f15ce2d82fc58ed2b9e6",
"mail_encryption": "tls"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://www.facilwebnube.com/apidianv2/public/api/ubl2.1/config/{nit_empresa}/{digito_verificación}",
requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Configurar Software
curl --location --request PUT 'https://www.facilwebnube.com/apidianv2/public/api/ubl2.1/config/software' \
--header 'Content-Type: application/json' \
--header 'cache-control: no-cache' \
--header 'Connection: keep-alive' \
--header 'Accept-Encoding: gzip, deflate' \
--header 'Host: api.dominio.com' \
--header 'accept: application/json' \
--header 'X-CSRF-TOKEN;' \
--header 'Authorization: Bearer
29ad340917079f5bf493d770882d70cd02b8c512f78c6e8b4da9401d8225fe42' \
--data-raw '{
"id": "941a4aec-3e39-4162-9274-96c0f6fb8bb8",
"pin": 12345
}'
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"id\":
\"941a4aec-3e39-4162-9274-96c0f6fb8bb8\",\r\n \"pin\": 12345\r\n}");
Request request = new Request.Builder()
.url("https://www.facilwebnube.com/apidianv2/public/api/ubl2.1/config/software")
.method("PUT", body)
.addHeader("Content-Type", "application/json")
.addHeader("cache-control", "no-cache")
.addHeader("Connection", "keep-alive")
.addHeader("Accept-Encoding", "gzip, deflate")
.addHeader("Host", "api.dominio.com")
.addHeader("accept", "application/json")
.addHeader("X-CSRF-TOKEN", "")
.addHeader("Authorization", "Bearer
29ad340917079f5bf493d770882d70cd02b8c512f78c6e8b4da9401d8225fe42")
.build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append ("Content-Type", "application/json");
myHeaders.append ("cache-control", "no-cache");
myHeaders.append ("Connection", "keep-alive");
myHeaders.append ("Accept-Encoding", "gzip, deflate");
myHeaders.append ("Host", "api.dominio.com");
myHeaders.append ("accept", "application/json");
myHeaders.append ("X-CSRF-TOKEN", "");
myHeaders.append ("Authorization", "Bearer
29ad340917079f5bf493d770882d70cd02b8c512f78c6e8b4da9401d8225fe42");
var raw = JSON.stringify({
"id": "941a4aec-3e39-4162-9274-96c0f6fb8bb8",
"pin": 12345
});
var requestOptions = {
method: 'PUT',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://www.facilwebnube.com/apidianv2/public/api/ubl2.1/config/software", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Configurar Certificado
curl --location --request PUT 'https://www.facilwebnube.com/apidianv2/public/api/ubl2.1/config/certificate'
\
--header 'Content-Type: application/json' \
--header 'cache-control: no-cache' \
--header 'Connection: keep-alive' \
--header 'Accept-Encoding: gzip, deflate' \
--header 'Host: api.dominio.com' \
--header 'accept: application/json' \
--header 'X-CSRF-TOKEN;' \
--header 'Authorization: Bearer
29ad340917079f5bf493d770882d70cd02b8c512f78c6e8b4da9401d8225fe42' \
--data-raw '{
"certificate": "",
"password": ""
}'
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"certificate\": \"\",\r\n
\"password\": \"\"\r\n}");
Request request = new Request.Builder()
.url("https://www.facilwebnube.com/apidianv2/public/api/ubl2.1/config/certificate")
.method("PUT", body)
.addHeader("Content-Type", "application/json")
.addHeader("cache-control", "no-cache")
.addHeader("Connection", "keep-alive")
.addHeader("Accept-Encoding", "gzip, deflate")
.addHeader("Host", "api.dominio.com")
.addHeader("accept", "application/json")
.addHeader("X-CSRF-TOKEN", "")
.addHeader("Authorization", "Bearer
29ad340917079f5bf493d770882d70cd02b8c512f78c6e8b4da9401d8225fe42")
.build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("cache-control", "no-cache");
myHeaders.append("Connection", "keep-alive");
myHeaders.append("Accept-Encoding", "gzip, deflate");
myHeaders.append("Host", "api.dominio.com");
myHeaders.append("accept", "application/json");
myHeaders.append("X-CSRF-TOKEN", "");
myHeaders.append("Authorization", "Bearer
29ad340917079f5bf493d770882d70cd02b8c512f78c6e8b4da9401d8225fe42");
var raw = JSON.stringify({
"certificate": "",
"password": ""
});
var requestOptions = {
method: 'PUT',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://www.facilwebnube.com/apidianv2/public/api/ubl2.1/config/certificate", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Configurar Resoluciones
curl --location --request PUT 'https://www.facilwebnube.com/apidianv2/public/api/ubl2.1/config/resolution'
\
--header 'Content-Type: application/json' \
--header 'accept: application/json' \
--header 'Authorization: Bearer
29ad340917079f5bf493d770882d70cd02b8c512f78c6e8b4da9401d8225fe42' \
--data-raw '{
"type_document_id": 1,
"prefix": "",
"resolution": "",
"resolution_date": "",
"technical_key": "",
"from": ,
"to": ,
"generated_to_date": 0,
"date_from": "",
"date_to": ""
}'
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"type_document_id\": 1,\r\n
\"prefix\": \"\",\r\n \"resolution\": \"\",\r\n \"resolution_date\": \"\",\r\n \"technical_key\":
\"\",\r\n \"from\": ,\r\n \"to\": ,\r\n \"generated_to_date\": 0,\r\n \"date_from\": \"\",\r\n
\"date_to\": \"\"\r\n}");
Request request = new Request.Builder()
.url("https://www.facilwebnube.com/apidianv2/public/api/ubl2.1/config/resolution")
.method("PUT", body)
.addHeader("Content-Type", "application/json")
.addHeader("accept", "application/json")
.addHeader("Authorization", "Bearer
29ad340917079f5bf493d770882d70cd02b8c512f78c6e8b4da9401d8225fe42")
.build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("accept", "application/json");
myHeaders.append("Authorization", "Bearer
29ad340917079f5bf493d770882d70cd02b8c512f78c6e8b4da9401d8225fe42");
var raw = "{\r\n \"type_document_id\": 1,\r\n \"prefix\": \"\",\r\n \"resolution\":
\"\",\r\n
\"resolution_date\": \"\",\r\n \"technical_key\": \"\",\r\n \"from\": ,\r\n \"to\": ,\r\n
\"generated_to_date\": 0,\r\n \"date_from\": \"\",\r\n \"date_to\": \"\"\r\n}";
var requestOptions = {
method: 'PUT',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://www.facilwebnube.com/apidianv2/public/api/ubl2.1/config/resolution", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Crear factura
curl --location --request POST 'https://www.facilwebnube.com/apidianv2/public/api/ubl2.1/invoice' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'host: apidian2022.oo' \
--header 'Authorization: Bearer
7692a20fec92af0aa5729d796b019d27c83c9955407994630a0cdd7702ca2329' \
--data-raw '{
"number": 990000520,
"type_document_id": 1,
"date": "2022-04-21",
"time": "04:08:12",
"resolution_number": "18760000001",
"prefix": "SETP",
"notes": "ESTA ES UNA NOTA DE PRUEBA, ESTA ES UNA NOTA DE PRUEBA",
"disable_confirmation_text": true,
"establishment_name": "EMPRESA S.A.S",
"establishment_address": "BRR LIMONAR MZ 6 CS 3 ET 1 PISO 2",
"establishment_phone": "3226563672",
"establishment_municipality": 600,
"establishment_email": "alternate_email@alternate.com",
"sendmail": true,
"sendmailtome": true,
"send_customer_credentials": false,
"seze": "2021-2017",
"email_cc_list": [
{
"email": "emailone@gmail.com"
},
{
"email": "emailtwo@hotmail.com"
}
],
"annexes": [
{
"document": "",
"extension": "jpg"
}
],
"head_note": "PRUEBA DE TEXTO LIBRE QUE DEBE POSICIONARSE EN EL ENCABEZADO DE PAGINA DE
LA REPRESENTACION GRAFICA DE LA FACTURA ELECTRONICA VALIDACION PREVIA DIAN",
"foot_note": "PRUEBA DE TEXTO LIBRE QUE DEBE POSICIONARSE EN EL PIE DE PAGINA DE LA
REPRESENTACION GRAFICA DE LA FACTURA ELECTRONICA VALIDACION PREVIA DIAN",
"customer": {
"identification_number": 89008003,
"dv": 2,
"name": "EMPRESA S.A.S",
"phone": 3017882489,
"address": "CLL 4 NRO 33-90",
"email": "email_cliente@dominio.com",
"merchant_registration": "0000000-00",
"type_document_identification_id": 6,
"type_organization_id": 1,
"type_liability_id": 7,
"municipality_id": 439,
"type_regime_id": 1
},
"payment_form": {
"payment_form_id": 2,
"payment_method_id": 30,
"payment_due_date": "2022-05-21",
"duration_measure": "30"
},
"legal_monetary_totals": {
"line_extension_amount": "840336.134",
"tax_exclusive_amount": "840336.134",
"tax_inclusive_amount": "1000000.00",
"payable_amount": "1000000.00"
},
"tax_totals":
[
{
"tax_id": 1,
"tax_amount": "159663.865",
"percent": "19.00",
"taxable_amount": "840336.134"
}
],
"invoice_lines":
[
{
"unit_measure_id": 70,
"invoiced_quantity": "1",
"line_extension_amount": "840336.134",
"free_of_charge_indicator": false,
"tax_totals": [
{
"tax_id": 1,
"tax_amount": "159663.865",
"taxable_amount": "840336.134",
"percent": "19.00"
}
],
"description": "COMISION POR SERVICIOS",
"notes": "ESTA ES UNA PRUEBA DE NOTA DE DETALLE DE LINEA.",
"code": "COMISION",
"type_item_identification_id": 4,
"price_amount": "1000000.00",
"base_quantity": "1"
}
]
}'
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n\t\"number\":
990000520,\r\n\t\"type_document_id\": 1,\r\n\t\"date\": \"2022-04-21\",\r\n\t\"time\":
\"04:08:12\",\r\n\t\"resolution_number\": \"18760000001\",\r\n\t\"prefix\": \"SETP\",\r\n \"notes\":
\"ESTA ES UNA NOTA DE PRUEBA, ESTA ES UNA NOTA DE PRUEBA\",\r\n \"disable_confirmation_text\":
true,\r\n \"establishment_name\": \"EMPRESA S.A.S\",\r\n \"establishment_address\": \"BRR LIMONAR
MZ 6 CS 3 ET 1 PISO 2\",\r\n \"establishment_phone\": \"3226563672\",\r\n
\"establishment_municipality\": 600,\r\n \"establishment_email\":
\"alternate_email@alternate.com\",\r\n\t\"sendmail\": true,\r\n \"sendmailtome\": true,\r\n
\"send_customer_credentials\": false,\r\n \"seze\": \"2021-2017\",\r\n \"email_cc_list\": [\r\n
{\r\n \"email\": \"emailone@gmail.com\"\r\n },\r\n {\r\n \"email\": \"emailtwo@hotmail.com\"\r\n
}\r\n ],\r\n \"annexes\": [\r\n {\r\n \"document\": \"\",\r\n \"extension\": \"jpg\"\r\n }\r\n
],\r\n \r\n \"head_note\": \"PRUEBA DE TEXTO LIBRE QUE DEBE POSICIONARSE EN EL ENCABEZADO DE PAGINA
DE LA REPRESENTACION GRAFICA DE LA FACTURA ELECTRONICA VALIDACION PREVIA DIAN\",\r\n \"foot_note\":
\"PRUEBA DE TEXTO LIBRE QUE DEBE POSICIONARSE EN EL PIE DE PAGINA DE LA REPRESENTACION GRAFICA DE LA
FACTURA ELECTRONICA VALIDACION PREVIA DIAN\",\r\n\t\"customer\": {\r\n\t\t\"identification_number\":
89008003,\r\n\t\t\"dv\": 2,\r\n\t\t\"name\": \"EMPRESA S.A.S\",\r\n\t\t\"phone\":
3017882489,\r\n\t\t\"address\": \"CLL 4 NRO 33-90\",\r\n\t\t\"email\":
\"email_cliente@dominio.com\",\r\n\t\t\"merchant_registration\":
\"0000000-00\",\r\n\t\t\"type_document_identification_id\": 6,\r\n\t\t\"type_organization_id\":
1,\r\n \"type_liability_id\": 7,\r\n\t\t\"municipality_id\": 439,\r\n\t\t\"type_regime_id\":
1\r\n\t},\r\n\t\"payment_form\": {\r\n\t\t\"payment_form_id\": 2,\r\n\t\t\"payment_method_id\":
30,\r\n\t\t\"payment_due_date\": \"2022-05-21\",\r\n\t\t\"duration_measure\":
\"30\"\r\n\t},\t\r\n\t\"legal_monetary_totals\": {\r\n\t\t\"line_extension_amount\":
\"840336.134\",\r\n\t\t\"tax_exclusive_amount\": \"840336.134\",\r\n\t\t\"tax_inclusive_amount\":
\"1000000.00\",\r\n\t\t\"payable_amount\": \"1000000.00\"\r\n\t},\r\n\t\"tax_totals\":
\r\n\t[\r\n\t\t{\r\n\t\t\t\"tax_id\": 1,\r\n\t\t\t\"tax_amount\":
\"159663.865\",\r\n\t\t\t\"percent\": \"19.00\",\r\n\t\t\t\"taxable_amount\":
\"840336.134\"\r\n\t\t}\r\n\t],\r\n\t\"invoice_lines\":
\r\n\t[\r\n\t\t{\r\n\t\t\t\"unit_measure_id\": 70,\r\n\t\t\t\"invoiced_quantity\":
\"1\",\r\n\t\t\t\"line_extension_amount\": \"840336.134\",\r\n\t\t\t\"free_of_charge_indicator\":
false,\r\n\t\t\t\"tax_totals\": [\r\n\t\t\t\t{\r\n\t\t\t\t\t\"tax_id\":
1,\r\n\t\t\t\t\t\"tax_amount\": \"159663.865\",\r\n\t\t\t\t\t\"taxable_amount\":
\"840336.134\",\r\n\t\t\t\t\t\"percent\":
\"19.00\"\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t\t\"description\": \"COMISION POR SERVICIOS\",\r\n
\"notes\": \"ESTA ES UNA PRUEBA DE NOTA DE DETALLE DE LINEA.\",\r\n\t\t\t\"code\":
\"COMISION\",\r\n\t\t\t\"type_item_identification_id\": 4,\r\n\t\t\t\"price_amount\":
\"1000000.00\",\r\n\t\t\t\"base_quantity\": \"1\"\r\n\t\t}\r\n\t]\r\n}\r\n\r\n");
Request request = new Request.Builder()
.url("https://www.facilwebnube.com/apidianv2/public/api/ubl2.1/invoice")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.addHeader("host", "apidian2022.oo")
.addHeader("Authorization", "Bearer
7692a20fec92af0aa5729d796b019d27c83c9955407994630a0cdd7702ca2329")
.build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Accept", "application/json");
myHeaders.append("host", "apidian2022.oo");
myHeaders.append("Authorization", "Bearer
7692a20fec92af0aa5729d796b019d27c83c9955407994630a0cdd7702ca2329");
var raw = JSON.stringify({
"number": 990000520,
"type_document_id": 1,
"date": "2022-04-21",
"time": "04:08:12",
"resolution_number": "18760000001",
"prefix": "SETP",
"notes": "ESTA ES UNA NOTA DE PRUEBA, ESTA ES UNA NOTA DE PRUEBA",
"disable_confirmation_text": true,
"establishment_name": "EMPRESA S.A.S",
"establishment_address": "BRR LIMONAR MZ 6 CS 3 ET 1 PISO 2",
"establishment_phone": "3226563672",
"establishment_municipality": 600,
"establishment_email": "alternate_email@alternate.com",
"sendmail": true,
"sendmailtome": true,
"send_customer_credentials": false,
"seze": "2021-2017",
"email_cc_list": [
{
"email": "emailone@gmail.com"
},
{
"email": "emailtwo@hotmail.com"
}
],
"annexes": [
{
"document": "",
"extension": "jpg"
}
],
"head_note": "PRUEBA DE TEXTO LIBRE QUE DEBE POSICIONARSE EN EL ENCABEZADO DE PAGINA DE
LA REPRESENTACION GRAFICA DE LA FACTURA ELECTRONICA VALIDACION PREVIA DIAN",
"foot_note": "PRUEBA DE TEXTO LIBRE QUE DEBE POSICIONARSE EN EL PIE DE PAGINA DE LA
REPRESENTACION GRAFICA DE LA FACTURA ELECTRONICA VALIDACION PREVIA DIAN",
"customer": {
"identification_number": 89008003,
"dv": 2,
"name": "EMPRESA S.A.S",
"phone": 3017882489,
"address": "CLL 4 NRO 33-90",
"email": "email_cliente@dominio.com",
"merchant_registration": "0000000-00",
"type_document_identification_id": 6,
"type_organization_id": 1,
"type_liability_id": 7,
"municipality_id": 439,
"type_regime_id": 1
},
"payment_form": {
"payment_form_id": 2,
"payment_method_id": 30,
"payment_due_date": "2022-05-21",
"duration_measure": "30"
},
"legal_monetary_totals": {
"line_extension_amount": "840336.134",
"tax_exclusive_amount": "840336.134",
"tax_inclusive_amount": "1000000.00",
"payable_amount": "1000000.00"
},
"tax_totals": [
{
"tax_id": 1,
"tax_amount": "159663.865",
"percent": "19.00",
"taxable_amount": "840336.134"
}
],
"invoice_lines": [
{
"unit_measure_id": 70,
"invoiced_quantity": "1",
"line_extension_amount": "840336.134",
"free_of_charge_indicator": false,
"tax_totals": [
{
"tax_id": 1,
"tax_amount": "159663.865",
"taxable_amount": "840336.134",
"percent": "19.00"
}
],
"description": "COMISION POR SERVICIOS",
"notes": "ESTA ES UNA PRUEBA DE NOTA DE DETALLE DE LINEA.",
"code": "COMISION",
"type_item_identification_id": 4,
"price_amount": "1000000.00",
"base_quantity": "1"
}
]
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://www.facilwebnube.com/apidianv2/public/api/ubl2.1/invoice", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Crear Nota Crédito
curl --location --request POST 'https://www.facilwebnube.com/apidianv2/public/api/ubl2.1/credit-note' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer
7692a20fec92af0aa5729d796b019d27c83c9955407994630a0cdd7702ca2329' \
--data-raw '{
"billing_reference": {
"number": "SETP990000500",
"uuid":
"61cd37301a04c9561a7bad16e1e3ac26d12c89c90ca2684ca4af943b599ea3bb6e8ad1b505801b232e4ab67c5107a048",
"issue_date": "2022-03-17"
},
"discrepancyresponsecode": 2,
"discrepancyresponsedescription": "PRUEBA DE MOTIVO NOTA CREDITO",
"notes": "PRUEBA DE NOTA CREDITO",
"resolution_number": "0000000000",
"prefix": "NC",
"number": 52,
"type_document_id": 4,
"date": "2022-03-25",
"time": "06:00:13",
"establishment_name": "EMPRESA S.A.S",
"establishment_address": "BRR LIMONAR MZ 6 CS 3 ET 1 PISO 2",
"establishment_phone": "3226563672",
"establishment_municipality": 600,
"sendmail": true,
"sendmailtome": true,
"seze": "2021-2017",
"head_note": "PRUEBA DE TEXTO LIBRE QUE DEBE POSICIONARSE EN EL ENCABEZADO DE PAGINA DE
LA REPRESENTACION GRAFICA DE LA FACTURA ELECTRONICA VALIDACION PREVIA DIAN",
"foot_note": "PRUEBA DE TEXTO LIBRE QUE DEBE POSICIONARSE EN EL ENCABEZADO DE PAGINA DE
LA REPRESENTACION GRAFICA DE LA FACTURA ELECTRONICA VALIDACION PREVIA DIAN",
"customer": {
"identification_number": 901249232,
"dv": 1,
"name": "EMPRESA S.A.S",
"phone": 3017882489,
"address": "CLL 4 NRO 33-90",
"email": "email_cliente@dominio.com",
"merchant_registration": "0000000-00",
"type_document_identification_id": 6,
"type_organization_id": 1,
"municipality_id": 439,
"type_regime_id": 1
},
"tax_totals": [
{
"tax_id": 1,
"tax_amount": "159663.865",
"percent": "19",
"taxable_amount": "840336.134"
}
],
"legal_monetary_totals": {
"line_extension_amount": "840336.134",
"tax_exclusive_amount": "840336.134",
"tax_inclusive_amount": "1000000.00",
"payable_amount": "1000000.00"
},
"credit_note_lines":
[
{
"unit_measure_id": 70,
"invoiced_quantity": "1",
"line_extension_amount": "840336.134",
"free_of_charge_indicator": false,
"tax_totals": [
{
"tax_id": 1,
"tax_amount": "159663.865",
"taxable_amount": "840336.134",
"percent": "19.00"
}
],
"description": "COMISION POR SERVICIOS",
"notes": "ESTA ES UNA PRUEBA DE NOTA DE DETALLE DE LINEA.",
"code": "COMISION",
"type_item_identification_id": 4,
"price_amount": "840336.134",
"base_quantity": "1"
}
]
}'
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n\t\"billing_reference\":
{\r\n\t\t\"number\": \"SETP990000500\",\r\n\t\t\"uuid\":
\"61cd37301a04c9561a7bad16e1e3ac26d12c89c90ca2684ca4af943b599ea3bb6e8ad1b505801b232e4ab67c5107a048\",\r\n\t\t\"issue_date\":
\"2022-03-17\"\r\n\t},\r\n\t\"discrepancyresponsecode\": 2,\r\n\t\"discrepancyresponsedescription\":
\"PRUEBA DE MOTIVO NOTA CREDITO\",\r\n \"notes\": \"PRUEBA DE NOTA CREDITO\",\r\n
\"resolution_number\": \"0000000000\",\r\n \"prefix\": \"NC\",\r\n\t\"number\":
52,\r\n\t\"type_document_id\": 4,\r\n\t\"date\": \"2022-03-25\",\r\n\t\"time\": \"06:00:13\",\r\n
\"establishment_name\": \"EMPRESA S.A.S\",\r\n \"establishment_address\": \"BRR LIMONAR MZ 6 CS 3
ET 1 PISO 2\",\r\n \"establishment_phone\": \"3226563672\",\r\n \"establishment_municipality\":
600,\r\n \"sendmail\": true,\r\n \"sendmailtome\": true,\r\n \"seze\": \"2021-2017\",\r\n
\"head_note\": \"PRUEBA DE TEXTO LIBRE QUE DEBE POSICIONARSE EN EL ENCABEZADO DE PAGINA DE LA
REPRESENTACION GRAFICA DE LA FACTURA ELECTRONICA VALIDACION PREVIA DIAN\",\r\n \"foot_note\":
\"PRUEBA DE TEXTO LIBRE QUE DEBE POSICIONARSE EN EL ENCABEZADO DE PAGINA DE LA REPRESENTACION
GRAFICA DE LA FACTURA ELECTRONICA VALIDACION PREVIA DIAN\",\r\n\t\"customer\":
{\r\n\t\t\"identification_number\": 901249232,\r\n\t\t\"dv\": 1,\r\n\t\t\"name\": \"INVERSIONES
DAVAL SAS\",\r\n\t\t\"phone\": 3017882489,\r\n\t\t\"address\": \"CLL 4 NRO
33-90\",\r\n\t\t\"email\": \"email_cliente@dominio.com\",\r\n\t\t\"merchant_registration\":
\"0000000-00\",\r\n\t\t\"type_document_identification_id\": 6,\r\n\t\t\"type_organization_id\":
1,\r\n\t\t\"municipality_id\": 439,\r\n\t\t\"type_regime_id\": 1\r\n\t},\r\n\t\"tax_totals\":
[\r\n\t\t{\r\n\t\t\t\"tax_id\": 1,\r\n\t\t\t\"tax_amount\": \"159663.865\",\r\n\t\t\t\"percent\":
\"19\",\r\n\t\t\t\"taxable_amount\": \"840336.134\"\r\n\t\t}\r\n\t],\r\n\t\"legal_monetary_totals\":
{\r\n\t\t\"line_extension_amount\": \"840336.134\",\r\n\t\t\"tax_exclusive_amount\":
\"840336.134\",\r\n\t\t\"tax_inclusive_amount\": \"1000000.00\",\r\n\t\t\"payable_amount\":
\"1000000.00\"\r\n\t},\r\n\t\"credit_note_lines\": \r\n\t[\r\n\t\t{\r\n\t\t\t\"unit_measure_id\":
70,\r\n\t\t\t\"invoiced_quantity\": \"1\",\r\n\t\t\t\"line_extension_amount\":
\"840336.134\",\r\n\t\t\t\"free_of_charge_indicator\": false,\r\n\t\t\t\"tax_totals\":
[\r\n\t\t\t\t{\r\n\t\t\t\t\t\"tax_id\": 1,\r\n\t\t\t\t\t\"tax_amount\":
\"159663.865\",\r\n\t\t\t\t\t\"taxable_amount\": \"840336.134\",\r\n\t\t\t\t\t\"percent\":
\"19.00\"\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t\t\"description\": \"COMISION POR SERVICIOS\",\r\n
\"notes\": \"ESTA ES UNA PRUEBA DE NOTA DE DETALLE DE LINEA.\",\r\n\t\t\t\"code\":
\"COMISION\",\r\n\t\t\t\"type_item_identification_id\": 4,\r\n\t\t\t\"price_amount\":
\"840336.134\",\r\n\t\t\t\"base_quantity\": \"1\"\r\n\t\t}\r\n\t]\r\n}\r\n\r\n");
Request request = new Request.Builder()
.url("https://www.facilwebnube.com/apidianv2/public/api/ubl2.1/credit-note")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer
7692a20fec92af0aa5729d796b019d27c83c9955407994630a0cdd7702ca2329")
.build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Accept", "application/json");
myHeaders.append("Authorization", "Bearer
7692a20fec92af0aa5729d796b019d27c83c9955407994630a0cdd7702ca2329");
var raw = JSON.stringify({
"billing_reference": {
"number": "SETP990000500",
"uuid":
"61cd37301a04c9561a7bad16e1e3ac26d12c89c90ca2684ca4af943b599ea3bb6e8ad1b505801b232e4ab67c5107a048",
"issue_date": "2022-03-17"
},
"discrepancyresponsecode": 2,
"discrepancyresponsedescription": "PRUEBA DE MOTIVO NOTA CREDITO",
"notes": "PRUEBA DE NOTA CREDITO",
"resolution_number": "0000000000",
"prefix": "NC",
"number": 52,
"type_document_id": 4,
"date": "2022-03-25",
"time": "06:00:13",
"establishment_name": "EMPRESA S.A.S",
"establishment_address": "BRR LIMONAR MZ 6 CS 3 ET 1 PISO 2",
"establishment_phone": "3226563672",
"establishment_municipality": 600,
"sendmail": true,
"sendmailtome": true,
"seze": "2021-2017",
"head_note": "PRUEBA DE TEXTO LIBRE QUE DEBE POSICIONARSE EN EL ENCABEZADO DE PAGINA DE
LA REPRESENTACION GRAFICA DE LA FACTURA ELECTRONICA VALIDACION PREVIA DIAN",
"foot_note": "PRUEBA DE TEXTO LIBRE QUE DEBE POSICIONARSE EN EL ENCABEZADO DE PAGINA DE
LA REPRESENTACION GRAFICA DE LA FACTURA ELECTRONICA VALIDACION PREVIA DIAN",
"customer": {
"identification_number": 901249232,
"dv": 1,
"name": "EMPRESA S.A.S",
"phone": 3017882489,
"address": "CLL 4 NRO 33-90",
"email": "email_cliente@dominio.com",
"merchant_registration": "0000000-00",
"type_document_identification_id": 6,
"type_organization_id": 1,
"municipality_id": 439,
"type_regime_id": 1
},
"tax_totals": [
{
"tax_id": 1,
"tax_amount": "159663.865",
"percent": "19",
"taxable_amount": "840336.134"
}
],
"legal_monetary_totals": {
"line_extension_amount": "840336.134",
"tax_exclusive_amount": "840336.134",
"tax_inclusive_amount": "1000000.00",
"payable_amount": "1000000.00"
},
"credit_note_lines": [
{
"unit_measure_id": 70,
"invoiced_quantity": "1",
"line_extension_amount": "840336.134",
"free_of_charge_indicator": false,
"tax_totals": [
{
"tax_id": 1,
"tax_amount": "159663.865",
"taxable_amount": "840336.134",
"percent": "19.00"
}
],
"description": "COMISION POR SERVICIOS",
"notes": "ESTA ES UNA PRUEBA DE NOTA DE DETALLE DE LINEA.",
"code": "COMISION",
"type_item_identification_id": 4,
"price_amount": "840336.134",
"base_quantity": "1"
}
]
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://www.facilwebnube.com/apidianv2/public/api/ubl2.1/credit-note", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Descargar Archivos (PDF - XML, ZIP Y Response DIAN)
Por defecto existen prefijos para el consumo de documentos, conocelos a continuación.
Siempre debera incluir el prefijo según el tipo de archivo a Descargar| Tipo de documento | Prefijo del sistema |
|---|---|
| PDF Facturas | FES- |
| PDF Nota debito | NDS- |
| PDF Nota credito | NCS- |
| XML | Attachment- |
| .ZIP | ZipAttachm- |
| Acuse DIAN | RptaFE- |
curl --location --request GET
'https://www.facilwebnube.com/apidianv2/public/api/ubl2.1/download/{nit_empresa}/{prefijo_del_sistema}{prefijo_resolution}{numero_del_documento}.{extension_del_archivo}'
\
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer
6a4f979ab89687b329a83d3fb3e2f33b8a45f77e9cf8f9012fa697ca07275216' \
--data-raw ''
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
Request request = new Request.Builder()
.url("https://www.facilwebnube.com/apidianv2/public/api/ubl2.1/download/{nit_empresa}/{prefijo_del_sistema}{prefijo_resolution}{numero_del_documento}.{extension_del_archivo}")
.method("GET", null)
("Content-Type", "application/json")
("Accept", "application/json")
("Authorization", "Bearer
6a4f979ab89687b329a83d3fb3e2f33b8a45f77e9cf8f9012fa697ca07275216")
.build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Accept", "application/json");
myHeaders.append("Authorization", "Bearer 6a4f979ab89687b329a83d3fb3e2f33b8a45f77e9cf8f9012fa697ca07275216");
var raw = "";
var requestOptions = {
method: 'GET',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://www.facilwebnube.com/apidianv2/public/api/ubl2.1/download/{nit_empresa}/{prefijo_del_sistema}{prefijo_resolution}{numero_del_documento}.{extension_del_archivo}", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Configurar Logo
curl --location --request PUT 'https://www.facilwebnube.com/apidianv2/public/api/ubl2.1/config/logo' \
--header 'Content-Type: application/json' \
--header 'cache-control: no-cache' \
--header 'Connection: keep-alive' \
--header 'Accept-Encoding: gzip, deflate' \
--header 'Host: api.dominio.com' \
--header 'accept: application/json' \
--header 'X-CSRF-TOKEN;' \
--header 'Authorization: Bearer
29ad340917079f5bf493d770882d70cd02b8c512f78c6e8b4da9401d8225fe42' \
--data-raw '{
"logo": ""
}
'
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n\t\"logo\": \"\"\r\n}\r\n");
Request request = new Request.Builder()
.url("https://www.facilwebnube.com/apidianv2/public/api/ubl2.1/config/logo")
.method("PUT", body)
.addHeader("Content-Type", "application/json")
.addHeader("cache-control", "no-cache")
.addHeader("Connection", "keep-alive")
.addHeader("Accept-Encoding", "gzip, deflate")
.addHeader("Host", "api.dominio.com")
.addHeader("accept", "application/json")
.addHeader("X-CSRF-TOKEN", "")
.addHeader("Authorization", "Bearer
29ad340917079f5bf493d770882d70cd02b8c512f78c6e8b4da9401d8225fe42")
.build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("cache-control", "no-cache");
myHeaders.append("Connection", "keep-alive");
myHeaders.append("Accept-Encoding", "gzip, deflate");
myHeaders.append("Host", "api.dominio.com");
myHeaders.append("accept", "application/json");
myHeaders.append("X-CSRF-TOKEN", "");
myHeaders.append("Authorization", "Bearer
49af49b8c512f78c6e8b4d3d77d340917079f5b0882d70cd02a9401d8225fe42");
var raw = JSON.stringify({
"logo": ""
});
var requestOptions = {
method: 'PUT',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://www.facilwebnube.com/apidianv2/public/api/ubl2.1/config/logo", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));