trend.get

Description

integer/array trend.get(object **parameters**)

The method allows to retrieve trend data according to the given parameters.

Parameters

(object) Parameters defining the desired output.

The method supports the following parameters.

ParameterTypeDescription
itemidsstring/arrayReturn only trends with the given item IDs.
time_fromtimestampReturn only values that have been collected after or at the given time.
time_tilltimestampReturn only values that have been collected before or at the given time.
countOutputbooleanCount the number of retrieved objects.
limitintegerLimit the amount of retrieved objects.
outputquerySet fields to output.

Return values

(integer/array) Returns either:

  • an array of objects;

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

Examples

Retrieving item trend data

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "trend.get",
  4. "params": {
  5. "output": [
  6. "itemid",
  7. "clock",
  8. "num",
  9. "value_min",
  10. "value_avg",
  11. "value_max",
  12. ],
  13. "itemids": [
  14. "23715"
  15. ],
  16. "limit": "1"
  17. },
  18. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  19. "id": 1
  20. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": [
  4. {
  5. "itemid": "23715",
  6. "clock": "1446199200",
  7. "num": "60",
  8. "value_min": "0.1650",
  9. "value_avg": "0.2168",
  10. "value_max": "0.3500",
  11. }
  12. ],
  13. "id": 1
  14. }

Source

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