fature.al eshte platforma e faturimit dhe fiskalizimit per bizneset ne Shqiperi. Hap nje llogari
Skip to content
fature.al API Menu

Perditeso produkt

PUT /api/v1/products/{id} Requires authentication Rate limited by the `api-global` limiter v1

Send a bearer token in the Authorization header.

Perditeson nje produkt ekzistues. Trupi ka te njejtin format si POST /products, prandaj unit_code dhe vat_rate vlejne me te njejtat rregulla.

Ndryshimi i cmimit nuk prek faturat e leshuara: ato mbajne cmimin me te cilin u shiten.

Full URL: https://fature.al/api/v1/products/{id}

Path parameters

Name Type Required Description
id integer yes ID e produktit.

Body parameters

Name Type Required Description
code string, maxLength 255, nullable no Kodi unik i produktit. Gjenerohet vete nese mungon.
name string, maxLength 255 yes Emri i produktit.
description string, maxLength 255, nullable no Pershkrimi. Pa te merret emri.
last_price number, min 0 yes Cmimi i shitjes.
cost_price number, min 0, nullable no Cmimi i blerjes.
vat_rate string, one of 0, 6, 10, 20 yes Shkalla e TVSH.
currency string, maxLength 10, nullable no Monedha. Pa te merret ALL.
service boolean no Sherbim (true) apo artikull inventarizues (false). Pa te merret true.
id_category integer, nullable no ID e kategorise, nga GET /product/categories.

Responses

200 OK

Field Type Description
status boolean
data object
data.product object
data.product.service boolean True for a service, false for an article that is tracked in stock
data.product.category object, nullable The category resolved, or null when the product has none
data.product.category.id integer
data.product.category.name string
data.product.category.color string, nullable Hex colour used by the POS grid
data.product.created_at string, nullable Creation timestamp, ISO 8601

403 Abonimi ka mbaruar, ose veprimi nuk lejohet per kete llogari.

Field Type Description
status boolean Always false. A successful response carries `status: true` and a `data` object instead
message string The exception message. Empty when the failure carries no exception of its own
errors array Messages to show the operator or to log. Absent when the failure has nothing to add beyond `message`

404 Produkti nuk u gjet, ose nuk i perket kompanise suaj.

Field Type Description
status boolean Always false. A successful response carries `status: true` and a `data` object instead
message string The exception message. Empty when the failure carries no exception of its own
errors array Messages to show the operator or to log. Absent when the failure has nothing to add beyond `message`

409 Ekziston tashme nje produkt me kete kod.

Field Type Description
status boolean Always false. A successful response carries `status: true` and a `data` object instead
message string The exception message. Empty when the failure carries no exception of its own
errors array Messages to show the operator or to log. Absent when the failure has nothing to add beyond `message`

422 Te dhenat nuk kaluan validimin. Kjo pergjigje perdor fushen `success`, jo `status`.

Field Type Description
success boolean Always false
message string A single summary line, the same for every validation failure
errors object The failing fields, each with the messages for it. Dotted keys point into nested objects and array items, e.g. `lines.0.quantity`

429 Kufiri i kerkesave u arrit. Kufiri per endpoint kthen zarfin standard te gabimit; kufiri i pergjithshem kthen vetem `message` bashke me header-in `Retry-After`.

Field Type Description
status boolean Always false. A successful response carries `status: true` and a `data` object instead
message string The exception message. Empty when the failure carries no exception of its own
errors array Messages to show the operator or to log. Absent when the failure has nothing to add beyond `message`

500 Gabim i papritur ne server.

Field Type Description
status boolean Always false. A successful response carries `status: true` and a `data` object instead
message string The exception message. Empty when the failure carries no exception of its own
errors array Messages to show the operator or to log. Absent when the failure has nothing to add beyond `message`

Example request

cURL
curl -X PUT 'https://fature.al/api/v1/products/42' \
  -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 '{
    "code": "P001",
    "name": "Kafe Espresso",
    "description": "Kafe espresso e peshuar 18g",
    "last_price": 150,
    "cost_price": 80,
    "vat_rate": 20,
    "currency": "ALL",
    "service": true,
    "id_category": 3
}'
PHP (Laravel)
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',
])->put('https://fature.al/api/v1/products/42', [
    'code' => 'P001',
    'name' => 'Kafe Espresso',
    'description' => 'Kafe espresso e peshuar 18g',
    'last_price' => 150,
    'cost_price' => 80,
    'vat_rate' => 20,
    'currency' => 'ALL',
    'service' => true,
    'id_category' => 3,
]);

$data = $response->json();
PHP (Guzzle)
use GuzzleHttp\Client;

$client = new Client();

$response = $client->request('PUT', 'https://fature.al/api/v1/products/42', [
    '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' => [
        'code' => 'P001',
        'name' => 'Kafe Espresso',
        'description' => 'Kafe espresso e peshuar 18g',
        'last_price' => 150,
        'cost_price' => 80,
        'vat_rate' => 20,
        'currency' => 'ALL',
        'service' => true,
        'id_category' => 3,
    ],
]);

$data = json_decode((string) $response->getBody(), true);
JavaScript
const response = await fetch('https://fature.al/api/v1/products/42', {
  method: 'PUT',
  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({
      "code": "P001",
      "name": "Kafe Espresso",
      "description": "Kafe espresso e peshuar 18g",
      "last_price": 150,
      "cost_price": 80,
      "vat_rate": 20,
      "currency": "ALL",
      "service": true,
      "id_category": 3
  })
});

const data = await response.json();

Example response

200
{
    "status": true,
    "data": {
        "product": {
            "service": true,
            "category": {
                "id": 1,
                "name": "Jane Doe",
                "color": "color"
            },
            "created_at": "created at"
        }
    }
}
403
{
    "status": true,
    "message": "Hello there",
    "errors": [
        "errors"
    ]
}
404
{
    "status": true,
    "message": "Hello there",
    "errors": [
        "errors"
    ]
}
409
{
    "status": true,
    "message": "Hello there",
    "errors": [
        "errors"
    ]
}
422
{
    "success": true,
    "message": "Hello there",
    "errors": []
}
429
{
    "status": true,
    "message": "Hello there",
    "errors": [
        "errors"
    ]
}
500
{
    "status": true,
    "message": "Hello there",
    "errors": [
        "errors"
    ]
}

Regjistrimi eshte falas.

Regjistrohu ne fature.al

This page as Markdown, or the whole API as OpenAPI.