/api/v1/on-boarding/user
Requires authentication
Rate limited by the `api-global` limiter
v1
Send a bearer token, plus the X-Client-Id and X-Client-Secret headers in the Authorization header.
Krijon një përdorues operator të kompanisë dhe kthen token-in e tij. Çdo person që lëshon fatura ka përdoruesin e vet, sepse kodi i operatorit dhe pajisja fiskale janë të përdoruesit.
emailështë i detyrueshëm dhe unik në gjithë fature.al, jo vetëm brenda kompanisë.branchIdduhet të jetë njësi e kompanisë suaj.operatorCodemerret nga self-care. Për fatura cash dërgoni edhefiscalTcrCode, kodin që ktheuPOST /on-boarding/fiscal-device; një kod që nuk gjendet e lë përdoruesin pa pajisje, pa gabim.namedhephonejanë opsionale.- Body nuk validohet veçmas, prandaj çdo refuzim vjen me
200dhestatus: false.
Ruani token-in: kthehet vetëm një herë dhe është ai me të cilin ky përdorues thërret API-në.
URL-ja e plotë: https://fature.al/api/v1/on-boarding/user
Body parameters
| Name | Tipi | E detyrueshme | Përshkrimi |
|---|---|---|---|
| branchId | integer | yes | Id-ja e njësisë së biznesit ku punon përdoruesi. |
| string | yes | Email-i i përdoruesit, unik në fature.al. Shërben për identifikim; token-i kthehet në përgjigje. | |
| name | string | yes | Emri i përdoruesit. |
| phone | string | no | Numri i telefonit. |
| fiscalTcrCode | string | no | Kodi TCR i pajisjes fiskale që do të përdorë përdoruesi. Vetëm për fatura cash. |
| operatorCode | string | no | Kodi i operatorit, i marrë nga self-care. I domosdoshëm për lëshimin e faturave. |
Përgjigjet
200 Kur `email` mungon ose është në përdorim, kur njësia nuk gjendet, ose kur ruajtja dështon, përgjigja kthehet me HTTP 200 dhe `status: false`; arsyeja është te `message` ose te `errors`.
| Field | Tipi | Përshkrimi |
|---|---|---|
| status | boolean | |
| data | object | |
| data.user | object | |
| data.user.id | integer | Id-ja e përdoruesit në fature.al |
| data.user.name | string | Emri i përdoruesit |
| data.user.operatorCode | string | Kodi i operatorit, siç u dërgua |
| data.user.token | string | Token-i API i përdoruesit, 96 shkronja dhe shifra. Kthehet vetëm një herë; me të ky përdorues thërret API-në |
401 Unauthenticated
| Field | Tipi | Përshkrimi |
|---|---|---|
| message | string |
Shembull kërkese
curl -X POST 'https://fature.al/api/v1/on-boarding/user' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'X-Client-Id: YOUR_CLIENT_ID' \
-H 'X-Client-Secret: YOUR_CLIENT_SECRET' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"branchId": 12,
"email": "[email protected]",
"name": "Ana Hoxha",
"phone": "0691234567",
"fiscalTcrCode": "ab123ab123",
"operatorCode": "aa123aa123"
}'
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'Authorization' => 'Bearer YOUR_TOKEN',
'X-Client-Id' => 'YOUR_CLIENT_ID',
'X-Client-Secret' => 'YOUR_CLIENT_SECRET',
'Accept' => 'application/json',
'Content-Type' => 'application/json',
])->post('https://fature.al/api/v1/on-boarding/user', [
'branchId' => 12,
'email' => '[email protected]',
'name' => 'Ana Hoxha',
'phone' => '0691234567',
'fiscalTcrCode' => 'ab123ab123',
'operatorCode' => 'aa123aa123',
]);
$data = $response->json();
use GuzzleHttp\Client;
$client = new Client();
$response = $client->request('POST', 'https://fature.al/api/v1/on-boarding/user', [
'headers' => [
'Authorization' => 'Bearer YOUR_TOKEN',
'X-Client-Id' => 'YOUR_CLIENT_ID',
'X-Client-Secret' => 'YOUR_CLIENT_SECRET',
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
'json' => [
'branchId' => 12,
'email' => '[email protected]',
'name' => 'Ana Hoxha',
'phone' => '0691234567',
'fiscalTcrCode' => 'ab123ab123',
'operatorCode' => 'aa123aa123',
],
]);
$data = json_decode((string) $response->getBody(), true);
const response = await fetch('https://fature.al/api/v1/on-boarding/user', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'X-Client-Id': 'YOUR_CLIENT_ID',
'X-Client-Secret': 'YOUR_CLIENT_SECRET',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"branchId": 12,
"email": "[email protected]",
"name": "Ana Hoxha",
"phone": "0691234567",
"fiscalTcrCode": "ab123ab123",
"operatorCode": "aa123aa123"
})
});
const data = await response.json();
Shembull përgjigjeje
{
"status": true,
"data": {
"user": {
"id": 8,
"name": "Ana Hoxha",
"operatorCode": "aa123aa123",
"token": "E7fH4gJ1hK9jL6mN3pQ8rS5tU2vW7xZ0k7Qm2ZpX9vL4rT1nB8wJ3cH6yF0sD5aG2eV7uN4iK9oP1lM8qR3tW6xY0zA5bC2d"
}
}
}
{
"message": "Unauthenticated."
}