Enviar nota débito
Modo producción
Enviar nota débito
POST
https://isv.aliaddo.net/api/v1/public/documents/invoice
Enviar una nota débito en modo producción a la DIAN.
Path Parameters
Name
Type
Description
version
string
Versión de la API
Headers
Name
Type
Description
x-api-key
string
Token generado previamente para autorizarse
Request Body
Name
Type
Description
isvInvoiceNoteDb
object
Objeto de la nota débito
{
"id": "string",
"mode": "string",
"format": "string",
"emailSender": "string",
"testSetId": "string",
"concept": "string",
"prefix": "string",
"consecutive": 0,
"sequence": "string",
"externalNumber": "string",
"currencyCode": "string",
"currencyRate": 0.0,
"date": "2020-01-30T00:00:00",
"dateStart": "2020-01-30T00:00:00",
"dateEnd": "2020-01-31T00:00:00",
"typeOfOperation": "string",
"terms": "string",
"remark": "string",
"observation": "string",
"cufe": "string",
"qr": "string",
"urlPdf": "string",
"urlXmlDocument": "string",
"urlXmlDocumentZip": "string",
"urlXmlApplicationResponse": "string",
"urlXmlAttachedDocument": "string",
"UrlPdfEncoded": "string",
"UrlXmlEncoded": "string",
"dianDeliveryStatus": "string",
"dianState": "string",
"dianStateReason": "string",
"dianStateDate": "0001-01-01T00:00:00",
"sentEmailAt": "0001-01-01T00:00:00",
"invoicePrefix": "string",
"invoiceConsecutive": 0.0,
"invoiceCufe": "string",
"invoiceDate": "2020-01-18T00:00:00",
"branch": {
"name": "string",
"address": "string",
"phone": "string",
"countryCode": "string",
"countryName": "string",
"departamentCode": "string",
"departamentName": "string",
"cityCode": "string",
"cityName": "string"
},
"resolution": {
"resolutionKey": "string",
"resolutionPrefix": "string",
"resolutionNumber": 0.0,
"resolutionRangeInitial": 0.0,
"resolutionRangeFinal": 0.0,
"resolutionValidFrom": "2019-01-19T00:00:00",
"resolutionValidUntil": "2030-01-19T00:00:00"
},
"customer": {
"companyName": "string",
"personType": "string",
"regimeType": "string",
"firstName": "string",
"lastName": "string",
"identification": "string",
"digitCheck": "string",
"identificationTypeCode": "string",
"email": "string",
"phone": "string",
"merchantRegistration": "string",
"responsibilities": "string",
"economicActivities": "string",
"billingAddress": "string",
"billingCountryName": "string",
"billingCountryCode": "string",
"billingRegionName": "string",
"billingRegionCode": "string",
"billingCityName": "string",
"billingCityCode": "string",
"billingPostalCode": "string",
"billingNeighborhood": "string",
"billingPhone": "string",
"billingContactName": "string",
"shippingAddress": "string",
"shippingCountryName": "string",
"shippingCountryCode": "string",
"shippingRegionName": "string",
"shippingRegionCode": "string",
"shippingCityName": "string",
"shippingCityCode": "string",
"shippingPostalCode": "string",
"shippingNeighborhood": "string",
"shippingPhone": "string",
"shippingContactName": "string"
},
"invoiceNoteDetails": [{
"standardType": "string",
"standardCode": "string",
"itemCode": "string",
"itemName": "string",
"itemModel": "string",
"description": "string",
"brandName": "string",
"itemCodeSupplier": "string",
"isPresent": false,
"unitMeasurementCode": "string",
"unitMeasurementName": "string",
"price": 0.0,
"quantity": 0.0,
"discountAmount": 0.0,
"chargeAmount": 0.0,
"subTotal": 0.0,
"priceWithAllowanceCharge": 0.0,
"totalWithAllowanceCharge": 0.0,
"discounts": [{
"name": "string",
"type": "string",
"rate": 0.0,
"amount": 0.0
}],
"charges": [{
"name": "string",
"type": "string",
"rate": 0.0,
"amount": 0.0
}],
"taxes": [{
"name": "string",
"code": "string",
"type": "string",
"rate": 0.0,
"amount": 0.0,
"base": 0.0
}],
"withholdings": [{
"name": "string",
"code": "string",
"type": "string",
"rate": 0.0,
"amount": 0.0,
"base": 0.0
}],
"isvMandante": {
"name": "string",
"identification": "string",
"digitCheck": "string",
"identificationTypeCode": "string"
}
}],
"totals": {
"amount": 0.0,
"prepaymentAmount": 0.0,
"taxesAmount": 0.0,
"withholdingAmount": 0.0,
"discountsAmount": 0.0,
"chargesAmount": 0.0
},
"discounts": [{
"name": "string",
"type": "string",
"rate": 0.0,
"amount": 0.0
}],
"charges": [{
"name": "string",
"type": "string",
"rate": 0.0,
"amount": 0.0
}],
"customFields": [{
"key": "string",
"value": "string"
}],
"invoiceConsecutiveWithPrefix": "string"
}
No se encontraron resultados de acuerdo a los criterios de busqueda
No se han enviado los tipos de datos requeridos
No esta autorizado para realizar el requerimiento a este metodo, debe enviar el token generado en el token
Se ha producido un incidente al validar el documento
Código de ejemplo
using RestSharp;
using System;
using Newtonsoft.Json;
class Program
{
public static void Main()
{
/**
- Enviar una nota débito en modo producción
- Instale RestSharp via Nuget: Install-Package RestSharp -Version 106.6.10
- Instale Newtonsoft via Nuget: Install-Package Newtonsoft.Json
*/
// Realizar request por metodo POST
var request = new RestRequest("/notes-db", Method.POST);
// Limpiar parametros
request.Parameters.Clear();
// Adicionar cabeceras de autenticación con token Bearer generado en el panel izquierdo
request.AddHeader("x-api-key", "{{x-api-key}}");
// Tipo de requerimiento formato json
request.AddHeader("content-type", "application/json");
request.AddHeader("cache-control", "no-cache");
request.AddHeader("accept", "application/json");
request.RequestFormat = DataFormat.Json;
// Adicionando objeto nota débito con resolución ejemplo
var isvInvoiceNoteDb = new
{
format = "Estandar",
emailSender = "",
concept = "1",
consecutive = 990000003,
externalNumber = "",
currencyCode = "COP",
currencyRate = 0,
date = "2020-1-18",
dateStart = "2020-1-18",
dateEnd = "2020-1-20",
typeOfOperation = "01",
terms = "",
remark = "",
observation = "",
invoicePrefix = "inv",
invoiceConsecutive = 990004331,
invoiceCufe = "aa2a047694318e5035cd93b3ffd5a12b829654c144b7cac0ac85ca5c0cb0430cfa3b477c4f7a75cf73f03f002f169162",
invoiceDate = "2020-1-18",
branch = new
{
name = "Sucursal",
address = "KR con CLL",
phone = "000000",
countryCode = "CO",
countryName = "COLOMBIA",
departamentCode = "25",
departamentName = "Cundinamarca",
cityCode = "25178",
cityName = "Chipaque"
},
resolution = new
{
resolutionKey = "fc8eac422eba16e22ffd8c6f94b3f40a6e38162c",
resolutionPrefix = "SETT",
resolutionNumber = 18760000001,
resolutionRangeInitial = 990000000,
resolutionRangeFinal = 995000000,
resolutionValidFrom = "2019-01-19",
resolutionValidUntil = "2030-01-19"
},
customer = new
{
companyName = "Customer",
personType = "1",
regimeType = "04",
firstName = "Customer",
lastName = "Customer",
identification = "000000001",
digitCheck = "8",
identificationTypeCode = "13",
email = "email@email.com",
phone = "0000001",
merchantRegistration = "",
responsibleFor = "ZZ",
responsibilities = "R-99-PN",
economicActivities= "2817;3092",
billingAddress = "KR con Calle",
billingCountryName = "Colombia",
billingCountryCode = "CO",
billingRegionName = "Cundinamarca",
billingRegionCode = "25",
billingCityName = "Chipaque",
billingCityCode = "25178",
billingPostalCode = "",
billingNeighborhood = "",
billingPhone = "",
billingContactName = "",
shippingAddress = "",
shippingCountryName = "",
shippingCountryCode = "",
shippingRegionName = "",
shippingRegionCode = "",
shippingCityName = "",
shippingCityCode = "",
shippingPostalCode = "",
shippingNeighborhood = "",
shippingPhone = "",
shippingContactName = ""
},
invoiceNoteDetails = new[]
{
new
{
standardType = "",
standardCode = "",
itemCode = "0001",
itemName = "Item",
itemModel = "",
description = "Item prueba",
brandName = "",
itemCodeSupplier = "",
isPresent = false,
unitMeasurementCode = "NIU",
unitMeasurementName = "",
price = 25,
quantity = 2,
discounts = new[]
{
new
{
name = "",
type = "V",
rate = 1,
amount = 1
}
},
charges = new[]
{
new
{
name = "",
type = "V",
rate = 10,
amount = 10
}
},
taxes = new[]
{
new
{
name = "Iva",
code = "01",
type = "P",
rate = 19,
amount = 6.46
}
},
withholdings = new[]
{
new
{
name = "ReteFuente",
code = "06",
type = "P",
rate = 10,
amount = 3.4
}
},
isvMandante = new
{
name = "Mandante",
identification = "001",
digitCheck = "8",
identificationTypeCode = "13"
}
}
},
totals = new
{
amount = 68,
prepaymentAmount = 0
},
discounts = new[]
{
new
{
name = "",
type = "",
rate = 0,
amount = 0
}
},
charges = new[]
{
new
{
name = "",
type = "V",
rate = 10,
amount = 10
}
},
customFields = new[]
{
new KeyValuePair<string, string>("NombreCampo", "ValorCampo")
}
};
request.AddParameter("application/json", JsonConvert.SerializeObject(isvInvoiceNoteDb), ParameterType.RequestBody);
// Ejecutar request
var client = new RestClient("https://isv.aliaddo.net/api/v1/public/documents");
var response = client.Execute(request);
// Mostrar respuesta
Console.WriteLine((int) response.StatusCode);
Console.WriteLine(response.Content);
}
}
}
/*
* - Enviar una nota débito en modo producción
* - Realizar request por metodo POST
*/
fetch("https://isv.aliaddo.net/api/v1/public/documents/notes-db", {
method: 'POST',
body: JSON.stringify({
format: "Estandar",
emailSender: "",
concept: "1",
consecutive: 990000012,
externalNumber: "",
currencyCode: "COP",
currencyRate: 0,
date: "2020-1-23",
dateStart: "2020-1-23",
dateEnd: "2020-1-29",
typeOfOperation: "01",
terms: "",
remark: "",
observation: "",
//sentEmailAt: "",
invoicePrefix: "inv",
invoiceConsecutive: 990004331,
invoiceCufe: "aa2a047694318e5035cd93b3ffd5a12b829654c144b7cac0ac85ca5c0cb0430cfa3b477c4f7a75cf73f03f002f169162",
invoiceDate: "2020-1-18",
branch: {
name: "Sucursal",
address: "KR con CLL",
phone: "000000",
countryCode: "CO",
countryName: "COLOMBIA",
departamentCode: "25",
departamentName: "Cundinamarca",
cityCode: "25178",
cityName: "Chipaque"
},
resolution: {
resolutionKey: "fc8eac422eba16e22ffd8c6f94b3f40a6e38162c",
resolutionPrefix: "SETP",
resolutionNumber: 18760000001,
resolutionRangeInitial: 990000000,
resolutionRangeFinal: 995000000,
resolutionValidFrom: "2019-01-19",
resolutionValidUntil: "2030-01-19"
},
customer: {
companyName: "Customer",
personType: "1",
regimeType: "04",
firstName: "Customer",
lastName: "Customer",
identification: "000000001",
digitCheck: "8",
identificationTypeCode: "13",
email: "email@email.com",
phone: "",
merchantRegistration: "",
responsibleFor: "ZZ",
responsibilities: "R-99-PN",
economicActivities: "2817;3092",
billingAddress: "KR con Calle",
billingCountryName: "Colombia",
billingCountryCode: "CO",
billingRegionName: "Cundinamarca",
billingRegionCode: "25",
billingCityName: "Chipaque",
billingCityCode: "25178",
billingPostalCode: "",
billingNeighborhood: "",
billingPhone: "",
billingContactName: "",
shippingAddress: "",
shippingCountryName: "",
shippingCountryCode: "",
shippingRegionName: "",
shippingRegionCode: "",
shippingCityName: "",
shippingCityCode: "",
shippingPostalCode: "",
shippingNeighborhood: "",
shippingPhone: "",
shippingContactName: ""
},
invoiceNoteDetails: [{
standardType: "",
standardCode: "",
itemCode: "0001",
itemName: "Item",
itemModel: "",
description: "Item prueba",
brandName: "",
itemCodeSupplier: "",
isPresent: false,
unitMeasurementCode: "NIU",
unitMeasurementName: "",
price: 1285.00,
quantity: 2,
discounts: [{
name: "",
type: "V",
rate: 1,
amount: 1
}],
charges: [{
name: "",
type: "V",
rate: 10,
amount: 10
}],
taxes: [{
name: "Iva",
code: "01",
type: "V",
rate: 10,
amount: 10
}],
withholdings: [{
name: "ReteFuente",
code: "06",
type: "P",
rate: 10,
amount: 3.4
}],
isvMandante: {
name: "Mandante",
identification: "000001",
digitCheck: "8",
identificationTypeCode: "13"
}
}],
totals: {
amount: 68,
prepaymentAmount: 0
},
discounts: [
{
name: "",
type: "",
rate: 0,
amount: 0
}
],
charges: [
{
name: "",
type: "",
rate: 0,
amount: 0
}
],
customFields: [{
value: "666",
key: "invoiceId"
}]
}),
headers: {
'Content-Type': 'application/json',
'x-api-key": "{{x-api-key}}'
}
})
// Manejar petición en caso de que haya sido exitosa o fallida
.then(res => res.json())
.catch(error => console.error('Error:', error))
.then(response => console.log('Success:', response))
/* Agregue este código a su POM
***** CONTENIDO DEL POM *****
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
// Clase donde se ejecuta el request
<mainClass>Program</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>10</source>
<target>10</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
// Agregar dependencia de UniRest para manejar los request
<dependency>
<groupId>com.konghq</groupId>
<artifactId>unirest-java</artifactId>
<version>3.1.00</version>
</dependency>
// Agregar dependencia de GSON para serializar los objetos de Java a JSON
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency>
</dependencies>
*/
// **** Clase donde se ejecuta el request ****
import com.google.gson.*;
import kong.unirest.*;
/*
* - Enviar una nota débito en modo producción
* - Añada las dependencias de UniRest y GSON a su POM como se muestra en el código de la parte superior
*/
public class Program {
public static void main(String[] args) {
// Crear objeto de nota débito
JsonObject isvInvoiceNoteDb = new JsonObject();
isvInvoiceNoteDb.addProperty("format", "Estandar");
isvInvoiceNoteDb.addProperty("emailSender", "");
isvInvoiceNoteDb.addProperty("concept", "1");
isvInvoiceNoteDb.addProperty("consecutive", 990000005);
isvInvoiceNoteDb.addProperty("externalNumber", "54554");
isvInvoiceNoteDb.addProperty("currencyCode", "COP");
isvInvoiceNoteDb.addProperty("currencyRate", 0);
isvInvoiceNoteDb.addProperty("date", "2020-1-20");
isvInvoiceNoteDb.addProperty("dateStart", "2020-1-20");
isvInvoiceNoteDb.addProperty("dateEnd", "2020-1-25");
isvInvoiceNoteDb.addProperty("typeOfOperation", "01");
isvInvoiceNoteDb.addProperty("terms", "");
isvInvoiceNoteDb.addProperty("remark", "");
isvInvoiceNoteDb.addProperty("observation", "");
isvInvoiceNoteDb.addProperty("invoicePrefix", "inv");
isvInvoiceNoteDb.addProperty("invoiceConsecutive", 990004331);
isvInvoiceNoteDb.addProperty("invoiceCufe", "cufe");
isvInvoiceNoteDb.addProperty("invoiceDate", "2020-1-18");
JsonObject branchObj = new JsonObject();
branchObj.addProperty("name", "");
branchObj.addProperty("address", "");
branchObj.addProperty("phone", "");
branchObj.addProperty("countryCode", "");
branchObj.addProperty("countryName", "");
branchObj.addProperty("departmentCode", "");
branchObj.addProperty("departmentName", "");
branchObj.addProperty("cityCode", "");
branchObj.addProperty("cityName", "");
isvInvoiceNoteDb.add("branch", branchObj);
JsonObject resolutionObj = new JsonObject();
resolutionObj.addProperty("resolutionKey", "fc8eac422eba16e22ffd8c6f94b3f40a6e38162c");
resolutionObj.addProperty("resolutionPrefix", "SETP");
resolutionObj.addProperty("resolutionNumber", 18760000001f); // La 'f' indica tipo float
resolutionObj.addProperty("resolutionRangeInitial", 990000000);
resolutionObj.addProperty("resolutionRangeFinal", 995000000);
resolutionObj.addProperty("resolutionValidFrom", "2019-01-19");
resolutionObj.addProperty("resolutionValidUntil", "2030-01-19");
isvInvoiceNoteDb.add("resolution", resolutionObj);
JsonObject customerObj = new JsonObject();
customerObj.addProperty("companyName", "Customer");
customerObj.addProperty("personType", "1");
customerObj.addProperty("regimeType", "04");
customerObj.addProperty("firstName", "Customer");
customerObj.addProperty("lastName", "Customer");
customerObj.addProperty("identification", "000000001");
customerObj.addProperty("digitCheck", "8");
customerObj.addProperty("identificationTypeCode", "13");
customerObj.addProperty("email", "");
customerObj.addProperty("phone", "0000001");
customerObj.addProperty("merchantRegistration", "");
customerObj.addProperty("responsibleFor", "ZZ");
customerObj.addProperty("responsibilities", "R-99-PN");
customerObj.addProperty("economicActivities", "2817;3092");
customerObj.addProperty("billingAddress", "KR con Calle");
customerObj.addProperty("billingCountryName", "Colombia");
customerObj.addProperty("billingCountryCode", "CO");
customerObj.addProperty("billingRegionName", "Cundinamarca");
customerObj.addProperty("billingRegionCode", "25");
customerObj.addProperty("billingCityName", "Chipaque");
customerObj.addProperty("billingCityCode", "25178");
customerObj.addProperty("billingPostalCode", "");
customerObj.addProperty("billingNeighborhood", "");
customerObj.addProperty("billingPhone", "");
customerObj.addProperty("billingContactName", "");
customerObj.addProperty("shippingAddress", "");
customerObj.addProperty("shippingCountryName", "");
customerObj.addProperty("shippingCountryCode", "");
customerObj.addProperty("shippingRegionName", "");
customerObj.addProperty("shippingRegionCode", "");
customerObj.addProperty("shippingCityName", "");
customerObj.addProperty("shippingCityCode", "");
customerObj.addProperty("shippingPostalCode", "");
customerObj.addProperty("shippingNeighborhood", "");
customerObj.addProperty("shippingPhone", "");
customerObj.addProperty("shippingContactName", "");
isvInvoiceNoteDb.add("customer", customerObj);
JsonArray invoiceNoteDetailsArr = new JsonArray();
JsonObject invoiceNoteDetailsObj = new JsonObject();
invoiceNoteDetailsObj.addProperty("standardType", "");
invoiceNoteDetailsObj.addProperty("standardCode", "");
invoiceNoteDetailsObj.addProperty("itemCode", "0001");
invoiceNoteDetailsObj.addProperty("itemName", "Item");
invoiceNoteDetailsObj.addProperty("itemModel", "");
invoiceNoteDetailsObj.addProperty("description", "Item prueba");
invoiceNoteDetailsObj.addProperty("brandName", "");
invoiceNoteDetailsObj.addProperty("itemCodeSupplier", "");
invoiceNoteDetailsObj.addProperty("isPresent", false);
invoiceNoteDetailsObj.addProperty("unitMeasurementCode", "");
invoiceNoteDetailsObj.addProperty("unitMeasurementName", "");
invoiceNoteDetailsObj.addProperty("price", 25);
invoiceNoteDetailsObj.addProperty("quantity", 2);
invoiceNoteDetailsArr.add(invoiceNoteDetailsObj);
JsonArray discountsArr = new JsonArray();
JsonObject discountsObj = new JsonObject();
discountsObj.addProperty("name", "");
discountsObj.addProperty("type", "V");
discountsObj.addProperty("rate", 1);
discountsObj.addProperty("amount", 1);
discountsArr.add(discountsObj);
invoiceNoteDetailsObj.add("discounts", discountsArr);
JsonArray chargesArr = new JsonArray();
JsonObject chargesObj = new JsonObject();
chargesObj.addProperty("name", "");
chargesObj.addProperty("type", "V");
chargesObj.addProperty("rate", 10);
chargesObj.addProperty("amount", 10);
chargesArr.add(chargesObj);
invoiceNoteDetailsObj.add("charges", chargesArr);
JsonArray taxesArr = new JsonArray();
JsonObject taxesObj = new JsonObject();
taxesObj.addProperty("name", "Iva");
taxesObj.addProperty("code", "01");
taxesObj.addProperty("type", "P");
taxesObj.addProperty("rate", 19);
taxesObj.addProperty("amount", 6.46);
taxesArr.add(taxesObj);
invoiceNoteDetailsObj.add("taxes", taxesArr);
JsonArray withholdingsArr = new JsonArray();
JsonObject withholdingsObj = new JsonObject();
withholdingsObj.addProperty("name", "ReteFuente");
withholdingsObj.addProperty("code", "06");
withholdingsObj.addProperty("type", "P");
withholdingsObj.addProperty("rate", 10);
withholdingsObj.addProperty("amount", 3.4);
withholdingsArr.add(withholdingsObj);
invoiceNoteDetailsObj.add("withholdings", withholdingsArr);
JsonObject isvMandanteObj = new JsonObject();
isvMandanteObj.addProperty("name", "Mandante");
isvMandanteObj.addProperty("identification","0014");
isvMandanteObj.addProperty("digitCheck", "8");
isvMandanteObj.addProperty("identificationTypeCode", "13");
invoiceNoteDetailsObj.add("isvMandante", isvMandanteObj);
isvInvoiceNoteDb.add("invoiceNoteDetails", invoiceNoteDetailsArr);
JsonObject totals = new JsonObject();
totals.addProperty("amount", 68);
totals.addProperty("prepaymentAmount", 0);
isvInvoiceNoteDb.add("totals", totals);
JsonArray isvInvoiceNoteDbDiscountsArr = new JsonArray();
JsonObject isvInvoiceNoteDbDiscountsObj = new JsonObject();
isvInvoiceNoteDbDiscountsObj.addProperty("name", "");
isvInvoiceNoteDbDiscountsObj.addProperty("type", "");
isvInvoiceNoteDbDiscountsObj.addProperty("rate", 0);
isvInvoiceNoteDbDiscountsObj.addProperty("amount", 0);
isvInvoiceNoteDbDiscountsArr.add(isvInvoiceNoteDbDiscountsObj);
isvInvoiceNoteDb.add("discounts", isvInvoiceNoteDbDiscountsArr);
JsonArray isvInvoiceNoteDbChargesArr = new JsonArray();
JsonObject isvInvoiceNoteDbChargesObj = new JsonObject();
isvInvoiceNoteDbChargesObj.addProperty("name", "");
isvInvoiceNoteDbChargesObj.addProperty("type", "");
isvInvoiceNoteDbChargesObj.addProperty("rate", 0);
isvInvoiceNoteDbChargesObj.addProperty("amount", 0);
isvInvoiceNoteDbChargesArr.add(isvInvoiceNoteDbChargesObj);
isvInvoiceNoteDb.add("charges", isvInvoiceNoteDbChargesArr);
JsonArray customFieldsArr = new JsonArray();
JsonObject customFieldsObj = new JsonObject();
customFieldsObj.addProperty("666", "invoiceId");
customFieldsArr.add(customFieldsObj);
isvInvoiceNoteDb.add("customFields", customFieldsArr);
// Realizar request por metodo POST
HttpRequestWithBody request = Unirest.post("https://isv.aliaddo.net/api/v1/public/documents/notes-db");
// Adicionar cabeceras de autenticación con token Bearer generado en el panel izquierdo
request.header("x-api-key", "{{x-api-key}}");
// Tipo de requerimiento formato json
request.header("content-type", "application/json");
request.header("cache-control", "no-cache");
request.header("accept", "application/json");
// Añadir el objeto de nota débito
request.body(isvInvoiceNoteDb).asJson()
// Manejar respuesta o error si hay alguno
.ifSuccess(response -> System.out.println("Response: " + "status -> " + response.getStatus() + " Body -> " + response.getBody()))
.ifFailure(response -> {
System.out.println("Oh No! Status " + response.getStatus());
response.getParsingError().ifPresent(e -> {
System.out.println("Parsing Exception: " + e);
System.out.println("Original body: " + e.getOriginalBody());
});
});
}
}
<?php
// Inicializar la petición
$curl = curl_init();
// Agregando objeto nota débito
$debitNote = array(
'format' => 'Estandar',
'emailSender' => '',
'concept' => '1',
'consecutive' => 990000014,
'externalNumber' => '54554',
'currencyCode' => 'COP',
'currencyRate' => 0,
'date' => '2020-1-22',
'dateStart' => '2020-1-22',
'dateEnd' => '2020-1-25',
'typeOfOperation' => '01',
'terms' => '',
'remark' => '',
'observation' => '',
'invoicePrefix' => 'inv',
'invoiceConsecutive' => 990004331,
'invoiceCufe' => 'aa2a047694318e5035cd93b3ffd5a12b829654c144b7cac0ac85ca5c0cb0430cfa3b477c4f7a75cf73f03f002f169162',
'invoiceDate' => '2020-1-18',
'branch' => array(
'name' => '',
'address' => '',
'phone' => '',
'countryCode' => '',
'countryName' => '',
'departmentCode' => '',
'departmentName' => '',
'cityCode' => '',
'cityName' => ''
),
'resolution' => array(
'resolutionKey' => 'fc8eac422eba16e22ffd8c6f94b3f40a6e38162c',
'resolutionPrefix' => 'SETP',
'resolutionNumber' => 18760000001,
'resolutionRangeInitial' => 990000000,
'resolutionRangeFinal' => 995000000,
'resolutionValidFrom' => '2019-01-19',
'resolutionValidUntil' => '2030-01-19'
),
'customer' => array(
'companyName' => 'Customer',
'personType' => '1',
'regimeType' => '04',
'firstName' => 'Customer',
'lastName' => 'Customer',
'identification' => '000000001',
'digitCheck' => '8',
'identificationTypeCode' => '13',
'email' => 'email@email.com',
'phone' => '0000001',
'merchantRegistration' => '',
'responsibleFor' => 'ZZ',
'responsibilities' => 'R-99-PN',
'economicActivities' => '2817;3092',
'billingAddress' => 'KR con Calle',
'billingCountryName' => 'Colombia',
'billingCountryCode' => 'CO',
'billingRegionName' => 'Cundinamarca',
'billingRegionCode' => '25',
'billingCityName' => 'Chipaque',
'billingCityCode' => '25178',
'billingPostalCode' => '',
'billingNeighborhood' => '',
'billingPhone' => '',
'billingContactName' => '',
'shippingAddress' => '',
'shippingCountryName' => '',
'shippingCountryCode' => '',
'shippingRegionName' => '',
'shippingRegionCode' => '',
'shippingCityName' => '',
'shippingCityCode' => '',
'shippingPostalCode' => '',
'shippingNeighborhood' => '',
'shippingPhone' => '',
'shippingContactName' => ''
),
'invoiceNoteDetails' => array(
array(
'standardType' => '',
'standardCode' => '',
'itemCode' => '0001',
'itemName' => 'Item',
'itemModel' => '',
'description' => 'Item prueba',
'brandName' => '',
'itemCodeSupplier' => '',
'isPresent' => false,
'unitMeasurementCode' => '',
'unitMeasurementName' => '',
'price' => 25,
'quantity' => 2,
'discounts' => array(
array(
'name' => '',
'type' => 'V',
'rate' => 1,
'amount' => 1
)
),
'charges' => array(
array(
'name' => '',
'type' => 'V',
'rate' => 10,
'amount' => 10
)
),
'taxes' => array(
array(
'name' => 'Iva',
'code' => '01',
'type' => 'P',
'rate' => 19,
'amount' => 6.46
)
),
'withholdings' => array(
array(
'name' => 'ReteFuente',
'code' => '06',
'type' => 'P',
'rate' => 10,
'amount' => 3.4,
)
),
'isvMandante' => array(
'name' => 'Mandante',
'identification' => '000001',
'digitCheck' => '8',
'identificationTypeCode' => '13'
)
)
),
'totals' => array(
'amount' => 68,
'prepaymentAmount' => 0
),
'discounts' => array(
array(
'name' => '',
'type' => '',
'rate' => 0,
'amount' => 0
)
),
'charges' => array(
array(
'name' => '',
'type' => '',
'rate' => 0,
'amount' => 0
)
),
'customFields' => array(
array(
'value' => '6666',
'key' => 'invoiceId'
)
)
);
// Serializar objeto a JSON
$isvInvoiceNoteDb = json_encode($debitNote);
/**
* - Enviar una nota débito en modo producción
* - Realizar request por metodo POST
*/
curl_setopt_array($curl, array(
CURLOPT_URL => "https://isv.aliaddo.net/api/v1/public/documents/notes-db",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => $isvInvoiceNoteDb,
CURLOPT_HTTPHEADER => array(
// Adicionar cabeceras de autenticación con token Bearer generado en el panel izquierdo
"x-api-key: {{x-api-key}}",
// Tipo de requerimiento formato json
"content-type: application/json",
"cache-control: no-cache",
"accept: application/json"
)
));
// Ejecutar la petición
$response = curl_exec($curl);
// Almacenar error en caso de que exista
$err = curl_error($curl);
// Mostar respuesta o error si hubo alguno
if ($err) {
echo "error -> " . $err;
} else {
echo $response;
}
// Terminar petición
curl_close($curl);
?>
# Importar la librería "requests"
import requests
# - Enviar una nota débito en modo producción
url = 'https://isv.aliaddo.net/api/v1/public/documents/notes-db'
# Crear objeto de nota débito
isvInvoiceNoteDb = {
"format": "Estandar",
"emailSender": "",
"concept": "1",
"consecutive": 9900000021,
"externalNumber": "54554",
"currencyCode": "COP",
"currencyRate": 0,
"date": "2020-1-22",
"dateStart": "2020-1-22",
"dateEnd": "2020-1-25",
"typeOfOperation": "01",
"terms": "",
"remark": "",
"observation": "",
"invoicePrefix": "inv",
"invoiceConsecutive": 990004331,
"invoiceCufe": "aa2a047694318e5035cd93b3ffd5a12b829654c144b7cac0ac85ca5c0cb0430cfa3b477c4f7a75cf73f03f002f169162",
"invoiceDate": "2020-1-18",
"branch": {
"name": "",
"address": "",
"phone": "",
"countryCode": "",
"countryName": "",
"departmentCode": "",
"departmentName": "",
"cityCode": "",
"cityName": ""
},
"resolution": {
"resolutionKey": "fc8eac422eba16e22ffd8c6f94b3f40a6e38162c",
"resolutionPrefix": "SETP",
"resolutionNumber": 18760000001,
"resolutionRangeInitial": 990000000,
"resolutionRangeFinal": 995000000,
"resolutionValidFrom": "2019-01-19",
"resolutionValidUntil": "2030-01-19"
},
"customer": {
"companyName": "Customemer",
"personType": "1",
"regimeType": "04",
"firstName": "Customer",
"lastName": "Customer",
"identification": "000000001",
"digitCheck": "8",
"identificationTypeCode": "13",
"email": "",
"phone": "0000001",
"merchantRegistration": "",
"responsibleFor": "ZZ",
"responsibilities": "R-99-PN",
"economicActivities": "2817;3092",
"billingAddress": "KR con Calle",
"billingCountryName": "Colombia",
"billingCountryCode": "CO",
"billingRegionName": "Cundinamarca",
"billingRegionCode": "25",
"billingCityName": "Chipaque",
"billingCityCode": "25178",
"billingPostalCode": "",
"billingNeighborhood": "",
"billingPhone": "",
"billingContact": "",
"shippingAddress": "",
"shippingCountryName": "",
"shippingCountryCode": "",
"shippingRegionName": "",
"shippingRegionCode": "",
"shippingCityName": "",
"shippingCityCode": "",
"shippingPostalCode": "",
"shippingNeighborhood": "",
"shippingPhone": "",
"shippingContactName": ""
},
"invoiceNoteDetails": [{
"standardType": "",
"standardCode": "",
"itemCode": "0001",
"itemName": "Item",
"itemModel": "",
"description": "Item prueba",
"brandName": "",
"itemCodeSupplier": "",
"isPresent": False,
"unitMeasurementCode": "",
"unitMeasurementName": "",
"price": 25,
"quantity": 2,
"discounts": [{
"name": "",
"type": "V",
"rate": 1,
"amount": 1
}],
"charges": [{
"name": "",
"type": "V",
"rate": 10,
"amount": 10
}],
"taxes": [{
"name": "Iva",
"code": "01",
"type": "P",
"rate": 19,
"amount": 6.46
}],
"withholdings": [{
"name": "ReteFuente",
"code": "06",
"type": "P",
"rate": 10,
"amount": 3.4
}],
"isvMandante": {
"name": "MAndante",
"identification": "00000000001",
"digitCheck": "8",
"identificationTypeCode": "13"
}
}],
"totals": {
"amount": 68,
"prepaymentAmount": 0
},
"discounts": [{
"name": "",
"type": "",
"rate": 0,
"amount": 0
}],
"charges": [{
"name": "",
"type": "V",
"rate": 10,
"amount": 10
}],
"customFields": [
{
"value": "666",
"key": "invoiceId"
}
]
}
# Tipo de requerimiento formato json
headers = {
"content-type": "application/json",
"cache-control": "no-cache",
"accept": "application/json",
# Adicionar cabeceras de autenticación con token Bearer generado en el panel izquierdo
"x-api-key": "{{x-api-key}}"
}
# - Realizar request por metodo POST
request = requests.post(url, json=isvInvoiceNoteDb, headers=headers)
# Mostrar respuesta de la petición
print(request.text)
print(request.status_code)
# Requerir gemas "rest-client" y "json"
require 'rest-client'
require 'json'
# - Enviar una nota débito en modo producción
url = "https://isv.aliaddo.net/api/v1/public/documents/notes-db"
# Tipo de requerimiento formato json
headers = {
"content-type": "application/json",
"cache-control": "no-cache",
"accept": "application/json",
# Adicionar cabeceras de autenticación con token Bearer generado en el panel izquierdo
"x-api-key": "{{x-api-key}}"
}
# Crear objeto de nota débito
isvInvoiceNoteDb = {
"format": "Estandar",
"emailSender": "",
"concept": "1",
"consecutive": 9900000022,
"externalNumber": "54554",
"currencyCode": "COP",
"currencyRate": 0,
"date": "2020-1-22",
"dateStart": "2020-1-22",
"dateEnd": "2020-1-25",
"typeOfOperation": "01",
"terms": "",
"remark": "",
"observation": "",
"invoicePrefix": "inv",
"invoiceConsecutive": 990004331,
"invoiceCufe": "aa2a047694318e5035cd93b3ffd5a12b829654c144b7cac0ac85ca5c0cb0430cfa3b477c4f7a75cf73f03f002f169162",
"invoiceDate": "2020-1-18",
"branch": {
"name": "",
"address": "",
"phone": "",
"countryCode": "",
"countryName": "",
"departmentCode": "",
"departmentName": "",
"cityCode": "",
"cityName": ""
},
"resolution": {
"resolutionKey": "fc8eac422eba16e22ffd8c6f94b3f40a6e38162c",
"resolutionPrefix": "SETP",
"resolutionNumber": 18760000001,
"resolutionRangeInitial": 990000000,
"resolutionRangeFinal": 995000000,
"resolutionValidFrom": "2019-01-19",
"resolutionValidUntil": "2030-01-19"
},
"customer": {
"companyName": "Customemer",
"personType": "1",
"regimeType": "04",
"firstName": "Customer",
"lastName": "Customer",
"identification": "000000001",
"digitCheck": "8",
"identificationTypeCode": "13",
"email": "",
"phone": "0000001",
"merchantRegistration": "",
"responsibleFor": "ZZ",
"responsibilities": "R-99-PN",
"economicActivities": "2817;3092",
"billingAddress": "KR con Calle",
"billingCountryName": "Colombia",
"billingCountryCode": "CO",
"billingRegionName": "Cundinamarca",
"billingRegionCode": "25",
"billingCityName": "Chipaque",
"billingCityCode": "25178",
"billingPostalCode": "",
"billingNeighborhood": "",
"billingPhone": "",
"billingContact": "",
"shippingAddress": "",
"shippingCountryName": "",
"shippingCountryCode": "",
"shippingRegionName": "",
"shippingRegionCode": "",
"shippingCityName": "",
"shippingCityCode": "",
"shippingPostalCode": "",
"shippingNeighborhood": "",
"shippingPhone": "",
"shippingContactName": ""
},
"invoiceNoteDetails": [{
"standardType": "",
"standardCode": "",
"itemCode": "0001",
"itemName": "Item",
"itemModel": "",
"description": "Item prueba",
"brandName": "",
"itemCodeSupplier": "",
"isPresent": false,
"unitMeasurementCode": "",
"unitMeasurementName": "",
"price": 25,
"quantity": 2,
"discounts": [{
"name": "",
"type": "V",
"rate": 1,
"amount": 1
}],
"charges": [{
"name": "",
"type": "V",
"rate": 10,
"amount": 10
}],
"taxes": [{
"name": "Iva",
"code": "01",
"type": "P",
"rate": 19,
"amount": 6.46
}],
"withholdings": [{
"name": "ReteFuente",
"code": "06",
"type": "P",
"rate": 10,
"amount": 3.4
}],
"isvMandante": {
"name": "MAndante",
"identification": "00000000001",
"digitCheck": "8",
"identificationTypeCode": "13"
}
}],
"totals": {
"amount": 68,
"prepaymentAmount": 0
},
"discounts": [{
"name": "",
"type": "",
"rate": 0,
"amount": 0
}],
"charges": [{
"name": "",
"type": "V",
"rate": 10,
"amount": 10
}],
"customFields": [
{
"value": "666",
"key": "invoiceId"
}
]
}
# Crear petición con método POST
begin
request = RestClient.post(url, isvInvoiceNoteDb.to_json, headers)
# Manejar error si hay alguno
rescue RestClient::ExceptionWithResponse => e
puts e.response
end
# Imprimir respuesta
puts request
Última actualización
¿Te fue útil?