Ürün oluşturma
Stok / ürün kartı oluşturmak için bu endpoint kullanılır.
İstek
POST /api/products
Accept: application/json
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
İstek gövdesi alanları
| Alan | Tip | Zorunlu | Açıklama |
|---|---|---|---|
name | string | Evet | Ürün adı. |
sku | string | Hayır | Stok kodu. |
quantity | number | Hayır | Miktar (min 1). |
unit | string | Hayır | Birim kodu (örn. C62); enum bkz. ProductUnit. |
unit_price | number | Evet | Birim fiyat ≥ 0. |
tax_rate | number | Evet | KDV (ürün kaydı): 0, 1, 8, 10, 18 veya 20 (fatura satırında ek oranlar için bkz. Sabitler). |
Örnek istekler
- 💻 cURL
- 🐘 PHP
- 🟢 Node.js
- 🐍 Python
curl -X POST "https://app.faturaentegrator.com/api/products" \
-H "Accept: application/json" -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" \
-d '{"name":"kalem","sku":"123456","quantity":1,"unit":"C62","tax_rate":20,"unit_price":100}'
<?php
$body = ['name' => 'kalem', 'sku' => '123456', 'quantity' => 1, 'unit' => 'C62', 'tax_rate' => 20, 'unit_price' => 100];
$ch = curl_init('https://app.faturaentegrator.com/api/products');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($body),
CURLOPT_HTTPHEADER => ['Accept: application/json', 'Authorization: Bearer YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_RETURNTRANSFER => true,
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
const body = { name: 'kalem', sku: '123456', quantity: 1, unit: 'C62', tax_rate: 20, unit_price: 100 };
const res = await fetch('https://app.faturaentegrator.com/api/products', {
method: 'POST',
headers: { Accept: 'application/json', Authorization: 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' },
body: JSON.stringify(body),
});
const data = await res.json();
import requests
body = {'name': 'kalem', 'sku': '123456', 'quantity': 1, 'unit': 'C62', 'tax_rate': 20, 'unit_price': 100}
r = requests.post(
'https://app.faturaentegrator.com/api/products',
json=body,
headers={'Accept': 'application/json', 'Authorization': 'Bearer YOUR_API_KEY'},
)
data = r.json()