[comment]: # translation:outdated

[comment]: # ({d632e1b8-d632e1b8})
# token.get

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

[comment]: # ({980bb7e6-980bb7e6})
### Opis

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

Ta metoda umożliwia pobieranie tokenów zgodnie z podanymi parametrami.

::: noteclassic
Tylko użytkownik typu *Super admin* może wyświetlać tokeny
innych użytkowników.
:::

[comment]: # ({/980bb7e6-980bb7e6})

[comment]: # ({aa38fce3-cc094e72})
### Parametry

`(object)` Parametry definiujące żądane dane wyjściowe.

Metoda obsługuje następujące parametry.

|Parametr|[Typ](/manual/api/reference_commentary#data-types)|Opis|
|--|--|------|
|tokenids|ID/array|Zwracaj tylko tokeny o podanych identyfikatorach.|
|userids|ID/array|Zwracaj tylko tokeny utworzone dla podanych użytkowników.|
|token|string|Zwracaj tylko tokeny utworzone dla podanego *tokenu uwierzytelniającego*.|
|valid\_at|timestamp|Zwracaj tylko tokeny, które są ważne (nie wygasły) w podanej dacie i czasie.|
|expired\_at|timestamp|Zwracaj tylko tokeny, które są wygasłe (nieważne) w podanej dacie i czasie.|
|sortfield|string/array|Sortuj wynik według podanych właściwości.<br><br>Możliwe wartości: `tokenid`, `name`, `lastaccess`, `status`, `expires_at`, `created_at`.|
|countOutput|boolean|Te parametry są opisane w [komentarzu referencyjnym](/manual/api/reference_commentary#common-get-method-parameters).|
|excludeSearch|boolean|^|
|filter|object|^|
|limit|integer|^|
|output|query|^|
|preservekeys|boolean|^|
|search|object|^|
|searchByAny|boolean|^|
|searchWildcardsEnabled|boolean|^|
|sortorder|string/array|^|
|startSearch|boolean|^|

[comment]: # ({/aa38fce3-cc094e72})

[comment]: # ({7223bab1-7223bab1})
### Zwracane wartości

`(integer/array)` Zwraca:

-   tablicę obiektów;
-   liczbę pobranych obiektów, jeśli został użyty parametr `countOutput`.

[comment]: # ({/7223bab1-7223bab1})

[comment]: # ({b41637d2-b41637d2})
### Przykłady

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

[comment]: # ({f8520490-66760f5f})
#### Pobieranie tokena

Pobierz wszystkie dane tokena o ID „2”.

[Żądanie](/manual/api#performing-requests):

```json
{
    "jsonrpc": "2.0",
    "method": "token.get",
    "params": {
        "output": "extend",
        "tokenids": "2"
    },
    "id": 1
}
```

Odpowiedź:

```json
{
    "jsonrpc": "2.0",
    "result": [
        {
            "tokenid": "1",
            "name": "The Token",
            "description": "",
            "userid": "1",
            "lastaccess": "0",
            "status": "0",
            "expires_at": "1609406220",
            "created_at": "1611239454",
            "creator_userid": "1"
        }
    ],
    "id": 1
}
```

[comment]: # ({/f8520490-66760f5f})

[comment]: # ({5cf2ab45-5cf2ab45})
### Źródło

CToken::get() w *ui/include/classes/api/services/CToken.php*.

[comment]: # ({/5cf2ab45-5cf2ab45})
