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

Sipariş Getir

Tek bir siparişi, liste öğeleriyle aynı alanlarla döndürür (adresler, satırlar, kargo, isteğe bağlı invoice).

URL Parametreleri

ParametreTipAçıklama
idintegerSipariş ID
Fatura: Ayarlandığında invoice şu şekilde görünür: {"type":"url","url":"...","name":"..."} veya null.
PHP
<?php

$baseUrl = 'https://example.com/api/v1';
$apiKey  = 'YOUR_API_KEY';
$orderId = 15;

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 . '/orders/' . (int) $orderId, $apiKey);
print_r($result);
cURL
curl -s -H "X-API-Key: YOUR_API_KEY" \
  -H "Accept: application/json" \
  "https://example.com/api/v1/orders/15"
Örnek Yanıt (JSON)
{
  "id": 15,
  "orderNumber": "FS-20260617-0015",
  "customerFirstName": "Ali",
  "customerLastName": "Yılmaz",
  "customerEmail": "ali@ornek.com",
  "packageTotalPrice": 899.0,
  "statusCode": 2,
  "status": "Picking",
  "statusLabel": "Hazırlanıyor",
  "cargoCompany": "",
  "trackingNumber": "",
  "invoice": null,
  "lines": [
    {
      "lineId": 42,
      "productName": "SolNutrof Total 30 Kapsül",
      "quantity": 1,
      "stockCode": "SOLNUTROF30",
      "lineAmount": 899.0
    }
  ]
}