integer/array graph.get(object parameters)
The method allows to retrieve graphs 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.
(object) Parameters defining the desired output.
The method supports the following parameters.
| Parameter | Type | Description | 
|---|---|---|
| graphids | ID/array | Return only graphs with the given IDs. | 
| groupids | ID/array | Return only graphs that belong to hosts or templates in the given host groups or template groups. | 
| templateids | ID/array | Return only graph that belong to the given templates. | 
| hostids | ID/array | Return only graphs that belong to the given hosts. | 
| itemids | ID/array | Return only graphs that contain the given items. | 
| templated | boolean | If set to truereturn only graphs that belong to templates. | 
| inherited | boolean | If set to truereturn only graphs inherited from a template. | 
| expandName | flag | Expand macros in the graph name. | 
| selectHostGroups | query | Return a hostgroupsproperty with the host groups that the graph belongs to. | 
| selectTemplateGroups | query | Return a templategroupsproperty with the template groups that the graph belongs to. | 
| selectTemplates | query | Return a templatesproperty with the templates that the graph belongs to. | 
| selectHosts | query | Return a hostsproperty with the hosts that the graph belongs to. | 
| selectItems | query | Return an itemsproperty with the items used in the graph. | 
| selectGraphDiscovery | query | Return a graphDiscoveryproperty with the graph discovery object. The graph discovery objects links the graph to a graph prototype from which it was created.It has the following properties: graphid-(ID)ID of the graph;parent_graphid-(ID)ID of the graph prototype from which the graph has been created;lastcheck-(timestamp)time when the graph was last discovered;status-(int)graph discovery status:0 - (default) graph is discovered, 1 - graph is not discovered anymore; ts_delete-(timestamp)time when a graph that is no longer discovered will be deleted. | 
| selectGraphItems | query | Return a gitemsproperty with the items used in the graph. | 
| selectDiscoveryRule | query | Return a discoveryRuleproperty with the low-level discovery rule that created the graph. | 
| filter | object | Return only those results that exactly match the given filter. Accepts an object, where the keys are property names, and the values are either a single value or an array of values to match against. Does not support properties of textdata type.Supports additional properties: host- technical name of the host that the graph belongs to;hostid- ID of the host that the graph belongs to. | 
| sortfield | string/array | Sort the result by the given properties. Possible values: graphid,name,graphtype. | 
| countOutput | boolean | These parameters are described in the reference commentary. | 
| editable | boolean | |
| excludeSearch | boolean | |
| limit | integer | |
| output | query | |
| preservekeys | boolean | |
| search | object | |
| searchByAny | boolean | |
| searchWildcardsEnabled | boolean | |
| sortorder | string/array | |
| startSearch | boolean | 
(integer/array) Returns either:
countOutput parameter has been used.Retrieve all graphs from host "10107" and sort them by name.
{
           "jsonrpc": "2.0",
           "method": "graph.get",
           "params": {
               "output": "extend",
               "hostids": 10107,
               "sortfield": "name"
           },
           "id": 1
       }Response:
{
           "jsonrpc": "2.0",
           "result": [
               {
                   "graphid": "612",
                   "name": "CPU jumps",
                   "width": "900",
                   "height": "200",
                   "yaxismin": "0",
                   "yaxismax": "100",
                   "templateid": "439",
                   "show_work_period": "1",
                   "show_triggers": "1",
                   "graphtype": "0",
                   "show_legend": "1",
                   "show_3d": "0",
                   "percent_left": "0",
                   "percent_right": "0",
                   "ymin_type": "0",
                   "ymax_type": "0",
                   "ymin_itemid": "0",
                   "ymax_itemid": "0",
                   "flags": "0"
               },
               {
                   "graphid": "613",
                   "name": "CPU load",
                   "width": "900",
                   "height": "200",
                   "yaxismin": "0",
                   "yaxismax": "100",
                   "templateid": "433",
                   "show_work_period": "1",
                   "show_triggers": "1",
                   "graphtype": "0",
                   "show_legend": "1",
                   "show_3d": "0",
                   "percent_left": "0",
                   "percent_right": "0",
                   "ymin_type": "1",
                   "ymax_type": "0",
                   "ymin_itemid": "0",
                   "ymax_itemid": "0",
                   "flags": "0"
               },
               {
                   "graphid": "614",
                   "name": "CPU utilization",
                   "width": "900",
                   "height": "200",
                   "yaxismin": "0",
                   "yaxismax": "100",
                   "templateid": "387",
                   "show_work_period": "1",
                   "show_triggers": "0",
                   "graphtype": "1",
                   "show_legend": "1",
                   "show_3d": "0",
                   "percent_left": "0",
                   "percent_right": "0",
                   "ymin_type": "1",
                   "ymax_type": "1",
                   "ymin_itemid": "0",
                   "ymax_itemid": "0",
                   "flags": "0"
               },
               {
                   "graphid": "645",
                   "name": "Disk space usage /",
                   "width": "600",
                   "height": "340",
                   "yaxismin": "0",
                   "yaxismax": "0",
                   "templateid": "0",
                   "show_work_period": "0",
                   "show_triggers": "0",
                   "graphtype": "2",
                   "show_legend": "1",
                   "show_3d": "1",
                   "percent_left": "0",
                   "percent_right": "0",
                   "ymin_type": "0",
                   "ymax_type": "0",
                   "ymin_itemid": "0",
                   "ymax_itemid": "0",
                   "flags": "4"
               }
           ],
           "id": 1
       }CGraph::get() in ui/include/classes/api/services/CGraph.php.