天软金融分析.NET函数大全 > TSL函数 > 第三方交互函数 > TS-OPI及TS-OPS支持函数 > TS-OPS使用范例(基于OPSServer类) > 2、发送请求 > SubScription请求

租户SubScription请求示例    

  • URL:='https://opi.tinysoft.com.cn/Service/Session/Call/';
    sessionkey := "{xxx-xxx}"; //用户需替换成自己的session-key
    header := "Connection: keep-alive\r\nContent-Type: application/json\r\nJSON-Encode: gbk\r\nTS-CALL-NAME: ops/__subscription__/time\r\nAuthorization: Bearer "+sessionkey;
    ses := createhttpsession();
    sethttpmode(ses, 1); //设置chunked模式(分段模式)
    for i := 0 to 9999 do
    begin
      ret := InternetRequest(ses, URL, "", header, '{"anyname":"example"}', "", "", 0, res, resp, 500000);// {"anyname":"example"}用于传递参数,若无,可以设置为{}
      echo "code:", resp, "->", res, "\r\n";
      if ret then echo "time is:", datetimetostr(importjsonstring(res)["time"]), "\r\n";
    end;

    结果: