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;

      

  • 相关阅读:
    Laravel 出现 No application encryption key has been specified.
    windows下用composer局部安装laravel
    vue组件--通讯录
    vue组件--TagsInput
    axios封装(二)队列管理
    axios封装(一)基础配置
    [git hooks] pre-commit 配置
    qs.js
    flexbox的应用
    盒子模型详解
  • 原文地址:https://www.cnblogs.com/hnxxcxg/p/13447634.html
Copyright © 2011-2022 走看看