Enviar nota de ajuste en modo pruebas
Modo pruebas
Enviar nota de ajuste
POST
https://isv.aliaddo.net/api/v1/public/documents/support/adjustments/test
Enviar una nota de ajuste en modo pruebas 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
isvNoteAdjustments
object
Objeto de la nota de ajuste
{
"id": "string",
"cuds": "string",
"qr": "string",
"urlPdf": "string",
"urlPdf": "string",
"dianState": "string", // Procesando, Aprobada o Rechazada
"dianStateDate": "0001-01-01T00:00:00"",
"dianStateReason": "string",
"issueDate": "0001-01-01T00:00:00"
}
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 de ajuste en modo pruebas
- 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("/support/test", 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 de ajuste con resolución ejemplo
var isvNote = new
{
format = "Estandar",
concept = "1",
consecutive = 6,
externalNumber = "",
currencyCode = "COP",
currencyRate = 0,
date = "2020-1-18",
dateStart = "2020-1-18",
dateEnd = "2020-1-20",
notes = new [
"string"
],
supportDocumentPrefix= "asd",
supportDocumentConsecutive = 990004331,
supportDocumentCuds= "aa2a047694318e5035cd93b3ffd5a12b829654c144b7cac0ac85ca5c0cb0430cfa3b477c4f7a75cf73f03f002f169162",
supportDocumentDate = "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"
},
supplier = new
{
companyName = "Customer",
personType = "1",
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 = ""
},
supportDocumentAdjustmentDetails = new[]
{
new
{
standardType = "",
standardCode = "",
itemCode = "0001",
itemName = "Item",
itemModel = "",
description = "Item prueba",
brandName = "",
itemCodeSupplier = "",
isPresent = false,
isRemmitance: true,
remmitanceNumber: "",
remmitanceConsecutive: "",
remmitanceValue: 0,
remmitanceQuantityValue: 0,
remmitanceMeasurementUnit: "",
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
}
}
};
request.AddParameter("application/json", JsonConvert.SerializeObject(isvNote), 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 de ajuste en modo pruebas
* - Realizar request por metodo POST
*/
fetch("https://isv.aliaddo.net/api/v1/public/documents/support/test", {
method: 'POST',
body: JSON.stringify({
format: "Estandar",
concept: "1",
consecutive: 5,
externalNumber: "",
currencyCode: "COP",
currencyRate: 0,
date: "2020-1-18",
dateStart: "2020-1-18",
dateEnd: "2020-1-20",
notes: [
"string"
],
supportDocumentPrefix: "asd",
supportDocumentConsecutive: 990004331,
supportDocumentCuds: "aa2a047694318e5035cd93b3ffd5a12b829654c144b7cac0ac85ca5c0cb0430cfa3b477c4f7a75cf73f03f002f169162",
supportDocumentDate: "2020-1-18",
branch: {
name: "Sucursal",
address: "KR con CLL",
phone: "000000",
countryCode: "CO",
countryName: "COLOMBIA",
departamentCode: "25",
departamentName: "Cundinamarca",
cityCode: "25178",
cityName: "Chipaque"
},
supplier: {
companyName: "Customer",
personType: "1",
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: "",
},
noteDetails: [{
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
}
]
}),
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 de ajuste en modo pruebas
* - 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) {
JsonObject isvNote = new JsonObject();
isvNote.addProperty("format", "Estandar");
isvNote.addProperty("concept", "1");
isvNote.addProperty("consecutive", 8);
isvNote.addProperty("externalNumber", "54554");
isvNote.addProperty("currencyCode", "COP");
isvNote.addProperty("currencyRate", 0);
isvNote.addProperty("date", "2020-1-20");
isvNote.addProperty("dateStart", "2020-1-20");
isvNote.addProperty("dateEnd", "2020-1-25");
isvNote.addProperty("supportDocumentPrefix", "asd");
isvNote.addProperty("supportDocumentConsecutive", 990004331);
isvNote.addProperty("supportDocumentCuds", "cufe");
isvNote.addProperty("supportDocumentDate", "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", "");
isvNote.add("branch", branchObj);
JsonObject supplierObj = new JsonObject();
supplierObj.addProperty("companyName", "Customer");
supplierObj.addProperty("personType", "1");
supplierObj.addProperty("firstName", "Customer");
supplierObj.addProperty("lastName", "Customer");
supplierObj.addProperty("identification", "000000001");
supplierObj.addProperty("digitCheck", "8");
supplierObj.addProperty("identificationTypeCode", "13");
supplierObj.addProperty("email", "");
supplierObj.addProperty("phone", "0000001");
supplierObj.addProperty("merchantRegistration", "");
supplierObj.addProperty("responsibleFor", "ZZ");
supplierObj.addProperty("responsibilities", "R-99-PN");
supplierObj.addProperty("economicActivities", "2817;3092");
supplierObj.addProperty("billingAddress", "KR con Calle");
supplierObj.addProperty("billingCountryName", "Colombia");
supplierObj.addProperty("billingCountryCode", "CO");
supplierObj.addProperty("billingRegionName", "Cundinamarca");
supplierObj.addProperty("billingRegionCode", "25");
supplierObj.addProperty("billingCityName", "Chipaque");
supplierObj.addProperty("billingCityCode", "25178");
supplierObj.addProperty("billingPostalCode", "");
supplierObj.addProperty("billingNeighborhood", "");
supplierObj.addProperty("billingPhone", "");
supplierObj.addProperty("billingContactName", "");
isvNote.add("customer", customerObj);
JsonArray noteDetailsArr = new JsonArray();
JsonObject noteDetailsObj = new JsonObject();
noteDetailsObj.addProperty("standardType", "");
noteDetailsObj.addProperty("standardCode", "");
noteDetailsObj.addProperty("itemCode", "0001");
noteDetailsObj.addProperty("itemName", "Item");
noteDetailsObj.addProperty("itemModel", "");
noteDetailsObj.addProperty("description", "Item prueba");
noteDetailsObj.addProperty("brandName", "");
noteDetailsObj.addProperty("itemCodeSupplier", "");
noteDetailsObj.addProperty("isPresent", false);
noteDetailsObj.addProperty("unitMeasurementCode", "");
noteDetailsObj.addProperty("unitMeasurementName", "");
noteDetailsObj.addProperty("price", 25);
noteDetailsObj.addProperty("quantity", 2);
noteDetailsArr.add(noteDetailsObj);
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);
noteDetailsObj.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);
noteDetailsObj.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);
noteDetailsObj.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);
noteDetailsObj.add("withholdings", withholdingsArr);
JsonObject isvMandanteObj = new JsonObject();
isvMandanteObj.addProperty("name", "Mandante");
isvMandanteObj.addProperty("identification", "0014");
isvMandanteObj.addProperty("digitCheck", "8");
isvMandanteObj.addProperty("identificationTypeCode", "13");
noteDetailsObj.add("isvMandante", isvMandanteObj);
noteDetailsObj.add("noteDetails", noteDetailsArr);
JsonObject totals = new JsonObject();
totals.addProperty("amount", 68);
totals.addProperty("amount", 68);
totals.addProperty("prepaymentAmount", 0);
isvNote.add("totals", totals);
JsonArray isvNoteDiscountsArr = new JsonArray();
JsonObject isvNoteDiscountsObj = new JsonObject();
isvNoteDiscountsObj.addProperty("type", "");
isvNoteDiscountsObj.addProperty("rate", 0);
isvNoteDiscountsObj.addProperty("amount", 0);
isvNoteDiscountsArr .add(isvNoteDiscountsObj);
isvNote.add("discounts", isvNoteDiscountsArr );
JsonArray isvNoteChargesArr = new JsonArray();
JsonObject isvNoteChargesObj = new JsonObject();
isvNoteChargesObj.addProperty("type", "");
isvNoteChargesObj.addProperty("rate", 0);
isvNoteChargesObj.addProperty("amount", 0);
isvNoteChargesArr.add(isvNoteChargesObj );
isvNoteChargesObj.add("charges", isvNoteChargesArr);
// Realizar request por metodo POST
HttpRequestWithBody request = Unirest.post("https://isv.aliaddo.net/api/v1/public/documents/support/test");
// 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 de ajuste
request.body(isvNote).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 de ajuste
isvNote = array(
'format' => 'Estandar',
'concept' => '1',
'consecutive' => 8,
'externalNumber' => '54554',
'currencyCode' => 'COP',
'currencyRate' => 0,
'date' => '2020-1-22',
'dateStart' => '2020-1-22',
'dateEnd' => '2020-1-25',
'documentPrefix' => 'asd',
'supportDocumentConsecutive' => 990004331,
'supportDocumentCuds' => 'aa2a047694318e5035cd93b3ffd5a12b829654c144b7cac0ac85ca5c0cb0430cfa3b477c4f7a75cf73f03f002f169162',
'supportDocumentDate' => '2020-1-18',
'branch' => array(
'name' => '',
'address' => '',
'phone' => '',
'countryCode' => '',
'countryName' => '',
'departmentCode' => '',
'departmentName' => '',
'cityCode' => '',
'cityName' => ''
),
'supplier' => array(
'companyName' => 'Customer',
'personType' => '1',
'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' => ''
),
'supportDocumentAdjustmentDetails' => 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
)
)
);
// Serializar objeto a JSON
$isvNote = json_encode($isvNote);
/**
* - Enviar una nota de ajuste en modo pruebas
* - Realizar request por metodo POST
*/
curl_setopt_array($curl, array
CURLOPT_URL => "https://isv.aliaddo.net/api/v1/public/documents/support/test",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => $isvNote,
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 "cURL Error #" .$err;
} else {
echo $response;
}
// Terminar petición
curl_close($curl);
?>
# Importar la librería "requests"
import requests
# - Enviar una nota de ajuste en modo pruebas
url = 'https://isv.aliaddo.net/api/v1/public/documents/support/test'
# Crear objeto de nota de ajuste
isvNote = {
"format": "Estandar",
"concept": "1",
"consecutive": 9,
"externalNumber": "54554",
"currencyCode": "COP",
"currencyRate": 0,
"date": "2020-1-22",
"dateStart": "2020-1-22",
"dateEnd": "2020-1-25",
"notes": [
"string"
],
"supportDocumentPrefix": "asd",
"supportDocumentConsecutive": 990004331,
"supportDocumentCuds": "aa2a047694318e5035cd93b3ffd5a12b829654c144b7cac0ac85ca5c0cb0430cfa3b477c4f7a75cf73f03f002f169162",
"supportDocumentDate": "2020-1-18",
"branch": {
"name": "",
"address": "",
"phone": "",
"countryCode": "",
"countryName": "",
"departmentCode": "",
"departmentName": "",
"cityCode": "",
"cityName": ""
},
"supplier": {
"companyName": "Customer",
"personType": "1",
"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": ""
},
"supportDocumentAdjustmentDetails": [{
"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
}]
}
# 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=isvNote, 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 de ajuste en modo pruebas
url = "https://isv.aliaddo.net/api/v1/public/documents/support/test"
# 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 de ajuste
isvNote = {
"format": "Estandar",
"concept": "1",
"consecutive": 10,
"externalNumber": "54554",
"currencyCode": "COP",
"currencyRate": 0,
"date": "2020-1-22",
"dateStart": "2020-1-22",
"dateEnd": "2020-1-25",
"notes": [
"string"
],
"supportDocumentPrefix": "asd",
"supportDocumentConsecutive": 990004331,
"supportDocumentCuds": "aa2a047694318e5035cd93b3ffd5a12b829654c144b7cac0ac85ca5c0cb0430cfa3b477c4f7a75cf73f03f002f169162",
"supportDocumentDate": "2020-1-18",
"branch": {
"name": "",
"address": "",
"phone": "",
"countryCode": "",
"countryName": "",
"departmentCode": "",
"departmentName": "",
"cityCode": "",
"cityName": ""
},
"supplier": {
"companyName": "Customer",
"personType": "1",
"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": ""
},
"supportDocumentAdjustmentDetails": [{
"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
}]
}
# Crear petición con método POST
begin
request = RestClient.post(url, isvNote.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?