service.create

Description

object service.create(object/array **services**)

This method allows to create new services.

This method is only available to Admin and Super admin user types. Permissions to call the method can be revoked in user role settings. See User roles for more information.

Parameters

(object/array) services to create.

Additionally to the standard service properties, the method accepts the following parameters.

ParameterTypeDescription
dependenciesarrayService dependencies.

Each service dependency has the following parameters:
- dependsOnServiceid - (string) ID of an service the service depends on, that is, the child service.
- soft - (integer) type of service dependency.
parentidstringID of a hard-linked parent service.
timesarrayService times to be created for the service.

Return values

(object) Returns an object containing the IDs of the created services under the serviceids property. The order of the returned IDs matches the order of the passed services.

Examples

Creating an service

Create an service that will be switched to problem state, if at least one child has a problem. SLA calculation will be on and the minimum acceptable SLA is 99.99%.

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "service.create",
  4. "params": {
  5. "name": "Server 1",
  6. "algorithm": 1,
  7. "showsla": 1,
  8. "goodsla": 99.99,
  9. "sortorder": 1
  10. },
  11. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  12. "id": 1
  13. }

Response:

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

Source

CService::create() in ui/include/classes/api/services/CService.php.