PHPCap API

RedCapApiConnectionInterface

Interface for connection to the API of a REDCap instance.

Classes implementing this interface are used to provide low-level access to the REDCap API.

Table of Contents

__construct()  : mixed
Constructor that creates a REDCap API connection for the specified URL, with the specified settings.
__destruct()  : mixed
Destructor for this class.
call()  : string
Makes a call to REDCap's API and returns the results.
callWithArray()  : string
Calls REDCap's API using a with a correctly formatted string version of the specified array and returns the results.
getCallInfo()  : mixed
Returns call information for the most recent call.
getConnectionTimeoutInSeconds()  : int
Gets the timeout for time to make a connection in seconds.
getErrorHandler()  : mixed
Gets the error handler for the connection.
getSslVerify()  : bool
Gets the status of SSL verification for the connection.
getTimeoutInSeconds()  : int
Gets the timeout in seconds for calls to the connection.
getUrl()  : mixed
Gets the URL of the connection.
setConnectionTimeoutInSeconds()  : int
Sets the timeout for time to make a connection in seconds.
setErrorHandler()  : mixed
Sets the error handler;
setSslVerify()  : mixed
Sets SSL verification for the connection.
setTimeoutInSeconds()  : mixed
Sets the timeout in seconds for calls to the connection.
setUrl()  : mixed
Sets the URL of the connection.

Methods

__construct()

Constructor that creates a REDCap API connection for the specified URL, with the specified settings.

public __construct(string $url, bool $sslVerify, string $caCertificateFile, ErrorHandlerInterface $errorHandler) : mixed
Parameters
$url : string

the URL for the API of the REDCap site that you want to connect to.

$sslVerify : bool

indicates if verification should be done for the SSL connection to REDCap. Setting this to false is not secure.

$caCertificateFile : string

the CA (Certificate Authority) certificate file used for veriying the REDCap site's SSL certificate (i.e., for verifying that the REDCap site that is connected to is the one specified).

$errorHandler : ErrorHandlerInterface

the error handler for the connection.

Return values
mixed

call()

Makes a call to REDCap's API and returns the results.

public call(mixed $data) : string
Parameters
$data : mixed

data for the call.

Tags
throws
PhpCapException
Return values
string

the response returned by the REDCap API for the specified call data. See the REDCap API documentation for more information.

callWithArray()

Calls REDCap's API using a with a correctly formatted string version of the specified array and returns the results.

public callWithArray( $dataArray) : string
Parameters
$dataArray :

array the array of data that is converted to a string and then passed to the REDCap API.

Tags
throws
PhpCapException
Return values
string

the response returned by the REDCap API for the specified call data. See the REDCap API documentation for more information.

getCallInfo()

Returns call information for the most recent call.

public getCallInfo() : mixed

The format of the call information will be connection dependent.

Return values
mixed

getConnectionTimeoutInSeconds()

Gets the timeout for time to make a connection in seconds.

public getConnectionTimeoutInSeconds() : int
Return values
int

connection timeout in seconds.

getErrorHandler()

Gets the error handler for the connection.

public getErrorHandler() : mixed

return ErrorHandlerInterface the error handler for the connection.

Return values
mixed

getSslVerify()

Gets the status of SSL verification for the connection.

public getSslVerify() : bool
Return values
bool

true if SSL verification is enabled, and false otherwise.

getTimeoutInSeconds()

Gets the timeout in seconds for calls to the connection.

public getTimeoutInSeconds() : int
Return values
int

timeout in seconds for calls to connection.

getUrl()

Gets the URL of the connection.

public getUrl() : mixed

return string the URL of the connection.

Return values
mixed

setConnectionTimeoutInSeconds()

Sets the timeout for time to make a connection in seconds.

public setConnectionTimeoutInSeconds(mixed $connectionTimeoutInSeconds) : int
Parameters
$connectionTimeoutInSeconds : mixed
Return values
int

connection timeout in seconds.

setSslVerify()

Sets SSL verification for the connection.

public setSslVerify(bool $sslVerify) : mixed
Parameters
$sslVerify : bool

if this is true, then the site being connected to will have its SSL certificate verified.

Return values
mixed

setTimeoutInSeconds()

Sets the timeout in seconds for calls to the connection.

public setTimeoutInSeconds( $timeoutInSeconds) : mixed
Parameters
$timeoutInSeconds :

timeout in seconds for call to connection.

Return values
mixed

setUrl()

Sets the URL of the connection.

public setUrl(string $url) : mixed
Parameters
$url : string

the URL of the connection.

Return values
mixed

Search results