Fatura listesi
curl --request GET \
--url https://api.sarraf.pro/v1/invoices \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://api.sarraf.pro/v1/invoices"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://api.sarraf.pro/v1/invoices', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sarraf.pro/v1/invoices",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sarraf.pro/v1/invoices"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.sarraf.pro/v1/invoices")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sarraf.pro/v1/invoices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"success": true,
"data": [
{
"id": "<string>",
"transactionDate": "2023-11-07T05:31:56Z",
"invoiceNumber": "<string>",
"invoiceType": "<string>",
"invoiceStatus": true,
"linesTotal": 123,
"kdvTotal": 123,
"allowanceTotal": 123,
"payableTotal": 123,
"customer": {
"taxNumber": "<string>",
"name": "<string>"
},
"idNo": "<string>"
}
],
"meta": {
"requestId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"timestamp": "2023-11-07T05:31:56Z",
"page": 123,
"limit": 123,
"total": 123,
"pages": 123
}
}{
"success": false,
"error": {
"code": "VALIDATION_FAILED",
"message": "<string>",
"details": [
{
"field": "<string>",
"rule": "<string>",
"state": "<string>",
"attemptId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"verificationId": "<string>",
"retryAfter": 123,
"retryable": true,
"errorCode": "<string>"
}
]
},
"traceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"success": false,
"error": {
"code": "VALIDATION_FAILED",
"message": "<string>",
"details": [
{
"field": "<string>",
"rule": "<string>",
"state": "<string>",
"attemptId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"verificationId": "<string>",
"retryAfter": 123,
"retryable": true,
"errorCode": "<string>"
}
]
},
"traceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"success": false,
"error": {
"code": "VALIDATION_FAILED",
"message": "<string>",
"details": [
{
"field": "<string>",
"rule": "<string>",
"state": "<string>",
"attemptId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"verificationId": "<string>",
"retryAfter": 123,
"retryable": true,
"errorCode": "<string>"
}
]
},
"traceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}Faturalar
Fatura listesi
Sistem üzerinden kesilen faturaları sayfalı, filtreli ve sıralı listeler. Kalem satırları (lines) bu uçta dönmez; detay ucundadır. Bilinmeyen filter alanı 400 VALIDATION_FAILED döner.
GET
/
v1
/
invoices
Fatura listesi
curl --request GET \
--url https://api.sarraf.pro/v1/invoices \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://api.sarraf.pro/v1/invoices"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://api.sarraf.pro/v1/invoices', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sarraf.pro/v1/invoices",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sarraf.pro/v1/invoices"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.sarraf.pro/v1/invoices")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sarraf.pro/v1/invoices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"success": true,
"data": [
{
"id": "<string>",
"transactionDate": "2023-11-07T05:31:56Z",
"invoiceNumber": "<string>",
"invoiceType": "<string>",
"invoiceStatus": true,
"linesTotal": 123,
"kdvTotal": 123,
"allowanceTotal": 123,
"payableTotal": 123,
"customer": {
"taxNumber": "<string>",
"name": "<string>"
},
"idNo": "<string>"
}
],
"meta": {
"requestId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"timestamp": "2023-11-07T05:31:56Z",
"page": 123,
"limit": 123,
"total": 123,
"pages": 123
}
}{
"success": false,
"error": {
"code": "VALIDATION_FAILED",
"message": "<string>",
"details": [
{
"field": "<string>",
"rule": "<string>",
"state": "<string>",
"attemptId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"verificationId": "<string>",
"retryAfter": 123,
"retryable": true,
"errorCode": "<string>"
}
]
},
"traceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"success": false,
"error": {
"code": "VALIDATION_FAILED",
"message": "<string>",
"details": [
{
"field": "<string>",
"rule": "<string>",
"state": "<string>",
"attemptId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"verificationId": "<string>",
"retryAfter": 123,
"retryable": true,
"errorCode": "<string>"
}
]
},
"traceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"success": false,
"error": {
"code": "VALIDATION_FAILED",
"message": "<string>",
"details": [
{
"field": "<string>",
"rule": "<string>",
"state": "<string>",
"attemptId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"verificationId": "<string>",
"retryAfter": 123,
"retryable": true,
"errorCode": "<string>"
}
]
},
"traceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}Authorizations
Kullanıcı adı apiUserId, parola secretKey. Authorization: Basic base64(apiUserId:secretKey)
Query Parameters
Sayfa numarası (en az 1).
Required range:
x >= 1Sayfa başına kayıt (1-100).
Required range:
1 <= x <= 100Sıralama: alan:asc|desc. İzinli alanlar: transactionDate, payableTotal. Varsayılan transactionDate:asc.
Pattern:
^(transactionDate|payableTotal)(:(asc|desc))?$Serbest metin arama. Numerik değer idNo tam eşleşmesi, metin değer müşteri ünvanı (customer.name) içinde arama yapar.
Müşteri TCKN/VKN tam eşleşme.
Fatura numarası tam eşleşme.
Fatura türü (invoiceInfo.type).
ISO-8601 tarih; transactionDate >= startDate.
ISO-8601 tarih; transactionDate <= endDate.
⌘I