Ürünler

Ürün listesini ve ürün detayını döndürür.

Ürünleri Getirme

Geçerli dile ait ürünleri listeler. Sayfa başına 50 ürün gösterilir.

API URL Method Response
/api/products/{$id} GET application/json

Parametreler

Parametre Açıklama Tür Zorunlu
id id numaralı dile ait ürünler. Int Evet

Diğer sayfalara ait ürünleri çekmek için ?page= parametresini göndermelisiniz. Örneğin .../products/1?page=2

Örnek PHP Kodu
<?php
    header('Content-type: application/json');
    $id = 1;
    $apiUri = "http://siteadresiniz.com/api/products/{$id}";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $apiUri);
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
    curl_setopt($ch, CURLOPT_USERPWD, "username:password");
    exit(curl_exec($ch));
Örnek PHP Kodu (Sayfa numarası için)
<?php
    header('Content-type: application/json');
    $id = 1;
    $apiUri = "http://siteadresiniz.com/api/products/{$id}?page=2";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $apiUri);
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
    curl_setopt($ch, CURLOPT_USERPWD, "username:password");
    exit(curl_exec($ch));
Çıktı
[
  {
    "id": 2,
    "categories": "[\"1\"]",
    "brand_id": 1,
    "product_code": "12313233",
    "price": "11.00",
    "shipping_cost": "0.0",
    "discount": 0,
    "shipping_time": "2-3 iş günü",
    "tax_rate": 0,
    "min_limit": 1,
    "max_limit": 10,
    "stock": 9,
    "hit": 8,
    "amount_order": 6,
    "amount_favorite": 1,
    "amount_comment": 0,
    "sum_point": 0,
    "sso_img": "MTYyODhiMTYyN2Y3YWQ.png",
    "status": "publish",
    "created": "2022-05-21 12:31:14",
    "product_id": 2,
    "lang_id": 1,
    "title": "test",
    "seo_title": "test",
    "slug": "test",
    "description": "test",
    "content": "<p>test</p>",
    "tags": ""
  }
]

Ürün Detay Getirme

Gönderilen ürün id'ye göre ürünün tüm detaylarını getirir.

API URL Method Response
/api/products/get/{$langId}/{$id} GET application/json

Parametreler

Parametre Açıklama Tür Zorunlu
langId Dil id Int Evet
id Ürün id Int Evet
Örnek PHP Kodu
<?php
    header('Content-type: application/json');
    $langId = 1;
    $id = 1;
    $apiUri = "http://siteadresiniz.com/api/products/get/{$langId}/{$id}";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $apiUri);
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
    curl_setopt($ch, CURLOPT_USERPWD, "username:password");
    exit(curl_exec($ch));
Çıktı
{
  "id": 2,
  "categories": "[\"1\"]",
  "brand_id": 1,
  "product_code": "12313233",
  "price": "11.00",
  "shipping_cost": "0.0",
  "discount": 0,
  "shipping_time": "2-3 iş günü",
  "tax_rate": 0,
  "min_limit": 1,
  "max_limit": 10,
  "stock": 9,
    ....
}

Stok Kod İle Ürün Getirme

Gönderilen ürün koduna göre ürünün tüm detaylarını getirir.

API URL Method Response
/api/products/getWithStock/{$langId}/{$productCode} GET application/json

Parametreler

Parametre Açıklama Tür Zorunlu
langId Dil id Int Evet
productCode Ürün kodu Mixed Evet
Örnek PHP Kodu
<?php
    header('Content-type: application/json');
    $langId = 1;
    $stockCode = 123123;
    $apiUri = "http://siteadresiniz.com/api/products/getWithStock/{$langId}/{$stockCode}";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $apiUri);
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
    curl_setopt($ch, CURLOPT_USERPWD, "username:password");
    exit(curl_exec($ch));
Çıktı
{
  "id": 2,
  "categories": "[\"1\"]",
  "brand_id": 1,
  "product_code": "12313233",
  "price": "11.00",
  "shipping_cost": "0.0",
  "discount": 0,
  "shipping_time": "2-3 iş günü",
  "tax_rate": 0,
  "min_limit": 1,
  "max_limit": 10,
  "stock": 9,
    ....
}

Geçersiz ID girdiğinizde boş array dönmektedir.