Salaros\Vtiger\VTWSCLib\Session

class Session

Vtiger Web Services PHP Client Session class

Class Session

property httpClient

protected

property vtigerUrl

protected

property wsBaseURL

protected

__construct($vtigerUrl, $wsBaseURL = 'webservice.php')

Class constructor

Parameters:
  • $vtigerUrl (string) – The URL of the remote WebServices server
  • $wsBaseURL
login($username, $accessKey)

Login to the server using username and VTiger access key token

Parameters:
  • $username
  • $accessKey
Returns:

boolean Returns true if login operation has been successful

loginPassword($username, $password, $accessKey = null)

Allows you to login using username and password instead of access key (works on some VTige forks)

Parameters:
  • $username
  • $password
  • $accessKey
Returns:

boolean Returns true if login operation has been successful

passChallenge($username)

Gets a challenge token from the server and stores for future requests

Parameters:
  • $username
Returns:

boolean Returns false in case of failure

getUserInfo()

Gets an array containing the basic information about current API user

Returns:array Basic information about current API user
getVtigerVersion()

Gets vTiger version, retrieved on successful login

Returns:string vTiger version, retrieved on successful login
getVtigerApiVersion()

Gets vTiger WebServices API version, retrieved on successful login

Returns:string vTiger WebServices API version, retrieved on successful login
sendHttpRequest($requestData, $method = 'POST')

Sends HTTP request to VTiger web service API endpoint

Parameters:
  • $requestData
  • $method
Returns:

array Returns request result object (null in case of failure)

fixVtigerBaseUrl($baseUrl)

Cleans and fixes vTiger URL

Parameters:
  • $baseUrl (string) –
Returns:

string Returns cleaned and fixed vTiger URL

checkForError($jsonResult)

Check if server response contains an error, therefore the requested operation has failed

Parameters:
  • $jsonResult
Returns:

boolean True if response object contains an error