Soldaki menüden bir modül/ekran seçerek o ekranın çağırdığı uç noktaları görebilirsiniz. Başlamadan önce bir erişim jetonu (access token) almanız gerekir.
API, OAuth 2.0 / OpenID Connect (OpenIddict) kullanır. Jeton, şifre (password) akışı ile alınır. Token uç noktası:
POSThttps://auth.harmonyerp.cloud/connect/token
Gövde (application/x-www-form-urlencoded) alanları:
| Alan | Değer | Açıklama |
|---|---|---|
grant_type | password | Sabit. |
username | e-posta / kullanıcı adı | Kullanıcının giriş bilgisi. |
password | şifre | Kullanıcının şifresi. |
client_id | Erp_App | Sabit. Şifre akışı yalnızca bu client ile kabul edilir; gizli anahtar (secret) yoktur. |
scope | Erp | API erişim kapsamı. |
cURL örneği:
curl -k -X POST https://auth.harmonyerp.cloud/connect/token -H "Content-Type: application/x-www-form-urlencoded" -d "grant_type=password" -d "username=KULLANICI_ADI" -d "password=SIFRE" -d "client_id=Erp_App" -d "scope=Erp"
Örnek yanıt:
{
"access_token": "eyJhbGciOi...",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "Erp"
}
Alınan access_token'ı her API isteğinde Authorization başlığında gönderin. API tabanı:
https://api.harmonyerp.cloud
curl -k https://api.harmonyerp.cloud/api/app/material/getAll -H "Authorization: Bearer ACCESS_TOKEN"
JavaScript (fetch) örneği:
// Tekil kayıt (GET): material/get/{id}
const res = await fetch("https://api.harmonyerp.cloud/api/app/material/get/5", {
headers: { "Authorization": "Bearer ACCESS_TOKEN" }
});
const data = await res.json();
// Listeleme (POST): material/getAll
const listRes = await fetch("https://api.harmonyerp.cloud/api/app/material/getAll", {
method: "POST",
headers: {
"Authorization": "Bearer ACCESS_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
sorting: "Id",
maxResultCount: 50,
skipCount: 0,
data: {} // filtre alanları
})
});
const list = await listRes.json();
https://api.harmonyerp.cloud, kimlik: https://auth.harmonyerp.cloud).client_id mutlaka Erp_App olmalıdır; sistem şifre akışını yalnızca bu client için kabul eder.