Documentation

Glpi\Api\Rest\Client | GLPI API Client Library for PHP

class Client

Class Client

Methods

__construct(string $url, Client $httpClient)

Client constructor.

setAppToken(string $appToken = null)

Set an application token to be used for each request

boolean
initSessionByCredentials(string $user, string $password)

Initialize a session with user credentials

boolean
initSessionByUserToken(string $userToken)

initialize a session with a user token

bool
killSession()

Kill client session.

mixed|null|ResponseInterface
request($method, $uri, array $options = [])

Prepare and send a request to the GLPI Api.

array
getFullSession()

Return the current php $_SESSION.

array
getGlpiConfig()

Return the current $CFG_GLPI.

array
recoveryPassword(string $email)

Allows to request password recovery.

array
resetPassword($email, string $recoveryToken, string $newPassword)

Allows to request a password reset.

Details

at line 59
__construct(string $url, Client $httpClient)

Client constructor.

Parameters

string $url
Client $httpClient

at line 69
setAppToken(string $appToken = null)

Set an application token to be used for each request

Parameters

string $appToken

at line 80
boolean initSessionByCredentials(string $user, string $password)

Initialize a session with user credentials

Parameters

string $user
string $password

Return Value

boolean

Exceptions

Exception

at line 99
boolean initSessionByUserToken(string $userToken)

initialize a session with a user token

Parameters

string $userToken

Return Value

boolean True if success

Exceptions

Exception

at line 114
bool killSession()

Kill client session.

Return Value

bool

Exceptions

Exception

at line 132
mixed|null|ResponseInterface request($method, $uri, array $options = [])

Prepare and send a request to the GLPI Api.

Parameters

$method
$uri
array $options

Return Value

mixed|null|ResponseInterface

Exceptions

Exception

at line 165
array getFullSession()

Return the current php $_SESSION.

Return Value

array

at line 174
array getGlpiConfig()

Return the current $CFG_GLPI.

Return Value

array

at line 205
array recoveryPassword(string $email)

Allows to request password recovery.

This endpoint works under the following conditions: - GLPI has notifications enabled - The email address of the user belongs to a user account.

Parameters

string $email

Return Value

array

at line 225
array resetPassword($email, string $recoveryToken, string $newPassword)

Allows to request a password reset.

This endpoint works under the following conditions: - GLPI has notifications enabled - The email address of the user belongs to a user account.

Parameters

$email
string $recoveryToken
string $newPassword

Return Value

array
Back to top