Merhaba,
Metotlara erişim için API Key (apikey) ve API Secret (apisecret) bilgileri istek sırasında HEADER alanında yer almalıdır.
Böyle bir php kodu Delphi de NetHttpClient ile get metodunu nasıl çalıştırabilirim? Post değil Get olmalı.
Delphi kodum :
Kodum bu şekilde ama bir yeri atlıyorum herhalde. Bir türlü Çözemedim.
Yardımcı olabilir misiniz?
Teşekkürler
PHP Kod: (Select All)
<?php
$url = “https://www.site.com/api/v2/auth";
$api_key = "XXXXX";
$api_secret = "YYYY";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type:application/json',
"apikey: ".$api_key,
"apisecret: ".$api_secret,
));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Macintosh; Intel Mac OS
X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132
Safari/537.36');
$result = curl_exec ($ch);
$err = curl_error($ch);
curl_close ($ch);
$response = json_decode($result, true);
?>
Metotlara erişim için API Key (apikey) ve API Secret (apisecret) bilgileri istek sırasında HEADER alanında yer almalıdır.
Böyle bir php kodu Delphi de NetHttpClient ile get metodunu nasıl çalıştırabilirim? Post değil Get olmalı.
Delphi kodum :
Kod: (Select All)
NetHTTPClient1.Accept := 'application/json';
NetHTTPClient1.ContentType := 'application/json; charset=utf-8;';
NetHTTPClient1.UserAgent := 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36';
NetHTTPClient1.AcceptCharSet := 'utf-8';
NetHTTPClient1.AcceptEncoding := '65001';
NetHTTPClient1.AcceptLanguage := 'tr-TR';
NetHTTPClient1.CustomHeaders['Authorization']:='Token ApiKey=aaa, ApiSecret=bbb';
Memo1.Text:=NetHTTPClient1.Get('https://www.site.com/api/v2/auth');
Kodum bu şekilde ama bir yeri atlıyorum herhalde. Bir türlü Çözemedim.
Yardımcı olabilir misiniz?
Teşekkürler