zoukankan      html  css  js  c++  java
  • TRestClient

    TRestClient

    Delphi XE6开始,REST Client系列元件渐渐开始成为 Delphi 团队的重点开发项目之一。TRESTClient, TRESTRequest, TRESTResponse 系列组合。

    var
      jo: TJSONObject;
    begin
      jo:= TJSONObject.Create;
      try
        ResetRESTComponentsToDefaults;
     
        RESTClient.BaseURL := 'http://ynmiddle:9999/';
        RESTClient.Authenticator := HTTPBasicAuthenticator1;
        RESTClient.ContentType := 'application/x-www-form-urlencoded';
     
        RESTRequest.Method := TRESTRequestMethod.rmPOST;
        RESTRequest.Resource := 'oauth/token';
     
        HTTPBasicAuthenticator1.Username := 'orbid-hml';
        HTTPBasicAuthenticator1.Password := EmptyStr;
     
        jo.AddPair('scope', 'product:show stock:save stock:update warehouse:list warehouse:save warehouse:show '+
                                     'warehouse:update partnerOrder:show partnerOrder:list partnerOrder:update');
        jo.AddPair('grant_type', 'client_credentials');
     
        RESTRequest.Params.Clear;
        RESTRequest.Params.AddHeader('authorization', 'Basic '+Edt_Base64.Text);
        RESTRequest.AddBody(jo);
     
     
        RESTRequest.Execute;
        memLog.Text:=RESTResponse1.Content;
      finally
        FreeAndNil(jo);
      end;
    end;

      

  • 相关阅读:
    Python(九)之网络编程
    Bat命令
    Python(八)之函数
    RedHat下安装Python开发环境
    Redhat6.5安装DB2 Express-C版本
    Linux下字符集的安装
    Linux命令之stty
    AIX查看CPU、内存等信息
    stopManagedWebLogic.sh强制关闭Managed Server
    Keepalived + Nginx + Tomcat 的高可用负载均衡架构搭建
  • 原文地址:https://www.cnblogs.com/hnxxcxg/p/13447634.html
Copyright © 2011-2022 走看看