e-Fatura Listeleme
Gönderilen şirket idsi ve fatura yönüne bağlı olarak ilgili şirkete ait faturaları görüntülemek için kullanılır.
Endpoint
GET /kolaybi/v1/e_document/invoices
Parametreler
Parametre | Tip | Zorunlu | Açıklama |
---|---|---|---|
company_id | integer | ✅ | Şirkete ait ID değeri |
direction | string | ✅ | Gönderim şekli |
Örnekler
- cURL
- JavaScript
- PHP
- Python
- C#
curl -X GET "https://ofis-sandbox-api.kolaybi.com/kolaybi/v1/e_document/invoices?company_id=5&direction=outbound" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Channel: YOUR_CHANNEL"
async function listEDocumentInvoices(companyId, direction) {
const params = new URLSearchParams({
company_id: companyId,
direction: direction,
});
const response = await fetch(
`https://ofis-sandbox-api.kolaybi.com/kolaybi/v1/e_document/invoices?${params}`,
{
headers: {
Authorization: `Bearer ${accessToken}`,
Channel: channel,
},
}
);
return await response.json();
}
// Kullanım
const invoices = await listEDocumentInvoices(5, "outbound");
function listEDocumentInvoices($companyId, $direction) {
$url = 'https://ofis-sandbox-api.kolaybi.com/kolaybi/v1/e_document/invoices?' .
http_build_query([
'company_id' => $companyId,
'direction' => $direction
]);
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => $url,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $accessToken,
'Channel: ' . $channel
],
CURLOPT_RETURNTRANSFER => true
]);
$response = curl_exec($ch);
curl_close($ch);
return json_decode($response, true);
}
// Kullanım
$invoices = listEDocumentInvoices(5, 'outbound');
import requests
def list_e_document_invoices(company_id, direction):
url = 'https://ofis-sandbox-api.kolaybi.com/kolaybi/v1/e_document/invoices'
params = {
'company_id': company_id,
'direction': direction
}
headers = {
'Authorization': f'Bearer {access_token}',
'Channel': channel
}
response = requests.get(url, params=params, headers=headers)
return response.json()
# Kullanım
invoices = list_e_document_invoices(5, 'outbound')
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Newtonsoft.Json;
async Task<dynamic> ListEDocumentInvoicesAsync(int companyId, string direction)
{
using var client = new HttpClient();
var url = $"https://ofis-sandbox-api.kolaybi.com/kolaybi/v1/e_document/invoices?company_id={companyId}&direction={Uri.EscapeDataString(direction)}";
var request = new HttpRequestMessage(HttpMethod.Get, url);
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
request.Headers.Add("Channel", channel);
var response = await client.SendAsync(request);
var content = await response.Content.ReadAsStringAsync();
return JsonConvert.DeserializeObject<dynamic>(content);
}
// Kullanım
var invoices = await ListEDocumentInvoicesAsync(5, "outbound");
Yanıt
{
"data": [
{
"document_id": 18,
"uuid": "f46d5a8d-7726-4b37-bba4-973c7ab50a5b",
"no": "HDB2021000008464",
"status": "sent_to_receiver",
"scenario": "EARSIVFATURA",
"type": "SATIS",
"direction": "outbound",
"exchange_grand_total": 20,
"exchange_grand_currency": "try",
"grand_total": 20,
"grand_currency": "try"
}
]
}
Yanıt Alanları
Alan | Tip | Açıklama |
---|---|---|
document_id | integer | Fatura ID değeri |
uuid | string | Fatura UUID (ETTN) |
no | string | Seri numarası |
status | string | E-Fatura durumu |
scenario | string | Fatura senaryosu |
type | string | Fatura tipi |
direction | string | Gönderim şekli |
exchange_grand_total | number | Yerel tutar |
exchange_grand_currency | string | Yerel para birimi |
grand_total | number | Toplam tutar |
grand_currency | string | Fatura para birimi |