Dış ERP Entegrasyon API'si
MindAeon; SAP, Logo, Mikro, Netsis ve tüm kurumsal sistemlerle sunucu-sunucu (makine-to-makine) entegrasyon için tenant-kapsamlı REST API sunar. Kimlik doğrulama OAuth2 client_credentials akışıyla yapılır; tüm public uçlar /api/v1/* altında sürümlenir. Aşağıdaki 3 adımı izleyin.
1 API İstemcisi oluşturun
MindAeon Web'de Entegrasyon → API İstemcileri → Yeni İstemci. İstemci adını girin, gereken yetkileri (scope) seçin, oluşturun. Client Secret yalnız bir kez gösterilir — güvenli bir yere kaydedin. Yalnız hash'i saklanır.
| Scope | Verdiği yetki |
|---|---|
products:write | Ürün upsert |
products:read | Ürün okuma |
customers:write | Cari upsert |
warehouses:write | Depo upsert |
stock:read | Stok sorgu |
2 Token alın
POST /api/v1/auth/token — istemci kimliğinizle kısa ömürlü (30 dk) erişim token'ı alın. Makine istemcileri refresh token almaz; süre dolunca yeniden token isteyin.
curl -X POST "https://mobil.androidsahasatis.com/api/v1/auth/token" \
-H "Content-Type: application/json" \
-d '{
"grantType": "client_credentials",
"companyCode": "DEMO",
"clientId": "mac_x8Kd...",
"clientSecret": "P7f...=="
}'
Yanıt:
{
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"tokenType": "Bearer",
"expiresIn": 1800,
"scope": "products:write customers:write stock:read"
}
companyCode firma (tenant) kodunuzdur. Yanlış kimlik / pasif / süresi dolmuş istemci → 401 { "error": "invalid_client" }.3 Çağrı yapın
Her istekte Authorization: Bearer <accessToken> başlığını gönderin.
POST Ürün upsert (bulk, idempotent)
externalCode eşleştirme anahtarıdır (yoksa code); aynı externalCode ile ikinci gönderim güncelleme sayılır (mükerrer-güvenli).
curl -X POST "https://mobil.androidsahasatis.com/api/v1/products:upsert" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '[
{ "externalCode":"ERP-1001", "code":"URN0001", "name":"Kalem",
"stockType":"Product", "trackingType":"None",
"gtin":"8690000000001", "salesVatRate":20, "isActive":true }
]'
# → { "created":1, "updated":0, "failed":0, "errors":[] }
POST Cari / Depo upsert
POST https://mobil.androidsahasatis.com/api/v1/customers:upsert # Customer.Edit / customers:write POST https://mobil.androidsahasatis.com/api/v1/warehouses:upsert # Warehouse.Edit / warehouses:write
GET Stok sorgu (çok-depo)
curl "https://mobil.androidsahasatis.com/api/v1/stock?warehouseCode=WH01&productCode=URN0001" \
-H "Authorization: Bearer $TOKEN"
# → { "asOf":"...", "items":[
# { "warehouseCode":"WH01","warehouseName":"Merkez Depo",
# "productCode":"URN0001","productName":"Kalem",
# "unitCode":"ADET","quantity":150.0 } ] }
quantity = stok hareketlerinin net toplamıdır (giriş − çıkış).Kod Örnekleri (Diller)
Aynı akış (token al → ürün upsert) farklı dillerde. clientId/clientSecret yerine kendi istemci bilgilerinizi, DEMO yerine firma kodunuzu yazın.
TOKEN=$(curl -s -X POST "https://mobil.androidsahasatis.com/api/v1/auth/token" \
-H "Content-Type: application/json" \
-d '{"grantType":"client_credentials","companyCode":"DEMO","clientId":"mac_...","clientSecret":"..."}' \
| sed -n 's/.*"accessToken":"\([^"]*\)".*/\1/p')
curl -X POST "https://mobil.androidsahasatis.com/api/v1/products:upsert" \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '[{"externalCode":"ERP-1001","code":"URN0001","name":"Kalem","stockType":"Product","isActive":true}]'
using System.Net.Http.Json;
var http = new HttpClient();
var tokenResp = await http.PostAsJsonAsync("https://mobil.androidsahasatis.com/api/v1/auth/token", new {
grantType = "client_credentials", companyCode = "DEMO",
clientId = "mac_...", clientSecret = "..." });
var auth = await tokenResp.Content.ReadFromJsonAsync<TokenResp>();
http.DefaultRequestHeaders.Authorization = new("Bearer", auth!.accessToken);
var res = await http.PostAsJsonAsync("https://mobil.androidsahasatis.com/api/v1/products:upsert", new[] {
new { externalCode = "ERP-1001", code = "URN0001", name = "Kalem", stockType = "Product", isActive = true }
});
Console.WriteLine(await res.Content.ReadAsStringAsync());
record TokenResp(string accessToken, string tokenType, int expiresIn, string scope);
import requests
api = "https://mobil.androidsahasatis.com"
tok = requests.post(f"{api}/api/v1/auth/token", json={
"grantType": "client_credentials", "companyCode": "DEMO",
"clientId": "mac_...", "clientSecret": "..."}).json()
headers = {"Authorization": f"Bearer {tok['accessToken']}"}
res = requests.post(f"{api}/api/v1/products:upsert", headers=headers, json=[
{"externalCode": "ERP-1001", "code": "URN0001", "name": "Kalem",
"stockType": "Product", "isActive": True}])
print(res.json())
const api = "https://mobil.androidsahasatis.com";
const tok = await (await fetch(`${api}/api/v1/auth/token`, {
method: "POST", headers: { "Content-Type": "application/json" },
body: JSON.stringify({ grantType: "client_credentials", companyCode: "DEMO",
clientId: "mac_...", clientSecret: "..." })
})).json();
const res = await fetch(`${api}/api/v1/products:upsert`, {
method: "POST",
headers: { "Authorization": `Bearer ${tok.accessToken}`, "Content-Type": "application/json" },
body: JSON.stringify([{ externalCode: "ERP-1001", code: "URN0001", name: "Kalem",
stockType: "Product", isActive: true }])
});
console.log(await res.json());
<?php
$api = "https://mobil.androidsahasatis.com";
$authBody = json_encode(["grantType"=>"client_credentials","companyCode"=>"DEMO",
"clientId"=>"mac_...","clientSecret"=>"..."]);
$tok = json_decode(file_get_contents("$api/api/v1/auth/token", false, stream_context_create([
"http"=>["method"=>"POST","header"=>"Content-Type: application/json","content"=>$authBody]])), true);
$body = json_encode([["externalCode"=>"ERP-1001","code"=>"URN0001","name"=>"Kalem",
"stockType"=>"Product","isActive"=>true]]);
echo file_get_contents("$api/api/v1/products:upsert", false, stream_context_create([
"http"=>["method"=>"POST",
"header"=>"Authorization: Bearer {$tok['accessToken']}\r\nContent-Type: application/json",
"content"=>$body]]));
Canlı referans
Tüm uçların şeması, örnek gövdeleri ve "dene" arayüzü için Scalar referansını kullanın. OpenAPI 3 belgesi her ortamda üretilir.
Scalar API Referansı → openapi/v1.json
Güvenlik notları
- Token tenant-kapsamlıdır; yalnız istemcinizin firmasının verisine erişir.
- Erişim, seçtiğiniz scope'larla sınırlıdır (çift kapı: lisans modülü + izin). Scope dışı çağrı →
403. - Client Secret sistemde yalnız hash olarak saklanır (PBKDF2/SHA256, sabit-zaman doğrulama).
- İstemci iptal edilirse (
IsActive=false) veya süresi dolarsa yeni token üretilemez; yayınlanmış token doğal süresiyle (≤30 dk) sonlanır.
Lisanslama & Roller
- API erişimi rol/scope tanımlı istemcilerle olur: her istemciye yalnız gereken yetkiler (scope) verilir; kapsam dışı çağrı
403alır. - Her aktif API istemcisi, lisanstaki kullanıcı sayısına dahildir (ücretlidir). Yeni API istemcisi oluşturma, aktif kullanıcı + aktif API istemcisi toplamı lisans kullanıcı limitini aşamaz; aşımda oluşturma engellenir ve limiti artırmanız istenir.
- Admin/sistem yönetimi uçları API'ye kapalıdır; API yalnız iş modülü verilerine (okuma/yazma) erişir.