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;

      

  • 相关阅读:
    Mac查看某个文件的中某关键字信息
    Mac查看所有的文件
    Mac查看当前用户的环境变量
    Mac安装maven
    Lombok使用坑之属性不区分大小写
    Mac常用软件列表
    Mac系统升级
    Mac安装Git
    Mac查看git的安装路径
    Mac安装JDK8
  • 原文地址:https://www.cnblogs.com/hnxxcxg/p/13447634.html
Copyright © 2011-2022 走看看