This is a translation of the original English documentation page. Help us make it better.

service.create

Description

object service.create(object/array services)

Cette méthode permet de créer de nouveaux services.

Cette méthode est disponible à tous les types d'utilisateurs. Les autorisations d'appeler la méthode peuvent être révoquées dans les paramètres du le rôle d'utilisateur. Voir Rôles Utilisateur pour plus d'informations.

Parameters

(object/array) services to create.

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

Parameter Type Description
dependencies array Service 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; refer to the service dependency object page for more information on dependency types.
parentid string ID of a hard-linked parent service.
times array Service times to be created for the service.

Valeurs retournées

(object) Retourne un objet contenant les identifiants des services créés sous la propriété servicesids. L'ordre des ID retournés correspond à l'ordre des services transmis.

Exemples

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:

{
           "jsonrpc": "2.0",
           "method": "service.create",
           "params": {
               "name": "Server 1",
               "algorithm": 1,
               "showsla": 1,
               "goodsla": 99.99,
               "sortorder": 1
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "serviceids": [
                   "5"
               ]
           },
           "id": 1
       }

Source

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