[comment]: # translation:outdated

[comment]: # ({d981e093-d981e093})
# task.get

[comment]: # ({/d981e093-d981e093})

[comment]: # ({f5b508b8-79cf46cd})
### Descrizione

`integer/array task.get(object parameters)`

Il metodo consente di recuperare i task in base ai parametri specificati.

::: noteclassic
Questo metodo è disponibile solo per il tipo di utente *Super admin*.
Le autorizzazioni per chiamare il metodo possono essere revocate nelle impostazioni del ruolo utente. Vedere
[Ruoli utente](/manual/web_interface/frontend_sections/users/user_roles)
per ulteriori informazioni.
:::

[comment]: # ({/f5b508b8-79cf46cd})

[comment]: # ({d9cfd806-cd6e3f53})
### Parametri

`(object)` Parametri che definiscono l'output desiderato.

Il metodo supporta i seguenti parametri.

|Parametro|[Tipo](/manual/api/reference_commentary#data-types)|Descrizione|
|--|--|------|
|taskids|ID/array|Restituisce solo le attività con gli ID specificati.|
|output|query|Questi parametri sono descritti nel [commento di riferimento](/manual/api/reference_commentary#common-get-method-parameters).|
|preservekeys|boolean|^|

[comment]: # ({/d9cfd806-cd6e3f53})

[comment]: # ({e1126edc-e1126edc})
### Valori di ritorno

`(integer/array)` Restituisce un array di oggetti.

[comment]: # ({/e1126edc-e1126edc})

[comment]: # ({b41637d2-b41637d2})
### Esempi

[comment]: # ({/b41637d2-b41637d2})

[comment]: # ({47c016bb-8d9c84cb})
#### Recuperare attività per ID

Recupera tutti i dati relativi all'attività con ID "1".

[Richiesta](/manual/api#performing-requests):

```json
{
    "jsonrpc": "2.0",
    "method": "task.get",
    "params": {
        "output": "extend",
        "taskids": "1"
    },
    "id": 1
}
```

Risposta:

```json
{
    "jsonrpc": "2.0",
    "result": [
        {
            "taskid": "1",
            "type": "7",
            "status": "3",
            "clock": "1601039076",
            "ttl": "3600",
            "proxyid": null,
            "request": {
                "alerting": {
                    "stats": [
                        "alerts"
                    ],
                    "top": {
                        "media.alerts": 10
                    }
                },
                "lld": {
                    "stats": "extend",
                    "top": {
                        "values": 5
                    }
                }
            },
            "result": {
                "data": {
                    "alerting": {
                        "alerts": 0,
                        "top": {
                            "media.alerts": []
                        },
                        "time": 0.000663
                    },
                    "lld": {
                        "rules": 0,
                        "values": 0,
                        "top": {
                            "values": []
                        },
                        "time": 0.000442
                    }
                },
                "status": "0"
            }
        }
    ],
    "id": 1
}
```

[comment]: # ({/47c016bb-8d9c84cb})

[comment]: # ({58f08e8d-e1d2d11a})
### Vedi anche

-   [Task](/manual/api/reference/task/object)
-   [Oggetto richiesta 'Execute now'](/manual/api/reference/task/object#execute-now-request-object)
-   [Oggetto richiesta 'Refresh proxy configuration'](/manual/api/reference/task/object#refresh-proxy-configuration-request-object)
-   [Oggetto richiesta 'Diagnostic information'](/manual/api/reference/task/object#diagnostic-information-request-object)

[comment]: # ({/58f08e8d-e1d2d11a})

[comment]: # ({85e7fa97-85e7fa97})
### Fonte

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

[comment]: # ({/85e7fa97-85e7fa97})
