En esta sección aprenderás cómo utilizar la API para obtener el estado de un documento de venta
Para obtener el estado de un documento de compra ingresado en el sistema utilizaremos el verbo http GET
Formato de respuesta | JSON |
---|---|
¿Requiere autenticación? | SI |
¿Requiere token? | SI |
¿Requiere Partner key? | NO |
Nombre | Descripción | Tipo del parámetro | Tipo del dato |
---|---|---|---|
rut | Rut de la empresa | Path | String |
numeroFolio |
Número de folio a consultar |
Path | Integer |
tipoDocumento |
Abreviación del tipo de documentos FAC-EL: Factura electrónica. FAC-EE:Factura exenta electrónica. N/D-EL: Nota débito electrónica. N/C-EL:Nota de crédito electrónica. BOL-EL: Boleta electrónica. BOL-EE: Boleta exenta electrónica. para los valores con / remplazar por %2F |
Path | String |
numeroSerie |
Número de serie del sistema, este valor se obtiene desde la autenticación de la API |
Path | Integer |
curl --location --request GET 'https://api.nubox.com/Nubox.API/factura/documento/1-9/estadoventa/468/FAC-EL/1' \ --header 'token: dd380573-3dac-41c1-bbed-8c954f743ff8' \ --header 'Cookie: .Stackify.Rum=f0af7579-7902-4bd2-b8e9-2fd72872bd71' \ --data-raw ''
var settings = { "url": "https://api.nubox.com/Nubox.API/factura/documento/1-9/estadoventa/468/FAC-EL/1", "method": "GET", "timeout": 0, "headers": { "token": "612528bc-6b02-4ffc-8203-f4d36fd78c29", "Cookie": ".Stackify.Rum=4c648f24-1d4f-4817-a602-57005e5e24da" }, }; $.ajax(settings).done(function (response) { console.log(response); });
var myHeaders = new Headers(); myHeaders.append("token", "612528bc-6b02-4ffc-8203-f4d36fd78c29"); myHeaders.append("Cookie", ".Stackify.Rum=4c648f24-1d4f-4817-a602-57005e5e24da"); var requestOptions = { method: 'GET', headers: myHeaders, redirect: 'follow' }; fetch("https://api.nubox.com/Nubox.API/factura/documento/1-9/estadoventa/468/FAC-EL/1", requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error));
var xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener("readystatechange", function() { if(this.readyState === 4) { console.log(this.responseText); } }); xhr.open("GET", "https://api.nubox.com/Nubox.API/factura/documento/1-9/estadoventa/468/FAC-EL/1"); xhr.setRequestHeader("token", "612528bc-6b02-4ffc-8203-f4d36fd78c29"); xhr.setRequestHeader("Cookie", ".Stackify.Rum=f0af7579-7902-4bd2-b8e9-2fd72872bd71"); xhr.send();
var https = require('follow-redirects').https; var fs = require('fs'); var options = { 'method': 'GET', 'hostname': 'api.nubox.com', 'path': '/Nubox.API/factura/documento/1-9/estadoventa/468/FAC-EL/1', 'headers': { 'token': 'dd380573-3dac-41c1-bbed-8c954f743ff8', 'Cookie': '.Stackify.Rum=f0af7579-7902-4bd2-b8e9-2fd72872bd71' }, 'maxRedirects': 20 }; var req = https.request(options, function (res) { var chunks = []; res.on("data", function (chunk) { chunks.push(chunk); }); res.on("end", function (chunk) { var body = Buffer.concat(chunks); console.log(body.toString()); }); res.on("error", function (error) { console.error(error); }); }); req.end();
var client = new RestClient("https://api.nubox.com/Nubox.API/factura/documento/1-9/estadoventa/468/FAC-EL/1"); client.Timeout = -1; var request = new RestRequest(Method.GET); request.AddHeader("token", "dd380573-3dac-41c1-bbed-8c954f743ff8"); request.AddHeader("Cookie", ".Stackify.Rum=f0af7579-7902-4bd2-b8e9-2fd72872bd71"); request.AddParameter("text/plain", "", ParameterType.RequestBody); IRestResponse response = client.Execute(request); Console.WriteLine(response.Content);
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.nubox.com/Nubox.API/factura/documento/1-9/estadoventa/468/FAC-EL/1", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => array( "token: dd380573-3dac-41c1-bbed-8c954f743ff8", "Cookie: .Stackify.Rum=f0af7579-7902-4bd2-b8e9-2fd72872bd71" ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
require "uri" require "net/http" url = URI("https://api.nubox.com/Nubox.API/factura/documento/1-9/estadoventa/468/FAC-EL/1") https = Net::HTTP.new(url.host, url.port); https.use_ssl = true request = Net::HTTP::Get.new(url) request["token"] = "dd380573-3dac-41c1-bbed-8c954f743ff8" request["Cookie"] = ".Stackify.Rum=f0af7579-7902-4bd2-b8e9-2fd72872bd71" response = https.request(request) puts response.read_body
package main import ( "fmt" "strings" "net/http" "io/ioutil" ) func main() { url := "https://api.nubox.com/Nubox.API/factura/documento/1-9/estadoventa/468/FAC-EL/1" method := "GET" payload := strings.NewReader("") client := &http.Client { } req, err := http.NewRequest(method, url, payload) if err != nil { fmt.Println(err) } req.Header.Add("token", "dd380573-3dac-41c1-bbed-8c954f743ff8") req.Header.Add("Cookie", ".Stackify.Rum=f0af7579-7902-4bd2-b8e9-2fd72872bd71") res, err := client.Do(req) defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) fmt.Println(string(body)) }
OkHttpClient client = new OkHttpClient().newBuilder() .build(); Request request = new Request.Builder() .url("https://api.nubox.com/Nubox.API/factura/documento/1-9/estadoventa/468/FAC-EL/1") .method("GET", null) .addHeader("token", "dd380573-3dac-41c1-bbed-8c954f743ff8") .addHeader("Cookie", ".Stackify.Rum=f0af7579-7902-4bd2-b8e9-2fd72872bd71") .build(); Response response = client.newCall(request).execute();
{ "estado": "BORRADOR" }
Nombre | Valor |
---|---|
cache-control | no-cache |
content-length | 20 |
content-type | application/json; charset=utf-8 |
date | Thu, 16 Apr 2020 22:53:54 GMT |