我正在尝试使用Delphi XE8 RESTClient,RESTRequest和RESTResponse来获取对以下API调用的响应内容:
https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=Demo&count=1000
该调用可以在C#和Web浏览器中正常运行。
我不确定如何配置RESTClient和RESTRequest属性。
谁能为我将API调用分解为RESTClient和RESTRequest属性?
我已经为此努力了好几个小时,到目前为止还没有成功。
以下是REST组件的属性分配的简单示例。
创建一个新项目并将一个Button,RESTClient,RESTRequest,RESTResponse和Memo放到窗体上-您可以在Button Click事件上使用下面的代码来查看其工作。
procedure TForm1.Button1Click(Sender: TObject);
begin
RESTRequest1.Client := RESTClient1;
RESTRequest1.Response := RESTResponse1;
RESTClient1.BaseURL := 'https://api.hubapi.com';
RESTRequest1.Resource :=
'contacts/v1/lists/all/contacts/all?hapikey=Demo&count=1000';
RESTRequest1.Execute;
Memo1.Text := RESTResponse1.Content;
end;
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句