API > Consulta factura TicketBAI

Consulta factura TicketBAI

GET  https://{entorno}.ticketbaiws.eus/tbai/

Este método permite consultar la huella TBAI, el código QR y la URL de validación de una factura TicketBAI previamente generada. Dentro del cuerpo del return se devuelve el status actual de la factura, los posibles valores son OK, PENDING ó ERROR

PARÁMETROS

serie string obligatorio
Serie de la factura
A
numero string obligatorio
Número de factura
2021000123

GET https://{entorno}.ticketbaiws.eus/tbai/
$ curl --request GET \
     --url https://api-test.ticketbaiws.eus/tbai/ \
     --header 'Accept: application/json' \
     --header 'Content-Type: application/json' \
     --header 'Token: xxx' \
     --header 'Nif: 00000014Z'
	 --data '{"serie":"A","numero":"2021000123"}'
$ composer require guzzlehttp/guzzle
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api-test.ticketbaiws.eus/tbai/', [
  'body' => '{"serie":"A","numero":"2021000123"}',
  'headers' => [
    'Accept' => 'application/json',
    'Content-Type' => 'application/json',
    'Token' => 'xxx',
    'Nif' => '00000014Z'
  ],
]);

echo $response->getBody();
$ python -m pip install requests
import requests

url = "https://api-test.ticketbaiws.eus/tbai/"
headers = {"Accept": "application/json", "Token" : "xxx", "Nif" : "00000014Z"}
response = requests.request("GET", url, headers=headers)
print(response.text)
CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "https://api-test.ticketbaiws.eus/tbai/");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Accept: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

CURLcode ret = curl_easy_perform(hnd);
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api-test.ticketbaiws.eus/tbai/?serie=A&numero=2021000123")
  .get()
  .addHeader("Accept", "application/json")
  .addHeader("Token", "xxx")
  .addHeader("Nif", "00000014Z")
  .build();
  
Response response = client.newCall(request).execute();
{ } Response JSON
HTTP/1.1 200 OK
{ 
	"result": "OK", 
	"return": {
		"status" : "OK",
		"huella_tbai" : "TBAI-B01000012-131121-zG3wtCW3WlOSN-108",
		"qr" : "iVBORw0KGgoAAAANSUhEUgAAAfQAAAH0CAIAAABEtEjdAAAABmJ...",
		"url" : "https://batuz.eus/QRTBAI/?id=TBAI-..."
	}, 
	"msg": null 
}