Frisay Api ile Siparişleri Çekme

0 Replies, 43 Views

Frisay apiden siparişleri çekmek için örnek kod

PHP Kod:
<?php
/**
 * Frisay Web API test paneli (yerel geliştirme).
 * Kullanım: http://localhost/frisay/tools/api-test.php
 * API anahtarını Admin → Ayarlar → Web API bölümünden alın.
 */

error_reporting(E_ALL);
ini_set('display_errors'1);

$baseUrl 'http://localhost/frisay/api/v1'// sitenizin linki
$apiKey  'XXXXXX'// Admin panelden kopyalayın
$result  '';

function 
apiRequest($method$url$apiKey$data null)
{
    
$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 => false,
    ]);

    if (
$data !== null) {
        
curl_setopt($chCURLOPT_POSTFIELDSjson_encode($dataJSON_UNESCAPED_UNICODE));
    }

    
$response curl_exec($ch);
    
$httpCode curl_getinfo($chCURLINFO_HTTP_CODE);
    
$error curl_error($ch);

    
curl_close($ch);

    return [
        
'http_code' => $httpCode,
        
'curl_error' => $error,
        
'response' => json_decode($responsetrue) ?: $response,
    ];
}
$result apiRequest('GET'$baseUrl '/orders?page=0&size=20'$apiKey);
echo 
'<pre>';
print_r($result);
echo 
'</pre>'
Frisay E-Commerce Admin
(Son Düzenleme: 18.06.2026, 05:54 PM, Düzenleyen: bera.)

Bu Konudaki Yorumlar
Frisay Api ile Siparişleri Çekme - Yazar: bera - 18.06.2026, 05:54 PM



Konuyu Okuyanlar: 1 Ziyaretçi