![]() |
| Clomosy Resmi Forum Sitesidir. Amacımız kullanıcılarımıza, iş ortaklarımıza, danışmanlara, yazılımcılara programlarımız hakkında destek ve bilgi vermektir. |
TCL Rest kullanımı |
Yanıt Yaz
|
| Yazar | |
M-Guney
Kıdemli Üye
Kayıt Tarihi: 16 Eylül 2025 Konum: Konya, Meram, K Durum: Aktif Değil Puanlar: 114 |
Mesaj Seçenekleri
Teşekkürler(0)
Alıntı Cevapla
Konu: TCL Rest kullanımıGönderim Zamanı: 18 Saat 2 Dakika Önce Saat 16:55 |
|
Birden fazla resmi Base64 formatında API'mdan yollayıp kullanmak istiyorum fakat bana boş dönüyor ne yapmam gerekiyor.
void GetItems var LRest : TCLRest; { LRest = uDataLib.GetWithRes('category-images'); //LRest = uDataLib.GetImageWithRes('category-images'); //For images LRest.OnCompleted = 'GetItemsCompletedV'; LRest.ExecuteAsync; LRest.ClearBody; } 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">
function GetWithRes(AResource : String):TCLRest var LRest : TCLRest { LRest = TCLRest.Create; try if (Clomosy.AppPlatform == 0) // is Windows { LRest.BaseURL = 'http://172.16.222.25:3000/'; }else { LRest.BaseURL = 'https://m-guney.com.tr/'; } LRest.Resource = AResource; LRest.Accept = 'application/json'; LRest.Method = rmGET; LRest.AddHeader('Authorization','Bearer ' + Clomosy.GlobalVariableString); finally Result = LRest; //LRest.Free; } } function GetImageWithRes(AResource : String):TCLRest var LRest : TCLRest { LRest = TCLRest.Create; try if (Clomosy.AppPlatform == 0) // is Windows { LRest.BaseURL = 'http://172.16.222.25:3000/'; }else { LRest.BaseURL = 'https://m-guney.com.tr/'; } LRest.Resource = AResource;// Ornek olarak 7 LRest.Accept = 'image/png'; // Eğer ki resim png değil JPEG olsa bile resmi getirir. LRest.Method = rmGET; LRest.AddHeader('Authorization','Bearer ' + Clomosy.GlobalVariableString); finally Result = LRest; } } |
|
![]() |
|
Emr.Erkmn
Moderatör
Kayıt Tarihi: 28 Şubat 2025 Durum: Aktif Değil Puanlar: 426 |
Mesaj Seçenekleri
Yanıt Yaz
Alıntı Emr.Erkmn
Bu mesaj kurallara aykırıysa buradan yöneticileri bilgilendirebilirsiniz.
Teşekkürler(0)
Alıntı Cevapla
Gönderim Zamanı: 1 saat 53 Dakika Önce Saat 09:04 |
|
Boş dönme sorunu iki ihtimalden olabilir,
Base64 verisi JSON içinde gelir. Bu yüzden Accept parametresi image/png değil, application/json olmalıdır.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">TCLRest.Create ile oluşturduğun bileşen, ExecuteAsync bitmeden hafızadan silindiği için yanıtı yakalayamıyorsun. |
|
![]() |
|
Emr.Erkmn
Moderatör
Kayıt Tarihi: 28 Şubat 2025 Durum: Aktif Değil Puanlar: 426 |
Mesaj Seçenekleri
Yanıt Yaz
Alıntı Emr.Erkmn
Bu mesaj kurallara aykırıysa buradan yöneticileri bilgilendirebilirsiniz.
Teşekkürler(0)
Alıntı Cevapla
Gönderim Zamanı: 1 saat 46 Dakika Önce Saat 09:11 |
|
var MainForm: TclForm; JsonResponse: String; GlobalLRest: TCLRest; void GetItems var LRest: TCLRest; { Try // GetWithRes kullan (JSON için, Base64 string almak için) LRest = uDataLib.GetWithRes('category-images'); // Global değişkene at (callback'te erişim için) GlobalLRest = LRest; // Callback'i ayarla LRest.OnCompleted = 'GetItemsCompletedV'; // Async çalıştır LRest.ExecuteAsync; // LRest.ClearBody; // KALDIRILDI // NOT: ClearBody sadece POST/PUT isteklerinden SONRA kullanılır except ShowMessage(' GetItems hatası: ' + LastExceptionMessage); } } 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">
|
|
![]() |
|
Emr.Erkmn
Moderatör
Kayıt Tarihi: 28 Şubat 2025 Durum: Aktif Değil Puanlar: 426 |
Mesaj Seçenekleri
Yanıt Yaz
Alıntı Emr.Erkmn
Bu mesaj kurallara aykırıysa buradan yöneticileri bilgilendirebilirsiniz.
Teşekkürler(0)
Alıntı Cevapla
Gönderim Zamanı: 1 saat 46 Dakika Önce Saat 09:11 |
|
function GetWithRes(AResource: String): TCLRest var LRest: TCLRest; { Try LRest = TCLRest.Create; // Base URL ayarla if (Clomosy.AppPlatform == 0) // is Windows { LRest.BaseURL = 'http://172.16.222.25:3000/'; } else { LRest.BaseURL = 'https://m-guney.com.tr/'; } LRest.Resource = AResource; // JSON için Accept header (Base64 string almak için) LRest.Accept = 'application/json'; LRest.Method = rmGET; // Authorization header LRest.AddHeader('Authorization', 'Bearer ' + Clomosy.GlobalVariableString); Result = LRest; except ShowMessage(' GetWithRes hatası: ' + LastExceptionMessage); Result = nil; } } |
|
![]() |
|
Emr.Erkmn
Moderatör
Kayıt Tarihi: 28 Şubat 2025 Durum: Aktif Değil Puanlar: 426 |
Mesaj Seçenekleri
Yanıt Yaz
Alıntı Emr.Erkmn
Bu mesaj kurallara aykırıysa buradan yöneticileri bilgilendirebilirsiniz.
Teşekkürler(0)
Alıntı Cevapla
Gönderim Zamanı: 1 saat 42 Dakika Önce Saat 09:15 |
|
void LoadBase64Images var LRest: TCLRest; { Try // 1. API'den veri al LRest = uDataLib.GetWithRes('category-images'); // 2. Global değişkene at GlobalLRest = LRest; // 3. Callback ayarla LRest.OnCompleted = 'GetItemsCompletedV'; // 4. Async çalıştır LRest.ExecuteAsync; except ShowMessage(' LoadBase64Images hatası: ' + LastExceptionMessage); } } 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">
|
|
![]() |
|
Yanıt Yaz
|
|
| Tweet |
| Forum Atla | Forum İzinleri ![]() Kapalı Foruma Yeni Konu Gönderme Kapalı Forumdaki Konulara Cevap Yazma Kapalı Forumda Cevapları Silme Kapalı Forumdaki Cevapları Düzenleme Kapalı Forumda Anket Açma Kapalı Forumda Anketlerde Oy Kullanma |