sla.get

Description

integer/array sla.get(object parameters)

The method allows to retrieve SLA objects according to the given parameters.

This method is available to users of any type. Permissions to call the method can be revoked in user role settings. See User roles for more information.

Parameters

(object) Parameters defining the desired output.

The method supports the following parameters.

ParameterTypeDescription
slaidsstring/arrayReturn only SLAs with the given IDs.
serviceidsstring/arrayReturn only SLAs matching the specific services.
selectSchedulequeryReturn a schedule property with SLA schedules.

Supports count.
selectExcludedDowntimesqueryReturn an excluded_downtimes property with SLA excluded downtimes.

Supports count.
selectServiceTagsqueryReturn a service_tags property with SLA service tags.

Supports count.
sortfieldstring/arraySort the result by the given properties.

Possible values are: slaid, name, period, slo, effective_date, timezone, status and description.
countOutputbooleanThese parameters being common for all get methods are described in detail in the reference commentary.
editableboolean
excludeSearchboolean
filterobject
limitinteger
outputquery
preservekeysboolean
searchobject
searchByAnyboolean
searchWildcardsEnabledboolean
sortorderstring/array
startSearchboolean

Return values

(integer/array) Returns either:

  • an array of objects;
  • the count of retrieved objects, if the countOutput parameter has been used.

Examples

Retrieving all SLAs

Retrieve all data about all SLAs and their properties.

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "sla.get",
  4. "params": {
  5. "output": "extend",
  6. "selectSchedule": ["period_from", "period_to"],
  7. "selectExcludedDowntimes": ["name", "period_from", "period_to"],
  8. "selectServiceTags": ["tag", "operator", "value"],
  9. "preservekeys": true
  10. },
  11. "auth": "85dd04b94cbfad794616eb923be13c71",
  12. "id": 1
  13. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "1": {
  5. "slaid": "1",
  6. "name": "Database Uptime",
  7. "period": "1",
  8. "slo": "99.9995",
  9. "effective_date": "1672444800",
  10. "timezone": "America/Toronto",
  11. "status": "1",
  12. "description": "Provide excellent uptime for main SQL database engines.",
  13. "service_tags": [
  14. {
  15. "tag": "Database",
  16. "operator": "0",
  17. "value": "MySQL"
  18. },
  19. {
  20. "tag": "Database",
  21. "operator": "0",
  22. "value": "PostgreSQL"
  23. }
  24. ],
  25. "schedule": [
  26. {
  27. "period_from": "0",
  28. "period_to": "601200"
  29. }
  30. ],
  31. "excluded_downtimes": [
  32. {
  33. "name": "Software version upgrade rollout",
  34. "period_from": "1648760400",
  35. "period_to": "1648764900"
  36. }
  37. ]
  38. }
  39. },
  40. "id": 1
  41. }

Source

CSla:get() in ui/include/classes/api/services/CSla.php.