• RESTClient 控件 从服务器获得数据集 REST


    用TRESTClient控件调用REST架构服务

    RESTClient控件返回数据集

    用到的控件

    RESTClient

    RESTRequest

    RESTResponseDataSetAdapter

    复制代码
    procedure Tfrm_Main.btn_DataSet_FetchDataClick(Sender: TObject);
    begin
      ResetRESTComponentsToDefaults;
    
      RESTResponseDataSetAdapter.Response:= RESTResponse;
      RESTResponseDataSetAdapter.Dataset:= ClientDataSet;
    
      RESTClient.BaseURL := edt_DataSet_BaseURL.Text;   //http://www.developer-experts.net/hdmobile/api/
      RESTRequest.Resource := edt_DataSet_ResourceURI.Text;  //mandators
      RESTRequest.Execute;
    end;
    复制代码

    官方例子Studio14.0SamplesObject PascalDatabaseRESTDemo

    D:DocumentsEmbarcaderoStudio14.0SamplesObject PascalDatabaseRESTDemo

     View Code

    http://community.embarcadero.com/blogs/entry/rad-studio-10-1-berlin-rest-json-and-using-a-fun-site-name2gender-com

     RESTRequest1->AddParameter("Name",UpperCase(Edit1->Text));
      RESTRequest1->Execute();
      RESTStatusLabel->Text = IntToStr(RESTResponse1->StatusCode)+"/"+RESTResponse1->StatusText;
      Memo1->Lines->Add(RESTResponse1->JSONText);


    RESTRequest1.Params[0].Value := UpperCase(Edit1.Text);
      RESTRequest1.Execute();
      RESTStatusLabel.Text := IntToStr(RESTResponse1.StatusCode)+'/'+RESTResponse1.StatusText;
      Memo1.Lines.Add(RESTResponse1.JSONText);

    http://www.cnblogs.com/cb168/p/3887269.html

  • 相关阅读:
    为网站添加图标和收藏夹图标
    常用css入门
    利用反射动态创建对象
    如何用实现.NET的插件机制
    设计模式(18)-Command Pattern
    C#中调用API
    判断一个string是否可以为数字
    080709 阴
    7月9日 多云
    080710 闷热闷热
  • 原文地址:https://www.cnblogs.com/findumars/p/5597296.html
Copyright © 2020-2023  润新知