添加服务时间

Description 说明

object service.addtimes(object/array **serviceTimes**)

This method allows to create new service times. 此方法允许创建新的服务时间。

Parameters 参数

(object/array) Service times to create. (object/array)创建服务时间。

The method accepts service times with the standard service time properties. 该方法接受带有standard service time properties的服务时间。

Return values 返回值

(object) Returns an object containing the IDs of the affected services under the serviceids property. (object)返回一个对象,该对象包含在serviceids属性中受影响服务的ID。

Examples 范例

Adding a scheduled downtime 添加一个计划停机时间

Add a downtime for service “2” scheduled weekly from Monday 22:00 till Tuesday 10:00. 为服务“2”添加一个从周一22点到周二10点的每周停机计划。

Request 请求:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "service.addtimes",
  4. "params": {
  5. "serviceid": "4",
  6. "type": 1,
  7. "ts_from": 165600,
  8. "ts_to": 201600
  9. },
  10. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  11. "id": 1
  12. }

Response 响应:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "serviceids": [
  5. "4"
  6. ]
  7. },
  8. "id": 1
  9. }

See also 参考

Source 源码

CService::addTimes() in frontends/php/include/classes/api/services/CService.php. CService::addTimes()方法可在frontends/php/include/classes/api/services/CService.php中参考。