Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
API BindCommerce
#2
(04-20-2022, 11:16 AM)staff@ergosoft.it Wrote: this is an examples in php of autentication:
...
How in delphi ?

Something like this:

Code:
uses
  ..., Classes, IdGlobal, IdHTTP, IdSSLOpenSSL;
  
var
  http: TIdHTTP;
  ssl: TIdSSLIOHandlerSocketOpenSSL;
  postData: TStream;
  response: String;
begin
  try
    // alternatively, you can configure these components at design-time instead...
    http := TIdHTTP.Create(nil);
    try
      http.HTTPOptions := http.HTTPOptions + [hoKeepOrigProtocol];
      http.ProtocolVersion := pv1_1;
      http.ReadTimeout := 30000;
      http.RedirectMaximum := 10;

      http.Request.CacheControl := 'no-cache';
      http.Request.ContentType := 'text/xml';
      http.Request.CustomHeaders.Values['token'] := '0435a03b361d7cc24fc1acacdeaae1d7';

      ssl := TIdSSLIOHandlerSocketOpenSSL.Create(http);
      ssl.SSLOptions.SSLVersions := [sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2];
      ssl.VerifyMode := [];
      ssl.VerifyDepth := 0;
      http.IOHandler := ssl;
      
      postData := TIdReadFileExclusiveStream.Create('<path to>\Products.xml');
      try
        response := http.Post('https://miohost.bindcommerce.cloud/integrator-tool/api/products.php?connector=N', postData);
      finally
        postData.Free;
      end;
    finally
      http.Free;
    end;

    // use response as needed...
  except
    on E: Exception do
      // use E as needed...
  end;
end;

Reply


Messages In This Thread
API BindCommerce - by staff@ergosoft.it - 04-20-2022, 11:16 AM
RE: API BindCommerce - by rlebeau - 04-20-2022, 03:55 PM
RE: API BindCommerce - by staff@ergosoft.it - 04-20-2022, 04:35 PM
RE: API BindCommerce - by rlebeau - 04-20-2022, 11:06 PM
RE: API BindCommerce - by staff@ergosoft.it - 04-21-2022, 06:30 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)