1. Giriş İsteği ve Token Alma
Önce login endpointinden access token alınır, ardından isteklerde Bearer token kullanılır.
POST https://portalecza.com/auth/login
Örnek request body:
{
"email": "[email protected]",
"password": "sifre"
}
Örnek Giriş Yanıtı (200)
{
"accessToken": {
"token": "eyJ...example...",
"expirationDate": "2025-12-30T08:01:55.306882+03:00"
},
"requiredAuthenticatorType": null
}
Giriş Sonrası İsteklerde Header Kullanımı
Authorization: Bearer <accessToken>
2. Ürünler
Ürün listeleme için aktif istek:
GET https://portalecza.com/api/integration/products/getAll
Yanıt Şeması
| Alan |
Tip |
Açıklama |
Id |
number |
Id |
Sku |
string |
Stok kodu |
Name |
string |
Ürün adı |
Barcode |
string |
Barkod |
PriceNet |
decimal |
KDV hariç fiyat |
PriceGross |
decimal |
KDV dahil fiyat |
Vat |
decimal |
KDV |
Stock |
number |
Stok |
Hata Yanıtları
Postman koleksiyonundaki örneklere göre temel ayrım:
- 400 Validation: İstek formatı veya alan doğrulaması hatalıdır (ModelState /
custom validation).
- 400 Business: İstek formatı doğru olsa da iş kuralı ihlali vardır.
- 401: Kimlik doğrulama başarısızdır (token yok, geçersiz veya süresi
dolmuş).
- 403: Kimlik doğrulama başarılıdır ama bu kaynağa erişim yetkisi yoktur.
- 500: Sunucuda beklenmeyen hata oluşmuştur.
Not: 401 ve 403 örneklerinde HTTP status code 401 döner, response body içindeki
status alanı farklıdır.
400 Validation (örnek)
{
"type": "https://example.com/probs/validation",
"title": "Validation error(s)",
"status": 400,
"detail": "One or more validation errors occurred.",
"Errors": [
{
"Property": "Email",
"Errors": [
"'Email' geçerli bir e-posta adresi değil."
]
}
]
}
400 Business (örnek)
{
"type": "https://example.com/probs/business",
"title": "Rule violation",
"status": 400,
"detail": "Kullanıcı e-postası zaten mevcut."
}
401 (örnek)
{
"type": "https://example.com/probs/authorization",
"title": "Authorization error",
"status": 401,
"detail": "You are not authorized."
}
403 (örnek)
{
"type": "https://example.com/probs/authentication",
"title": "Authentication error",
"status": 403,
"detail": "You are not authenticated."
}
500 (örnek)
{
"type": "https://example.com/probs/internal",
"title": "Internal server error",
"status": 500,
"detail": "Internal server error"
}