Sayfayı Yazdır | Pencereyi Kapat

CLRest Kullanımı

Nereden Yazdırıldığı: Clomosy | Forum
Kategori: Genel Programlama
Forum Adı: Clomosy ile değişken kullanımı
Forum Tanımlaması: TRObject dili ile değişken tanımlaması ve ekranda gösterme
URL: https://forum.clomosy.com.tr/forum_posts.asp?TID=1222
Tarih: 24 Şubat 2026 Saat 14:17
Program Versiyonu: Web Wiz Forums 12.07 - https://www.webwizforums.com


Konu: CLRest Kullanımı
Mesajı Yazan: M-Guney
Konu: CLRest Kullanımı
Mesaj Tarihi: 11 Kasım 2025 Saat 11:12
Unitler arasında temiz ve performanslı bir şekilde nasıl TCLResti kullanabilirim 30 dan fazla Api bağlantım var ve performans yükü bindirmek istemiyorum. https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" rel="nofollow - https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon="{"version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1,"server_timing":{"name":{"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true},"location_startswith":null}}" crossorigin="anonymous">



Cevaplar:
Mesajı Yazan: Emr.Erkmn
Mesaj Tarihi: 11 Kasım 2025 Saat 11:19
Merhaba Güney, 
Uygulamamız da bir tame birim oluşturalım yani kütüphane oluşturalım (uApı.pas ya da uApiLib). 
Bu yeni unit uygulamanın API yöneticisi olacak
Yeni unitte oluşturalın prosedürile daha yüksek bir performan sergileyebiliriz


https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" rel="nofollow - https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon="{"version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1,"server_timing":{"name":{"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true},"location_startswith":null}}" crossorigin="anonymous">


Mesajı Yazan: M-Guney
Mesaj Tarihi: 11 Kasım 2025 Saat 11:21
uDataLib oluşturdum

void GetConnectDB(TCRest : TCLRest)
{
  try
    if (Clomosy.AppPlatform == 0) // is Windows
    {
      TCRest.BaseURL = 'http://MY-API/';
    }else {
      TCRest.BaseURL = ' https://MY-URL.com.tr/" rel="nofollow - https://MY-URL.com.tr/ ';
    }
    //TCRest.AddHeader('Authorization','Bearer ' + Clomosy.GlobalVariableString);
    TCRest.Execute;
    TCRest.ClearParams;
    TCRest.ClearBody;
  except
  ShowMessage('Exception Class: '+LastExceptionClassName+' Exception Message: '+LastExceptionMessage);
  }
}



Mesajı Yazan: M-Guney
Mesaj Tarihi: 11 Kasım 2025 Saat 11:22
Sonrasında alttaki şekilde çağırdım 
void GetUserPrivilegesV
{
  TableName = TClProButton(MainForm.Clsender).clTagStr;
  OrderID = TClProButton(MainForm.Clsender).clTagInt;
 //TCRest.ClearParams;
  uDataLib.GetConnectDB(TCRest);
  TCRest.Resource = 'privileges';
  TCRest.Accept = 'application/json';
  TCRest.Method = rmGET;
  
  TCRest.AddHeader('Authorization','Bearer ' + Clomosy.GlobalVariableString);
  TCRest.OnCompleted = 'GetUserPrivilegesCompletedV';
  TCRest.ExecuteAsync;
  TCRest.ClearBody;
  
  
}
https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" rel="nofollow - https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon="{"version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1,"server_timing":{"name":{"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true},"location_startswith":null}}" crossorigin="anonymous">


Mesajı Yazan: M-Guney
Mesaj Tarihi: 11 Kasım 2025 Saat 11:23
Fakat bir alt unitte ise hem geç çalışıyor hem de ne kadar istesem de showMessage ile tcl.response u gösteremiyorum

void GetOrderDetailsCompletedV
var
  jsonResponse, NoteString: String;
  Arr : TCLJSONArray;
{
  ShowMessage('query is finished');
  jsonResponse = TCRest.Response;
  ShowMessage('Json Response: '+ jsonResponse);
  Arr = TCLJSONArray.Create;
Arr = TCLJSONArray.CreateFromJSON(jsonResponse);
  if(jsonResponse == ''){
    ShowMessage('Sipariş Detaylar listesi boş herhangi bir sipariş yok.');
  }else{
    noteMemo.Text = Clomosy.CLParseJSON(jsonResponse, '0.note');
    AmountValueLbl.Text = Clomosy.CLParseJSON(jsonResponse, '0.total_price') + 'TL';
    DetailsPnlV(Arr.Count, jsonResponse);
  }
}

void GetOrderDetailsV
{
  ShowMessage('OrderID will be query: '+IntToStr(OrderID));
  TCRest.ClearParams;
  uDataLib.GetConnectDB(TCRest);
  TCRest.Resource = 'orderDetails/' + IntToStr(OrderID);
  TCRest.Accept = 'application/json';
  TCRest.Method = rmGET;
  
  TCRest.AddHeader('Authorization','Bearer ' + Clomosy.GlobalVariableString);
  TCRest.OnCompleted = 'GetOrderDetailsCompletedV';
  TCRest.ExecuteAsync;
  TCRest.ClearBody;
  
}
https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" rel="nofollow - https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon="{"version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1,"server_timing":{"name":{"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true},"location_startswith":null}}" crossorigin="anonymous">


Mesajı Yazan: Emr.Erkmn
Mesaj Tarihi: 11 Kasım 2025 Saat 11:46
Sorunun iki kaynağı var gibi gözüküyor, 
uDataLib.GetConnectDB için de mantık hatası ve  executeAsync  https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" rel="nofollow - https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon="{"version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1,"server_timing":{"name":{"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true},"location_startswith":null}}" crossorigin="anonymous">

void GetConnectDB(TCRest : TCLRest)
{
  try
  {
    if (Clomosy.AppPlatform == 0) // is Windows
    {
      TCRest.BaseURL = 'http://MY-API/';
    }else {
      TCRest.BaseURL = ' https://MY-URL.com.tr/" rel="nofollow - https://MY-URL.com.tr/ ';
    }
  }
  except
  {
    ShowMessage('GetConnectDB Hatası: '+LastExceptionMessage);
  }
}
Execute komutu önce çalışıyor ve yavaşlatıyor. 
Asıl işi yapacak olan ExecuyeAsync komunu çalıştırmayı dene. 
GetConnectDB sadece basel url olarak ayarla,

kod da TclREst'i iki prosedürde de asenkron olarak kullanışmış, 


void GetOrderDetailsV
var
  jsonResponse, NoteString: String;
  Arr : TCLJSONArray;
{
  ShowMessage('OrderID will be query: '+IntToStr(OrderID));
  TCRest.ClearParams;
  
  uDataLib.GetConnectDB(TCRest);
  
  TCRest.Resource = 'orderDetails/' + IntToStr(OrderID);
  TCRest.Accept = 'application/json';
  TCRest.Method = rmGET;
  
  TCRest.AddHeader('Authorization','Bearer ' + Clomosy.GlobalVariableString);
  
  try
    TCRest.Execute;
  except
    ShowMessage('API Hatası (Execute): ' + LastExceptionMessage);
  }

  jsonResponse = TCRest.Response;
  ShowMessage('Json Response: '+ jsonResponse); 
  
  if(jsonResponse == ''){
    ShowMessage('Sipariş Detaylar listesi boş herhangi bir sipariş yok.');
  }else{
    try
      Arr = TCLJSONArray.CreateFromJSON(jsonResponse);
      noteMemo.Text = Clomosy.CLParseJSON(jsonResponse, '0.note');
      AmountValueLbl.Text = Clomosy.CLParseJSON(jsonResponse, '0.total_price') + 'TL';
      DetailsPnlV(Arr.Count, jsonResponse);
    except
      ShowMessage('JSON Ayrıştırma Hatası: ' + LastExceptionMessage);
    }
  }
}




Mesajı Yazan: M-Guney
Mesaj Tarihi: 11 Kasım 2025 Saat 18:10
uDataLib deki fonksiyonumda değişikliğe gittim fakat hala Response'ı çekemiyorum.

function GetWithRes(AResource : String):TCLRest
var 
LRest : TCLRest
{
  LRest = TCLRest.Create;
  try
      if (Clomosy.AppPlatform == 0) // is Windows
      {
        LRest.BaseURL = 'http://MYAPI/';
      }else {
        LRest.BaseURL = ' https://myAPI.com.tr/" rel="nofollow - https://myAPI.com.tr/ ';
      }
      LRest.Resource = AResource;
      LRest.Accept = 'application/json';
      LRest.Method = rmGET;
  
  LRest.AddHeader('Authorization','Bearer ' + Clomosy.GlobalVariableString);
finally
  Result = LRest;
  //LRest.Free;
}
}



void GetOrderDetailsCompletedV(Sender)
var
  jsonResponse: String;
  Arr : TCLJSONArray;
{
  jsonResponse = TCLRest(Sender).Response;
  ShowMessage('Json Response: '+ TCLRest(Sender).Response);
  ShowMessage('query is finished');
  Arr = TCLJSONArray.Create;
Arr = TCLJSONArray.CreateFromJSON(jsonResponse);
  if(jsonResponse == ''){
    ShowMessage('Sipariş Detaylar listesi boş herhangi bir sipariş yok.');
  }else{
    noteMemo.Text = Clomosy.CLParseJSON(jsonResponse, '0.note');
    AmountValueLbl.Text = Clomosy.CLParseJSON(jsonResponse, '0.total_price') + 'TL';
    DetailsPnlV(Arr.Count, jsonResponse);
  }
  TCLRest(Sender).Free;
}

void GetOrderDetailsV
var LRest : TCLRest;
{
  ShowMessage('OrderID will be query: '+IntToStr(OrderID));
  LRest = GetWithRes('orderDetails/' + IntToStr(OrderID));
  
  LRest.OnCompleted = 'GetOrderDetailsCompletedV';
  LRest.ExecuteAsync;
  LRest.ClearBody;
}



https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" rel="nofollow - https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon="{"version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1,"server_timing":{"name":{"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true},"location_startswith":null}}" crossorigin="anonymous">


Mesajı Yazan: Emr.Erkmn
Mesaj Tarihi: 12 Kasım 2025 Saat 09:09
Merhaba Güney,
Tahminim sorun GetOrderDetailsV içinde LRest local olarak tanımlı ExecuteAsync çağrıldıktan sonra scoptan çıkıyor. 
Çözüm olarak LRest'i global veya form seviyesin de tutabilir misin?




function GetWithRes(AResource : String):TCLRest
var 
  LRest : TCLRest
{
  LRest = TCLRest.Create;
  
  Try
  
    if (Clomosy.AppPlatform == 0) 
    {
      LRest.BaseURL = 'http://MYAPI/';
    }
    else 
    {
      LRest.BaseURL = ' https://myAPI.com.tr/" rel="nofollow - https://myAPI.com.tr/ ';
    }
    
    LRest.Resource = AResource;
    LRest.Accept = 'application/json';
    LRest.Method = rmGET;
    LRest.AddHeader('Authorization','Bearer ' + Clomosy.GlobalVariableString);
  
  finally
  
    Result = LRest;
  }
}



var
  OrderDetailsRest: TCLRest;  

void GetOrderDetailsV
{
  Try
    ShowMessage('OrderID will be query: '+IntToStr(OrderID));
    
    if (OrderDetailsRest <> nil)
    {
      Try
        OrderDetailsRest.Free;
        OrderDetailsRest = nil;
      except
      }
    }
    OrderDetailsRest = GetWithRes('orderDetails/' + IntToStr(OrderID));
    
    if (OrderDetailsRest <> nil)
    {
      OrderDetailsRest.OnCompleted = 'GetOrderDetailsCompletedV';
      
      OrderDetailsRest.ExecuteAsync;
      
    }
    else
    {
      ShowMessage('Rest oluşturulamadı!');
    }
  
  except
    ShowMessage('GetOrderDetailsV hatası: ' + LastExceptionMessage);
  }
}

void GetOrderDetailsCompletedV(Sender)
var
  jsonResponse: String;
  Arr : TCLJSONArray;
  restObj: TCLRest;
{
  Try
  
    restObj = TCLRest(Sender);
    
    if (restObj == nil)
    {
      ShowMessage('Response alınamadı: Sender nil!');
      Exit;
    }
    
    jsonResponse = restObj.Response;
    
    ShowMessage('Json Response: ' + jsonResponse);
    ShowMessage('query is finished');
    
    if (Trim(jsonResponse) == '')
    {
      ShowMessage('Sipariş Detaylar listesi boş herhangi bir sipariş yok.');
      
      if (OrderDetailsRest <> nil)
      {
        OrderDetailsRest.Free;
        OrderDetailsRest = nil;
      }
      Exit;
    }
    
    Arr = TCLJSONArray.Create;
    Try
    
      Arr = TCLJSONArray.CreateFromJSON(jsonResponse);
      
      if ((Arr <> nil) && (Arr.Count > 0))
      {
        noteMemo.Text = Clomosy.CLParseJSON(jsonResponse, '0.note');
        AmountValueLbl.Text = Clomosy.CLParseJSON(jsonResponse, '0.total_price') + 'TL';
        DetailsPnlV(Arr.Count, jsonResponse);
      }
      else
      {
        ShowMessage('JSON Array boş veya geçersiz!');
      }
    
    finally
    
      if (Arr <> nil)
      {
        Arr.Free;
        Arr = nil;
      }
    }
    
    if (OrderDetailsRest <> nil)
    {
      OrderDetailsRest.Free;
      OrderDetailsRest = nil;
    }
  
  except
  
    ShowMessage('GetOrderDetailsCompletedV hatası: ' + LastExceptionMessage);
    }
    if (OrderDetailsRest <> nil)
    {
      Try
      
        OrderDetailsRest.Free;
        OrderDetailsRest = nil;
      
      except
      
      }
    }
  }
}



https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" rel="nofollow - https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon="{"version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1,"server_timing":{"name":{"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true},"location_startswith":null}}" crossorigin="anonymous">


Mesajı Yazan: M-Guney
Mesaj Tarihi: 12 Kasım 2025 Saat 09:27
void GetOrderDetailsCompletedV (Sender)
var
  jsonResponse: String;
  Arr : TCLJSONArray;
  restObj: TCLRest;
{
  restObj = TCLRest(Sender);
    
  if (restObj == nil)
  {
    ShowMessage('Response alınamadı: Sender nil!');
    Exit;
  }
  else
  ShowMessage('restObj Response: '+ restObj.Response);
  
  jsonResponse = TCLRest(Sender).Response;
  ShowMessage('Json Response: '+ jsonResponse);
  ShowMessage('query is finished');

bu kısımda öncekileri yazdırmadan query is finished döndürüyor.
https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" rel="nofollow - https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon="{"version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1,"server_timing":{"name":{"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true},"location_startswith":null}}" crossorigin="anonymous">


Mesajı Yazan: Emr.Erkmn
Mesaj Tarihi: 12 Kasım 2025 Saat 09:32
query is finished dönüyorsa muhtemelen response hazır değil ,
önce response'un hazır olup olmadığını kontrol edelim. 

https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" rel="nofollow - https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon="{"version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1,"server_timing":{"name":{"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true},"location_startswith":null}}" crossorigin="anonymous">


Mesajı Yazan: Emr.Erkmn
Mesaj Tarihi: 12 Kasım 2025 Saat 09:35
void GetOrderDetailsCompletedV(Sender)
var
  jsonResponse: String;
  Arr : TCLJSONArray;
  restObj: TCLRest;
  debugInfo: String;
{
  Try
  
    debugInfo = ' DEBUG BAŞLADI' + #13#10;
    
    restObj = TCLRest(Sender);
    
    if (restObj == nil)
    {
      ShowMessage(' Sender nil!');
      Exit;
    }
    
    debugInfo = debugInfo + 'Sender OK' + #13#10;
    
    
    jsonResponse = restObj.Response;
    debugInfo = debugInfo + ' Response uzunluğu: ' + IntToStr(Length(jsonResponse)) + #13#10;
    
    if (Length(jsonResponse) == 0)
    {
      debugInfo = debugInfo + '️ Response BOŞ!' + #13#10;
      debugInfo = debugInfo + 'query is finished (boş)' + #13#10;
      ShowMessage(debugInfo);  
      Exit;
    }
    
    debugInfo = debugInfo + ' Response: ' + 
                Copy(jsonResponse, 1, 200) + 
                IfThen(Length(jsonResponse) > 200, '...', '') + #13#10;
    
    Arr = TCLJSONArray.Create;
    Try
    
      Arr = TCLJSONArray.CreateFromJSON(jsonResponse);
      
      if ((Arr == nil) || (Arr.Count == 0))
      {
        debugInfo = debugInfo + '️ JSON Array boş!' + #13#10;
        debugInfo = debugInfo + 'query is finished (boş array)' + #13#10;
        ShowMessage(debugInfo);
        Exit;
      }
      
      noteMemo.Text = Clomosy.CLParseJSON(jsonResponse, '0.note');
      AmountValueLbl.Text = Clomosy.CLParseJSON(jsonResponse, '0.total_price') + 'TL';
      DetailsPnlV(Arr.Count, jsonResponse);
      
      debugInfo = debugInfo + 'Veriler işlendi! Count: ' + IntToStr(Arr.Count) + #13#10;
      debugInfo = debugInfo + ' query is finished (başarılı)' + #13#10;
      
      ShowMessage(debugInfo);
    
    finally
    
      if (Arr <> nil)
      {
        Arr.Free;
        Arr = nil;
      }
    }
  
  except
  
    ShowMessage('Hata: ' + LastExceptionMessage);
  }
}
https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" rel="nofollow - https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon="{"version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1,"server_timing":{"name":{"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true},"location_startswith":null}}" crossorigin="anonymous">


Mesajı Yazan: Emr.Erkmn
Mesaj Tarihi: 12 Kasım 2025 Saat 09:37
void GetOrderDetailsCompletedV(Sender)
var
  jsonResponse: String;
  Arr : TCLJSONArray;
  restObj: TCLRest;
  responseLength: Integer;
{
  Try
  
    restObj = TCLRest(Sender);
    
    if (restObj == nil)
    {
      ShowMessage(' HATA: Sender nil! Response alınamadı!');
      Exit;
    }
    
    jsonResponse = restObj.Response;
    responseLength = Length(jsonResponse);
    
    if (responseLength == 0)
    {
      ShowMessage('️ UYARI: Response boş! (0 karakter)');
      ShowMessage('query is finished (boş response)');
      Exit;  
    }
    
    ShowMessage(' restObj Response: ' + 
                IfThen(responseLength > 200, 
                       Copy(jsonResponse, 1, 200) + '...', 
                       jsonResponse));
    
    Arr = TCLJSONArray.Create;
    Try
      Arr = TCLJSONArray.CreateFromJSON(jsonResponse);
      
      if ((Arr == nil) || (Arr.Count == 0))
      {
        ShowMessage('JSON Array boş!');
        ShowMessage('query is finished (boş array)');
        Exit;
      }
      
      noteMemo.Text = Clomosy.CLParseJSON(jsonResponse, '0.note');
      AmountValueLbl.Text = Clomosy.CLParseJSON(jsonResponse, '0.total_price') + 'TL';
      DetailsPnlV(Arr.Count, jsonResponse);
    finally
      if (Arr <> nil)
      {
        Arr.Free;
        Arr = nil;
      }
    
    
    ShowMessage(' query is finished (başarılı)');
  }
  except
    ShowMessage(' Hata: ' + LastExceptionMessage);
  }
}
https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" rel="nofollow - https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon="{"version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1,"server_timing":{"name":{"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true},"location_startswith":null}}" crossorigin="anonymous">


Mesajı Yazan: M-Guney
Mesaj Tarihi: 12 Kasım 2025 Saat 09:56
 Ne yapmam gerkiyor hiçbir fikrim yok bu konuda https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" rel="nofollow - https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon="{"version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1,"server_timing":{"name":{"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true},"location_startswith":null}}" crossorigin="anonymous">


Mesajı Yazan: Emr.Erkmn
Mesaj Tarihi: 12 Kasım 2025 Saat 10:56
response  hazır değildi, 
gönderdiğim kodda debugla kontrol ettik, showMessage sıralamasını düzenledik 
https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" rel="nofollow - https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon="{"version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1,"server_timing":{"name":{"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true},"location_startswith":null}}" crossorigin="anonymous">


Mesajı Yazan: M-Guney
Mesaj Tarihi: 12 Kasım 2025 Saat 11:13
    ShowMessage(' restObj Response: ' + 
                IfThen(responseLength > 200, 
                       Copy(jsonResponse, 1, 200) + '...', 
                       jsonResponse));

Bu kısımda Unicode'u stringe çeviremedim hatası veriyor.
https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" rel="nofollow - https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon="{"version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1,"server_timing":{"name":{"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true},"location_startswith":null}}" crossorigin="anonymous">


Mesajı Yazan: M-Guney
Mesaj Tarihi: 12 Kasım 2025 Saat 11:20
If (responseLength > 200){
       jsonOutput = Copy(jsonResponse, 1, 200) + '...' + jsonResponse;
      
    }
    ShowMessage(' restObj Response: ' + jsonOutput);
Bu şekilde denedim ve aynı şekilde yine burayı yazdırmadı restObj Response yazısı hiç oluşturulmuyor boş bile olsa oluşturmuyor.
https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" rel="nofollow - https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon="{"version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1,"server_timing":{"name":{"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true},"location_startswith":null}}" crossorigin="anonymous">


Mesajı Yazan: Emr.Erkmn
Mesaj Tarihi: 12 Kasım 2025 Saat 11:27

ifthen den dolayı hata veriyor olabilir

jsonResponse = restObj.Response;
    responseLength = Length(jsonResponse);
    
    if (responseLength == 0)
    {
      ShowMessage(' Response boş!');
      ShowMessage('query is finished (boş)');
      Exit;
    }
    
    if (responseLength > 200)
    {
      displayResponse = Copy(jsonResponse, 1, 200) + '...';
    }
    else
    {
      displayResponse = jsonResponse;
    }

daha basit kullanım için 
 if (Trim(jsonResponse) == '')
    {
      ShowMessage('️ Response boş!');
      ShowMessage('query is finished (boş)');
      Exit;
    }
    
    ShowMessage(' Response alındı: ' + IntToStr(Length(jsonResponse)) + ' karakter'); 
https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" rel="nofollow - https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon="{"version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1,"server_timing":{"name":{"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true},"location_startswith":null}}" crossorigin="anonymous">


Mesajı Yazan: M-Guney
Mesaj Tarihi: 12 Kasım 2025 Saat 11:55
Gösterememe nedenim json inputumun içinde resmi de veriyor olmammış resmi farklı bir endpoint üzerinden yollayınca çözüldü. https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" rel="nofollow - https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon="{"version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1,"server_timing":{"name":{"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true},"location_startswith":null}}" crossorigin="anonymous">



Sayfayı Yazdır | Pencereyi Kapat

Forum Software by Web Wiz Forums® version 12.07 - https://www.webwizforums.com
Copyright ©2001-2024 Web Wiz Ltd. - https://www.webwiz.net