GET https://example.com/api/v1/products/{id}

Ürün Getir

Tek bir ürünü tam detaylarıyla döndürür: açıklamalar, görseller, varyasyonlar ve çeviriler.

URL Parametreleri

ParametreTipAçıklama
idintegerÜrün ID

Query Parametreleri

ParametreTipZorunluAçıklama
langstringHayırYerelleştirilmiş alanlar için tercih edilen dil
PHP
<?php

$baseUrl = 'https://example.com/api/v1';
$apiKey  = 'YOUR_API_KEY';
$productId = 6;

function apiRequest(string $method, string $url, string $apiKey, ?array $data = null): array
{
    $ch = curl_init();
    $headers = [
        'X-API-Key: ' . trim($apiKey),
        'Accept: application/json',
    ];
    if ($data !== null) {
        $headers[] = 'Content-Type: application/json';
    }
    curl_setopt_array($ch, [
        CURLOPT_URL => $url,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_CUSTOMREQUEST => $method,
        CURLOPT_HTTPHEADER => $headers,
        CURLOPT_SSL_VERIFYPEER => true,
    ]);
    if ($data !== null) {
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data, JSON_UNESCAPED_UNICODE));
    }
    $response = curl_exec($ch);
    $httpCode = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE);
    $error = curl_error($ch);
    curl_close($ch);
    $decoded = json_decode((string) $response, true);
    return [
        'http_code' => $httpCode,
        'curl_error' => $error,
        'response' => is_array($decoded) ? $decoded : $response,
    ];
}

$result = apiRequest('GET', $baseUrl . '/products/' . (int) $productId, $apiKey);
print_r($result);
cURL
curl -s -H "X-API-Key: YOUR_API_KEY" \
  -H "Accept: application/json" \
  "https://example.com/api/v1/products/6"
Örnek Yanıt (JSON)
{
  "success": true,
  "lang": "tr",
  "data": {
    "id": 6,
    "name": "Pamuklu Tişört",
    "slug": "pamuklu-tisort",
    "price": 199.99,
    "old_price": 0,
    "stock": 15,
    "active": 1,
    "barcode": "86991233322",
    "stock_code": "fs123",
    "category_name": "Test Category",
    "brand_name": "Test Brand",
    "description_html": "<p>Yumuşak kumaş</p>",
    "has_variations": true,
    "images": [
      {
        "id": 12,
        "url": "https://example.com/img/products/12.jpg",
        "cover": true
      }
    ],
    "variations": [
      {
        "id": 1,
        "sku": "TSH-RED-M",
        "barcode": "8690000001001",
        "options": { "Color": "Red", "Size": "M" },
        "price": 249.9,
        "stock": 12,
        "active": 1
      }
    ],
    "translations": {
      "tr": {
        "name": "Pamuklu Tişört",
        "slug": "pamuklu-tisort",
        "description_html": "<p>Yumuşak kumaş</p>"
      },
      "en": {
        "name": "Cotton T-Shirt",
        "slug": "cotton-t-shirt",
        "description_html": "<p>Soft fabric</p>"
      }
    }
  }
}