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

trend.get

Description

integer/array trend.get(object parameters)

The method allows to retrieve trend data 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.

Parameter Type Description
itemids string/array Return only trends with the given item IDs.
time_from timestamp Return only values that have been collected after or at the given time.
time_till timestamp Return only values that have been collected before or at the given time.
countOutput boolean Count the number of retrieved objects.
limit integer Limit the amount of retrieved objects.
output query Set fields to output.

Повернуті значення

(integer/array) Повертає або:

  • масив об'єктів;
  • кількість отриманих об'єктів, якщо використовувався параметр countOutput.

Приклади

Retrieving item trend data

Request:

{
           "jsonrpc": "2.0",
           "method": "trend.get",
           "params": {
               "output": [
                   "itemid",
                   "clock",
                   "num",
                   "value_min",
                   "value_avg",
                   "value_max",
               ],
               "itemids": [
                   "23715"
               ],
               "limit": "1"
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "itemid": "23715",
                   "clock": "1446199200",
                   "num": "60",
                   "value_min": "0.165",
                   "value_avg": "0.2168",
                   "value_max": "0.35",
               }
           ],
           "id": 1
       }

Джерело

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