CWIS Developer Documentation

- Home
- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
RestAPIHelper Class Reference

## Public Member Functions
| __construct ($APIUrl, $APIPassword, $CheckForDuplicateFn, $RegisterMessageFn)
| Constructor. More...
| DoRestCommand ($Params)
| Run a REST API command against a remote site. More...
| EncodeEncryptedMessage ($Data)
| Construct an encrypted message packet from provided data. More...
| DecodeEncryptedMessage ($PostData)
| Decrypt an encrypted message packet. More...

## Detailed Description

Definition at line 10 of file RestAPIHelper.php.

## Constructor & Destructor Documentation

RestAPIHelper::__construct | ( |  | $APIUrl,
|  |  | $APIPassword,
|  |  | $CheckForDuplicateFn,
|  |  | $RegisterMessageFn
| ) |  |

Constructor.

Parameters

  string | $APIUrl | Url to which REST calls will be directed.
  string | $APIPassword | Password for encrypting and authenticating rest calls.
  callable | $CheckForDuplicateFn | Function to check for duplicated messages.
  callable | $RegisterMessageFn | Function to register a message as received.

Definition at line 22 of file RestAPIHelper.php.

## Member Function Documentation

RestAPIHelper::DecodeEncryptedMessage | ( |  | $PostData | ) |

Decrypt an encrypted message packet.

Parameters

  array | $PostData | Encrypted data.

Returns
  array Result, always has a "Status" member that will either be "OK" on success or "Error". In the case of an error, there will also be a "Message" giving a description of the issue. On success, there will be a "Data" member giving the decrypted payload.

Definition at line 146 of file RestAPIHelper.php.

Referenced by DoRestCommand().

Here is the caller graph for this function:

RestAPIHelper::DoRestCommand | ( |  | $Params | ) |

Run a REST API command against a remote site.

Parameters

  array | $Params | REST API call parameters (often from $_POST).

Returns
  response from the remote site (format depends on the command issued) or NULL on command failure.

Definition at line 37 of file RestAPIHelper.php.

References DecodeEncryptedMessage(), and EncodeEncryptedMessage().

RestAPIHelper::EncodeEncryptedMessage | ( |  | $Data | ) |

Construct an encrypted message packet from provided data.

Parameters

  array | $Data | Data to encapsulate

Returns
  array Encrypted packet

Definition at line 91 of file RestAPIHelper.php.

Referenced by DoRestCommand().

Here is the caller graph for this function:

The documentation for this class was generated from the following file:

- objects/RestAPIHelper.php