class CRM_Utils_REST

This class handles all REST client requests.

Properties

static $rest_timeout Number of seconds we should let a REST process idle
$ufClass Cache the actual UF Class

Methods

__construct()

Class constructor. This caches the real user framework class locally, so we can use it for authentication and validation.

static string
ping(string $var = NULL)

Simple ping function to test for liveness.

static array
error(string $message = 'Unknown Error')

Generates values needed for error messages.

static array
simple(array $params)

Generates values needed for non-error responses.

string
run()

No description

string
bootAndRun()

No description

static string
output($result)

No description

static string
jsonFormated($data) deprecated

No description

static array|int
handle()

No description

static array|int
process($args, array $params)

No description

static array|mixed|null
buildParamList()

No description

static 
fatal($pearError)

No description

static 
loadTemplate()

used to load a template "inline", eg. for ajax, without having to build a menu for each template

static 
ajaxJson()

This is a wrapper so you can call an api via json (it returns json too) http://example.org/civicrm/api/json?entity=Contact&action=Get"&json={"contact_type":"Individual","email.get.email":{}} to take all the emails from individuals.

static array
ajax()

Run ajax request.

static array
processMultiple()

Callback for multiple ajax api calls from CRM.api3()

array|NULL
loadCMSBootstrap()

No description

Details

at line 52
__construct()

Class constructor. This caches the real user framework class locally, so we can use it for authentication and validation.

at line 67
static string ping(string $var = NULL)

Simple ping function to test for liveness.

Parameters

string $var The string to be echoed.

Return Value

string

at line 80
static array error(string $message = 'Unknown Error')

Generates values needed for error messages.

Parameters

string $message

Return Value

array

at line 94
static array simple(array $params)

Generates values needed for non-error responses.

Parameters

array $params

Return Value

array

at line 103
string run()

Return Value

string

at line 111
string bootAndRun()

Return Value

string

at line 124
static string output($result)

Parameters

$result

Return Value

string

at line 191
static string jsonFormated($data) deprecated

deprecated - switch to native JSON_PRETTY_PRINT when we drop support for php 5.3

Parameters

$data

Return Value

string

at line 281
static array|int handle()

Return Value

array|int

at line 353
static array|int process($args, array $params)

Parameters

$args
array $params

Return Value

array|int

at line 416
static array|mixed|null buildParamList()

Return Value

array|mixed|null

at line 451
static fatal($pearError)

Parameters

$pearError

at line 471
static loadTemplate()

used to load a template "inline", eg. for ajax, without having to build a menu for each template

at line 530
static ajaxJson()

This is a wrapper so you can call an api via json (it returns json too) http://example.org/civicrm/api/json?entity=Contact&action=Get"&json={"contact_type":"Individual","email.get.email":{}} to take all the emails from individuals.

Works for POST & GET (POST recommended).

at line 589
static array ajax()

Run ajax request.

Return Value

array

at line 653
static array processMultiple()

Callback for multiple ajax api calls from CRM.api3()

Return Value

array

at line 670
array|NULL loadCMSBootstrap()

Return Value

array|NULL NULL if execution should proceed; array if the response is already known