电子合同API开发文档 v1

认证首页

请求地址:/v1/Certification.json

请求方式:POST

接口版本: v1

接口描述:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
program APIStore;
{*
本范例在Delphi XE10.1下编译通过,依赖Indy10组件
*}
{$APPTYPE CONSOLE}
 
{$R *.res}
 
uses
  System.SysUtils, System.Classes,
  IdHTTP,idURI;
 
{*
POST请求方式(推荐)
url 请求地址
param 请求参数
*}
procedure requestPost(url:string; param:string);
var
  pHttp: TIdHTTP;
 
  requestStream : TStringStream;  //请求数据流
  responseStream : TStringStream; //返回信息
  responseStr : string;
begin
  requestStream := TStringStream.Create('',TEncoding.UTF8);
  responseStream := TStringStream.Create('',TEncoding.UTF8);
  pHttp := TIdHTTP.Create(Nil);
  try
    try
      phttp.Request.ContentType:='application/x-www-form-urlencoded';
      phttp.Request.CharSet := 'UTF-8';
      requestStream.WriteString(param);   //以流的方式提交参数
 
      pHttp.Post(url,requestStream,responseStream);
 
      responseStr := responseStream.DataString;    //获取网页返回的信息
      //responseStr := UTF8Decode(responseStr);
      writeln(responseStr);
    except
      on e : Exception do
       begin
        writeln(e.Message);
      end;
    end;
  finally
    phttp.Free;
    requestStream.Free;
    responseStream.Free;
  end;
end;
 
{*
GET请求方式
url 请求地址
param 请求参数
*}
procedure requestGet(url:string; param:string);
  var
  pHttp: TIdHTTP;
  responseStream : TStringStream; //返回信息
  responseStr : string;
begin
  responseStream := TStringStream.Create('',TEncoding.UTF8);
  pHttp := TIdHTTP.Create(Nil);
  try
    try
      pHttp.Get(url + '?' + param,responseStream);
      responseStr := responseStream.DataString;    //获取网页返回的信息
      //responseStr := UTF8Decode(ResponseStr);
      writeln(responseStr);
    except
      on e : Exception do
       begin
        writeln(e.Message);
      end;
    end;
  finally
    phttp.Free;
    responseStream.Free;
  end;
end;
 
 
//获取内容
procedure getContent(requestType:string);
var
  url:string;
  reg:string;
  pwd:string;
  param:string;
begin
   url:="https://api-v2.1dq.com/v1/Certification.json";
 param:="realID=604b91a6-440f-11ea-8dab-0242ac320a0c";
 
  if requestType = 'GET' then
  begin
      requestGet(url,param);
  end
  else
  begin
      requestPost(url,param);
  end;
end;