工具模块

获取服务器时间

接口

GET https://cloud.minapp.com/oserve/v2.2/server/time/

代码示例

{% tabs getTableCurl=”Curl”, getTableNode=”Node”, getTablePHP=”PHP” %}

{% content “getTableCurl” %}

  1. curl -X GET \
  2. -H "Authorization: Bearer cfb5912724dd7ff0b0c17683cc3074bb548bc7f4" \
  3. -H "Content-Type: application/json" \
  4. https://cloud.minapp.com/oserve/v2.2/server/time/

{% content “getTableNode” %}

  1. var request = require("request");
  2. var options = { method: 'GET',
  3. url: 'https://cloud.minapp.com/oserve/v2.2/server/time/',
  4. headers:
  5. { 'Content-Type': 'application/json',
  6. Authorization: 'Bearer cfb5912724dd7ff0b0c17683cc3074bb548bc7f4' } };
  7. request(options, function (error, response, body) {
  8. if (error) throw new Error(error);
  9. console.log(body);
  10. });

{% content “getTablePHP” %}

  1. <?php
  2. $url = "https://cloud.minapp.com/oserve/v2.2/server/time/";
  3. $ch = curl_init();
  4. $header = array(
  5. "Authorization: Bearer {$token}",
  6. 'Content-Type: application/json; charset=utf-8'
  7. );
  8. curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  9. curl_setopt($ch, CURLOPT_TIMEOUT, 30);
  10. curl_setopt($ch, CURLOPT_URL, $url);
  11. curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
  12. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  13. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
  14. $res = curl_exec($ch);
  15. curl_close($ch);

{% endtabs %}

返回示例

  1. {
  2. "time": "2019-11-22T16:09:26.903210+08:00"
  3. }

状态码说明

200: 成功