RTC Forums
November 23, 2024, 11:49:29 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: API with access key and autorization  (Read 4364 times)
mkurnia
RTC Expired
*
Posts: 21


« on: January 02, 2016, 06:14:34 AM »

hi danijel,

in CURL i use this request to server, how can i use rtchttpclient:

curl -H "X-API-AccessKey: NDc4NTE1MTY1"
     -H "X-API-Timestamp: 2015-06-23T02:51:26+07:00"\n
     -H "Authorization: NDBkYWEwNmRiNTdmYTZiN2I1NzQ1YzAxYTM0M2RjZTYzOTRhZGFkYjE5YjdkMzM3MTgyYTZkYmRmNmM3MzNmNg=="\n
     -v https://api-sandbox.paymentgateway.id/v1/

thanks you.

Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: January 02, 2016, 11:32:18 AM »

Please, check Quick Start Client Lesson 1 to learn the basics about TRtcHttpClient and TRtcDataRequest component usage.

Server Address, Port and protocol (HTTP or HTTPS) have to be specified in the TRtcHttpClient component, like this:

RtcHttpClient1.ServerAddr:='api-sandbox.paymentgateway.id'; // Server address
RtcHttpClient1.ServerPort:='443'; // Server Port (443 is standard for HTTPS)
RtcHttpClient1.useSSL:=True; // use SSL property works only on Windows. For other platforms, use 3rd-party encryption components for SSL

HTTP "Method" and "File Name" can be specified on the TRtcDataRequest component using the Request property, like this:

RtcDataRequest1.Request.Method:='GET';
RtcDataRequest1.Request.FileName:='/v1/';

HTTP Header values can be specified on the TRtcDataRequest component using the Request[] property, like this:

RtcDataRequest1.Request['X-API-AccessKey']:='NDc4NTE1MTY1';
RtcDataRequest1.Request['X-API-Timestamp']:='2015-06-23T02:51:26+07:00';
RtcDataRequest1.Request['Authorization']:='NDBkYWEwNmRiNTdmYTZiN2I1NzQ1YzAxYTM0M2RjZTYzOTRhZGFkYjE5YjdkMzM3MTgyYTZkYmRmNmM3MzNmNg==';

For more examples on using TRtcHttpClient and TRtcDataRequest components to post HTTP(S) requests, check the "FileClient" demo in the "Demos" folder and "ClientFormPost" and "ClientUpload" examples in the "QuickStart" folder.

Best Regards,
Danijel Tkalcec
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.023 seconds with 16 queries.