TimeTrex API Manual

APIAuthentication extends APIFactory
in package

Table of Contents

$data  : mixed
$api_message_id  : mixed
$current_company  : mixed
$current_user  : mixed
$current_user_prefs  : mixed
$main_class  : mixed
$main_class_obj  : mixed
$pager_obj  : mixed
$permission  : mixed
$progress_bar_obj  : mixed
__construct()  : mixed
APIAuthentication constructor.
convertAPIReturnHandlerToValidatorObject()  : bool|Validator
Take a API ReturnHandler array and pulls out the Validation errors/warnings to be merged back into another Validator This is useful for calling one API function from another one when their are sub-classes.
convertToMultipleRecords()  : array<string|int, mixed>
convertToSingleRecord()  : mixed
exportRecords()  : array<string|int, mixed>|bool
Download a result_set as a csv.
getAnalyticsTrackingCode()  : string
getAPIMessageID()  : bool|null
Returns the API messageID for each individual call.
getApplicationBuild()  : string
getApplicationName()  : string
getApplicationVersion()  : string
getApplicationVersionDate()  : int
getCompanyName()  : bool
getCurrentCompany()  : array<string|int, mixed>
getCurrentCompanyObject()  : bool|CompanyFactory
getCurrentUser()  : array<string|int, mixed>
getCurrentUserName()  : array<string|int, mixed>
getCurrentUserObject()  : bool|UserFactory
getCurrentUserPreference()  : array<string|int, mixed>
getCurrentUserPreferenceObject()  : bool|UserPreferenceFactory
getCustomFieldData()  : array<string|int, mixed>
getDeploymentOnDemand()  : bool
getHTTPHost()  : mixed
getLocale()  : null
getMainClassObject()  : string
getNextInsertID()  : string
getOptions()  : array<string|int, mixed>|bool
Bridge to main class getOptions factory.
getOptionsBatch()  : array<string|int, mixed>
Bridge multiple batched requests to main class getOptions factory.
getOrganizationName()  : string
getOrganizationURL()  : string
getPagerData()  : array<string|int, mixed>|bool
getPagerObject()  : Pager
getPermissionChildren()  : array<string|int, mixed>
getPermissionObject()  : bool|null|Permission
getPostLoginData()  : array<string|int, mixed>
Returns all post login data required in a single call for optimization purposes.
getPreLoginData()  : array<string|int, mixed>
Returns all login data required in a single call for optimization purposes.
getProduction()  : bool
Functions that can be called before the API client is logged in.
getProgressBarObject()  : null|ProgressBar
getProtocolVersion()  : int
getRegistrationKey()  : bool
getSessionIdle()  : int
getSystemLoad()  : int|mixed
getTTProductEdition()  : int|string
getVariableToFunctionMap()  : array<string|int, mixed>
Bridge to main class getVariableToFunctionMap factory.
handlePermissionFilterColumns()  : array<string|int, mixed>|null
In cases where data can be displayed in just a list_view (dropdown boxes), ie: branch, department, job, task in In/Out punch view restrict the dropdown box to just a subset of columns, so not all data is shown.
handleRecordValidationResults()  : array<string|int, mixed>
initializeFilterAndPager()  : array<string|int, mixed>|bool
isAnalyticsEnabled()  : bool
isApplicationBranded()  : bool
isLoggedIn()  : bool
isPoweredByLogoEnabled()  : bool
isProgressBarStarted()  : bool
Login()  : array<string|int, mixed>|null
Default username=NULL to prevent argument warnings messages if its not passed from the API.
Logout()  : bool
markNotificationAsRead()  : bool
Used to mark notifications as read from things like tracking pixels in notification emails.
newSession()  : array<string|int, mixed>|bool
passwordReset()  : array<string|int, mixed>
Reset the password if users forgotten their password
Ping()  : bool
Ping function is also in APIMisc for when the session timesout is valid.
PunchLogin()  : array<string|int, mixed>
registerAPIKey()  : bool|string
Register permanent API key Session ID to be used for all subsequent API calls without needing a username/password.
resetPassword()  : array<string|int, mixed>
returnHandler()  : array<string|int, mixed>|bool
Controls returning information to client in a standard format.
sendCSRFTokenCookie()  : mixed
Sends a refreshed CSRF token cookie in case it expires prior to the user clicking the login button. This helps avoid showing an error message and triggering a full browser refresh.
sendErrorReport()  : string
Function that HTML5 interface can call when an irrecoverable error or uncaught exception is triggered.
setAPIMessageID()  : bool
setMainClassObject()  : bool
Allow storing the main class object persistently in memory, so we can build up other variables to help out things like getOptions() Mainly used for the APIReport class.
setPagerObject()  : bool
setProgressBarObject()  : bool
setValidationArray()  : array<string|int, mixed>|bool
stripReturnHandler()  : mixed
switchUser()  : bool
Accepts user_id or user_name.

Properties

Methods

convertAPIReturnHandlerToValidatorObject()

Take a API ReturnHandler array and pulls out the Validation errors/warnings to be merged back into another Validator This is useful for calling one API function from another one when their are sub-classes.

public convertAPIReturnHandlerToValidatorObject( $api_retarr[, bool $validator_obj = false ]) : bool|Validator
Parameters
$api_retarr :
$validator_obj : bool = false
Return values
bool|Validator

convertToMultipleRecords()

public convertToMultipleRecords(array<string|int, mixed> $data) : array<string|int, mixed>
Parameters
$data : array<string|int, mixed>
Return values
array<string|int, mixed>

convertToSingleRecord()

public convertToSingleRecord(array<string|int, mixed> $data) : mixed
Parameters
$data : array<string|int, mixed>
Return values
mixed

exportRecords()

Download a result_set as a csv.

public exportRecords(string $format, string $file_name, array<string|int, mixed> $result, array<string|int, mixed> $filter_columns) : array<string|int, mixed>|bool
Parameters
$format : string
$file_name : string
$result : array<string|int, mixed>
$filter_columns : array<string|int, mixed>
Return values
array<string|int, mixed>|bool

getAPIMessageID()

Returns the API messageID for each individual call.

public getAPIMessageID() : bool|null
Return values
bool|null

getCurrentCompany()

public getCurrentCompany() : array<string|int, mixed>
Return values
array<string|int, mixed>

getCurrentUser()

public getCurrentUser() : array<string|int, mixed>
Return values
array<string|int, mixed>

getCurrentUserName()

public getCurrentUserName() : array<string|int, mixed>
Return values
array<string|int, mixed>

getCurrentUserPreference()

public getCurrentUserPreference() : array<string|int, mixed>
Return values
array<string|int, mixed>

getCustomFieldData()

public getCustomFieldData() : array<string|int, mixed>
Return values
array<string|int, mixed>

getLocale()

public getLocale([null $language = null ][, null $country = null ]) : null
Parameters
$language : null = null
$country : null = null
Return values
null

getMainClassObject()

public getMainClassObject() : string
Return values
string

getNextInsertID()

public getNextInsertID() : string
Return values
string

getOptions()

Bridge to main class getOptions factory.

public getOptions([bool $name = false ][, string|int $parent = null ]) : array<string|int, mixed>|bool
Parameters
$name : bool = false
$parent : string|int = null
Return values
array<string|int, mixed>|bool

getOptionsBatch()

Bridge multiple batched requests to main class getOptions factory.

public getOptionsBatch([array<string|int, mixed> $requested_options = [] ]) : array<string|int, mixed>
Parameters
$requested_options : array<string|int, mixed> = []
Return values
array<string|int, mixed>

getPagerData()

public getPagerData() : array<string|int, mixed>|bool
Return values
array<string|int, mixed>|bool

getPermissionChildren()

public getPermissionChildren() : array<string|int, mixed>
Return values
array<string|int, mixed>

getPostLoginData()

Returns all post login data required in a single call for optimization purposes.

public getPostLoginData([array<string|int, mixed> $data = [] ]) : array<string|int, mixed>
Parameters
$data : array<string|int, mixed> = []
Return values
array<string|int, mixed>

| bool

getPreLoginData()

Returns all login data required in a single call for optimization purposes.

public getPreLoginData([null $api = null ][, mixed $authentication_type = 'USER_NAME' ]) : array<string|int, mixed>
Parameters
$api : null = null
$authentication_type : mixed = 'USER_NAME'
Return values
array<string|int, mixed>

getProduction()

Functions that can be called before the API client is logged in.

public getProduction() : bool

Mainly so the proper loading/login page can be displayed.

Return values
bool

getProtocolVersion()

public getProtocolVersion() : int
Return values
int

getTTProductEdition()

public getTTProductEdition([bool $name = false ]) : int|string
Parameters
$name : bool = false
Return values
int|string

getVariableToFunctionMap()

Bridge to main class getVariableToFunctionMap factory.

public getVariableToFunctionMap(string $name[, string|int $parent = null ]) : array<string|int, mixed>
Parameters
$name : string
$parent : string|int = null
Return values
array<string|int, mixed>

handlePermissionFilterColumns()

In cases where data can be displayed in just a list_view (dropdown boxes), ie: branch, department, job, task in In/Out punch view restrict the dropdown box to just a subset of columns, so not all data is shown.

public handlePermissionFilterColumns(array<string|int, mixed> $filter_columns, array<string|int, mixed> $allowed_columns) : array<string|int, mixed>|null
Parameters
$filter_columns : array<string|int, mixed>
$allowed_columns : array<string|int, mixed>
Return values
array<string|int, mixed>|null

handleRecordValidationResults()

public handleRecordValidationResults(object|bool $validator, array<string|int, mixed> $validator_stats, int $key, array<string|int, mixed>|bool $save_result[, bool $user_generic_status_batch_id = false ][, mixed $system_job_queue = false ]) : array<string|int, mixed>
Parameters
$validator : object|bool
$validator_stats : array<string|int, mixed>
$key : int
$save_result : array<string|int, mixed>|bool
$user_generic_status_batch_id : bool = false
$system_job_queue : mixed = false
Return values
array<string|int, mixed>

initializeFilterAndPager()

public initializeFilterAndPager(array<string|int, mixed> $data[, bool $disable_paging = false ]) : array<string|int, mixed>|bool
Parameters
$data : array<string|int, mixed>
$disable_paging : bool = false
Return values
array<string|int, mixed>|bool

isLoggedIn()

public isLoggedIn([bool $touch_updated_date = true ][, string $type = 'USER_NAME' ]) : bool
Parameters
$touch_updated_date : bool = true
$type : string = 'USER_NAME'
Return values
bool

isProgressBarStarted()

public isProgressBarStarted() : bool
Return values
bool

Login()

Default username=NULL to prevent argument warnings messages if its not passed from the API.

public Login([null $user_name = null ][, null $password = null ][, string $type = 'USER_NAME' ]) : array<string|int, mixed>|null
Parameters
$user_name : null = null
$password : null = null
$type : string = 'USER_NAME'
Return values
array<string|int, mixed>|null

markNotificationAsRead()

Used to mark notifications as read from things like tracking pixels in notification emails.

public markNotificationAsRead(string $user_id, int $type_id, string $object_id) : bool

Authentication is not required for this, but the user_id, type_id and object_id must all match and would be very unlikely to guess. Plus its pretty benign even if they do.

Parameters
$user_id : string

UUID

$type_id : int

INT

$object_id : string

UUID

Tags
throws
DBError
Return values
bool

newSession()

public newSession(string $user_id[, string $invoice_invoice_client_id = null ][, string $ip_address = null ][, string $user_agent = null ][, string $client_id = null ][, string $end_point_id = null ][, null $type_id = null ]) : array<string|int, mixed>|bool
Parameters
$user_id : string

UUID

$invoice_invoice_client_id : string = null

UUID

$ip_address : string = null
$user_agent : string = null
$client_id : string = null

UUID

$end_point_id : string = null
$type_id : null = null
Tags
throws
DBError
throws
ReflectionException
Return values
array<string|int, mixed>|bool

passwordReset()

Reset the password if users forgotten their password

public passwordReset( $key,  $password,  $password2) : array<string|int, mixed>
Parameters
$key :
$password :
$password2 :
Return values
array<string|int, mixed>

Ping()

Ping function is also in APIMisc for when the session timesout is valid.

public Ping() : bool

Ping no longer can tell if the session is timed-out, must use "isLoggedIn(FALSE)" instead.

Return values
bool

PunchLogin()

public PunchLogin([null $user_name = null ][, null $password = null ]) : array<string|int, mixed>
Parameters
$user_name : null = null
$password : null = null
Return values
array<string|int, mixed>

registerAPIKey()

Register permanent API key Session ID to be used for all subsequent API calls without needing a username/password.

public registerAPIKey(string $user_name, string $password[, mixed $end_point = null ]) : bool|string
Parameters
$user_name : string
$password : string
$end_point : mixed = null
Return values
bool|string

resetPassword()

public resetPassword( $email) : array<string|int, mixed>
Parameters
$email :
Return values
array<string|int, mixed>

returnHandler()

Controls returning information to client in a standard format.

public returnHandler([bool $retval = true ][, bool $code = false ][, bool $description = false ][, bool $details = false ][, bool $validator_stats = false ][, bool $user_generic_status_batch_id = false ][, bool $request_data = false ][, bool $system_job_queue = false ]) : array<string|int, mixed>|bool

FIXME: Need to return the original request (with any modified values due to restrictions/validation issues) Also need to return paging data variables here too, as JSON can't make multiple calls. In order to do this we need to always return a special data structure that includes this information. static function returnHandler( $retval = TRUE, $args = array( 'code' => FALSE, 'description' => FALSE, 'details' = FALSE, 'validator_stats' => FALSE, 'user_generic_status_batch_id' => FALSE ) ) { The above will require too many changes, just add two more variables at the end, as it will only really be used by API->get*() functions. FIXME: Use a requestHandler() to handle all input requests, so we can parse out things like validate_only, ignore_warning (for user acknowledgable warnings) and handling all parameter parsing in a central place. static function returnHandler( $retval = TRUE, $code = FALSE, $description = FALSE, $details = FALSE, $validator_stats = FALSE, $user_generic_status_batch_id = FALSE, $request = FALSE, $pager = FALSE ) {

Parameters
$retval : bool = true
$code : bool = false
$description : bool = false
$details : bool = false
$validator_stats : bool = false
$user_generic_status_batch_id : bool = false
$request_data : bool = false
$system_job_queue : bool = false
Return values
array<string|int, mixed>|bool

sendCSRFTokenCookie()

Sends a refreshed CSRF token cookie in case it expires prior to the user clicking the login button. This helps avoid showing an error message and triggering a full browser refresh.

public sendCSRFTokenCookie() : mixed
Return values
mixed

sendErrorReport()

Function that HTML5 interface can call when an irrecoverable error or uncaught exception is triggered.

public sendErrorReport([null $data = null ][, null $screenshot = null ]) : string
Parameters
$data : null = null
$screenshot : null = null
Return values
string

setAPIMessageID()

public setAPIMessageID(string $id) : bool
Parameters
$id : string

UUID

Return values
bool

setMainClassObject()

Allow storing the main class object persistently in memory, so we can build up other variables to help out things like getOptions() Mainly used for the APIReport class.

public setMainClassObject(object $obj) : bool
Parameters
$obj : object
Return values
bool

setPagerObject()

public setPagerObject(object $lf) : bool
Parameters
$lf : object
Return values
bool

setProgressBarObject()

public setProgressBarObject( $progress_bar_obj) : bool
Parameters
$progress_bar_obj :
Return values
bool

setValidationArray()

public setValidationArray(array<string|int, Validator$validator_obj_arr[, string $record_label = null ]) : array<string|int, mixed>|bool
Parameters
$validator_obj_arr : array<string|int, Validator>

Array of Validator objects.

$record_label : string = null

Prefix for record label if performing a mass function to differentiate one record from another.

Return values
array<string|int, mixed>|bool

stripReturnHandler()

public stripReturnHandler(mixed $retarr) : mixed
Parameters
$retarr : mixed
Return values
mixed

switchUser()

Accepts user_id or user_name.

public switchUser(string $user_id) : bool
Parameters
$user_id : string

UUID

Return values
bool

Search results