Firma (Company) İşlemleri
GET /api/external/companies — Firma listesi
Açıklama: Mevcut firmaları listeler. API key'in erişimine göre sonuçlar filtrelenir.
Query Parametreleri
search(string, optional) — Firma adı, kişi adı veya email üzerinde arama.is_active(boolean, optional)limit(integer, optional, default 50)offset(integer, optional, default 0)
Response (başarılı)
{
"success": true,
"data": [
{
"id": "uuid",
"company_name": "Firma A",
"contact_person_name": "Kişi",
"contact_person_email": "[email protected]",
"contact_person_phone": "+90...",
"company_city": "İstanbul",
"is_active": true,
"created_at": "2025-08-26T12:34:56.000000Z"
}
],
"pagination": { "total_count": 1, "limit": 50, "offset": 0, "has_more": false }
}POST /api/external/companies — Firma oluştur
Açıklama: Yeni firma oluşturur. (Detaylı kurallar aşağıdadır)
Header
X-API-Key: requiredContent-Type: application/json
Request Body (JSON)
company_name— required, string, max 255contact_person_name— required, string, max 255contact_person_email— required, email, max 255contact_person_phone— required, string, max 20contact_person_title— nullable, string, max 100company_address— required, string, max 500company_district— nullable, string, max 100company_city— required, string, max 100company_postal_code— nullable, string, max 10is_active— nullable, boolean (default: true)
Başarılı Response (201)
{
"success": true,
"message": "Company created successfully",
"data": {
"id": "31d26468-b80d-49a9-b241-b954a4e451f9",
"company_name": "ACME Test Sanayi A.Ş.",
"contact_person_name": "Ayşe Yılmaz",
"contact_person_email": "[email protected]",
"contact_person_phone": "+905551234567",
"contact_person_title": "Satınalma Müdürü",
"company_address": "Organize Sanayi...",
"company_city": "İstanbul",
"is_active": true,
"created_at": "2025-08-26T12:34:56.000000Z"
}
}Hata Durumları
422 Validation failed — Zorunlu alanlar / format hataları.
409 Email already exists — Aynı contact_person_email daha önce kaydedilmiş.
500 Internal server error — Beklenmeyen hata.
Proje (Project) İşlemleri
GET /api/external/projects — Proje listesi
Query parametreleri: status, user_email, company_id (uuid), date_from, date_to, limit, offset.
Response (başarılı örnek)
{
"success": true,
"data": [
{
"id": "project-uuid",
"project_number": "API-2025-0001",
"name": "CE Marking Project",
"status": "draft",
"product_name": "Smart Controller",
"target_countries": ["Almanya", "Fransa"],
"excluded_countries": ["Çin"],
"capacity_report_url": "https://example.com/report.pdf",
"official_website_url": "https://company.com",
"average_cost": 1500.50,
"unit_cost": 125.75,
"start_date": "2025-08-01",
"end_date": "2025-09-01",
"created_at": "2025-08-01T10:00:00.000000Z",
"company": { "id": "company-uuid", "company_name": "ACME" }
}
],
"pagination": { "total_count": 1, "limit": 50, "offset": 0, "has_more": false }
}GET /api/external/projects/{projectId} — Proje detayları
Path param: projectId (uuid)
Response (başarılı)
{
"success": true,
"data": {
"id": "project-uuid",
"project_number": "API-2025-0001",
"name": "CE Marking Project",
"description": "Ürün CE işaretleme süreci...",
"status": "completed",
"product_name": "Smart Controller",
"product_details": "Akıllı kontrol cihazı teknik detayları...",
"gtip_hs_code": "8537.10.00",
"target_countries": ["Almanya", "Fransa", "İtalya"],
"excluded_countries": ["Çin", "Rusya"],
"product_certificates": "CE, ISO 9001, RoHS belgelerine sahip",
"capacity_report_url": "https://example.com/capacity-report.pdf",
"official_website_url": "https://company-website.com",
"average_cost": 1500.50,
"unit_cost": 125.75,
"currency": "USD",
"priority": "medium",
"start_date": "2025-08-01",
"end_date": "2025-09-01",
"created_at": "2025-08-01T10:00:00.000000Z",
"updated_at": "2025-08-15T14:30:00.000000Z",
"files": [
{ "id": "file-uuid", "original_name": "certificate.pdf", "download_url": "/api/external/projects/project-uuid/files/file-uuid/download" }
],
"metadata": {}
}
}POST /api/external/projects — Proje oluştur
Request Body (validation)
name— required, string, max 255description— nullable, string, max 2000company_id— required, uuid, exists:companies,idproduct_name— required, string, max 255product_details— nullable, string, max 2000gtip_hs_code— nullable, string, max 50target_countries— nullable, array of stringsexcluded_countries— nullable, array of strings (Tercih Edilmeyen Ülkeler)product_certificates— nullable, string, max 2000 (Ürün Sertifikaları/Belgeleri)capacity_report_url— nullable, url, max 500 (Kapasite Raporu URL)official_website_url— nullable, url, max 500 (Resmi Website URL)average_cost— nullable, numeric (Ortalama Maliyet)unit_cost— nullable, numeric (Birim Maliyet)currency— nullable, in:USD,EUR,TRY,GBPproject_type— nullable, stringpriority— nullable, in:low,medium,high,urgentstart_date— nullable, dateend_date— nullable, date, after:start_datemetadata— nullable, array
Başarılı Response (201)
{
"success": true,
"data": {
"id": "project-uuid",
"project_number": "API-2025-0001",
"name": "CE Marking Project",
"company_id": "company-uuid",
"company_name": "ACME",
"status": "draft",
"priority": "medium",
"currency": "USD",
"product_name": "Smart Controller",
"target_countries": ["Almanya", "Fransa", "İtalya"],
"excluded_countries": ["Çin", "Rusya"],
"product_certificates": "CE, ISO 9001, RoHS",
"capacity_report_url": "https://example.com/capacity-report.pdf",
"official_website_url": "https://company-website.com",
"average_cost": 1500.50,
"unit_cost": 125.75,
"created_at": "2025-08-26T12:34:56.000000Z"
}
}PUT /api/external/projects/{projectId}/status — Proje durumu güncelle
Request Body
status— required, in: draft,pending,in_production,completed,cancellednotes— nullable, string, max 2000completed_files— nullable, array of stringsnotification_data— nullable, array
Başarılı Response
{ "success": true, "message": "Project status updated successfully", "data": { "project_id": "project-uuid", "old_status": "draft", "new_status": "completed" } }POST /api/external/projects/{projectId}/approve — Proje onayla
Body: approved (boolean), approval_notes (nullable string), revision_requests (nullable array)
Başarılı Response
{ "success": true, "message": "Project approved successfully", "data": { "project_id": "project-uuid", "status": "approved" } }GET /api/external/projects/{projectId}/files — Proje dosyalarını listele
Query: file_type (document,image,certificate,report,other), include_metadata (boolean)
Response
{
"success": true,
"data": {
"project": { "id": "project-uuid", "project_number": "API-2025-0001" },
"files": [ { "id": "file-uuid", "filename": "certificate.pdf", "download_url": "/api/external/projects/project-uuid/files/file-uuid/download" } ],
"total_files": 1
}
}POST /api/external/projects/{projectId}/files — Projeye dosya yükle
Request (multipart/form-data)
file— required, file, max 10MBfile_type— required, in:analysis_result,certificate,report,otherdescription— nullable, string, max 500is_final— nullable, boolean
Başarılı Response
{ "success": true, "message": "File uploaded successfully", "data": { "file_id": "file-uuid", "original_name": "certificate.pdf", "file_type": "certificate", "file_size": 2048576, "uploaded_at": "2025-08-26T12:34:56.000000Z" } }GET /api/external/projects/{projectId}/files/{fileId}/download — Proje dosyası indir
Response: Dosya stream olarak döner. Eğer dosya bulunamazsa 404 döner.
Abonelik (Subscription) İşlemleri
GET /api/external/subscriptions — Abonelik detayları
Query: user_id (uuid) veya email (email). Döner: kullanıcının abonelikleri, paket ve ürün kullanımları.
Response (örnek)
{
"success": true,
"data": [
{
"subscription_id": "sub-uuid",
"status": "active",
"package": { "id": "pkg-uuid", "name": "Pro Paket" },
"products": [ { "id": "prod-uuid", "name": "CE Sertifika" } ]
}
]
}Destek Talepleri (Support Tickets)
GET /api/external/support/tickets — Destek taleplerini listele
Query parametreleri: status, user_id, limit, offset.
POST /api/external/support/tickets — Destek talebi oluştur
Request Body
user_id— required, uuidtitle— required, stringdescription— required, stringpriority— nullable, in:low,medium,highcategory— nullable, string
Başarılı Response
{ "success": true, "data": { "ticket_id": "ticket-uuid", "ticket_number": "TCK-2025-0001" } }PUT /api/external/support/tickets/{ticketId}/status — Destek talebi durumu güncelle
Body: status (required), örn: open, in_progress, resolved, closed
Notlar:
- Tüm endpointlerde kimlik değerleri (örn.
company_id,projectId,fileId,ticketId) genellikle UUID formatındadır. - Yeni Eklenen Alanlar (2025-09-01):
excluded_countries: Tercih edilmeyen/hariç tutulacak ülkeler listesi (array)product_certificates: Ürün sertifikaları ve belgeler açıklaması (string)capacity_report_url: Kapasite raporu dosyasının URL'si (url)official_website_url: Resmi şirket/ürün website URL'si (url)average_cost: Ortalama maliyet (numeric)unit_cost: Birim maliyet (numeric)
target_countriesveexcluded_countriesJSON array formatında kaydedilir ve response'da array olarak döner.- Maliyet alanları (
average_cost,unit_cost) decimal formatında olup, para birimicurrencyalanında belirtilir.