service.adddependencies

Description

object service.adddependencies(object/array **serviceDependencies**)

This method allows to create dependencies between 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) Service dependencies to create.

Each service dependency has the following parameters.

ParameterTypeDescription
serviceidstringID of the service that depends on a service, that is, the parent service.
dependsOnServiceidstringID of the service that a service depends on, that is, the child service.
softstringType of dependency.

Refer to the service dependency object page for more information on dependency types.

Return values

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

Examples

Creating a hard dependency

Make service “2” a hard-dependent child of service “3”.

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "service.adddependencies",
  4. "params": {
  5. "serviceid": "3",
  6. "dependsOnServiceid": "2",
  7. "soft": 0
  8. },
  9. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  10. "id": 1
  11. }

Response:

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

See also

Source

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