[comment]: # ({6e21b38f-6e21b38f})
# service.addtimes

[comment]: # ({/6e21b38f-6e21b38f})

[comment]: # ({498c6abe-498c6abe})
### Description

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

This method allows to create new service times.

[comment]: # ({/498c6abe-498c6abe})

[comment]: # ({60e2d0b4-60e2d0b4})
### Parameters

`(object/array)` Service times to create.

The method accepts service times with the [standard service time
properties](object#service_time).

[comment]: # ({/60e2d0b4-60e2d0b4})

[comment]: # ({4a0ff76e-4a0ff76e})
### Return values

`(object)` Returns an object containing the IDs of the affected services
under the `serviceids` property.

[comment]: # ({/4a0ff76e-4a0ff76e})

[comment]: # ({b41637d2-b41637d2})
### Examples

[comment]: # ({/b41637d2-b41637d2})

[comment]: # ({309a33ee-309a33ee})
#### Adding a scheduled downtime

Add a downtime for service with ID "4" scheduled weekly from Monday
22:00 till Tuesday 10:00.

Request:

``` {.java}
{
    "jsonrpc": "2.0",
    "method": "service.addtimes",
    "params": {
        "serviceid": "4",
        "type": 1,
        "ts_from": 165600,
        "ts_to": 201600
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

Response:

``` {.java}
{
    "jsonrpc": "2.0",
    "result": {
        "serviceids": [
            "4"
        ]
    },
    "id": 1
}
```

[comment]: # ({/309a33ee-309a33ee})

[comment]: # ({6d17fa88-6d17fa88})
### See also

-   [service.update](update)

[comment]: # ({/6d17fa88-6d17fa88})

[comment]: # ({cc1c4a4a-cc1c4a4a})
### Source

CService::addTimes() in
*frontends/php/include/classes/api/services/CService.php*.

[comment]: # ({/cc1c4a4a-cc1c4a4a})
