# api

The load_local_api() function is used to initiate local api commands from within add-ons, hooks, and from within the same hosting account as the Open-realty software is running in:

load_local_api(string $api_command, array $api_data, string $api_user, string $api_password) : array

Returns: (array)

Parameters:

$api_command (string)

Name of the api command to run. Example: 'pclass__create'

$api_data (array)

REQUIRED - Array of data to pass to the API Command. See Each API Command for details for what each expects to be passed to it.

$api_user (string)

OPTIONAL user to run the api command as. This is only required if called from outside of Open-Realty.

$api_password (string)

OPTIONAL password for the user running api command. This is only required if called from outside of Open-Realty.


The send_api_command()function is just like the  load_local_api() function except it is used to initiate api commands on a distant Open-Realty (host) site from a location outside of where that Open-Realty site is hosted/installed (remote). The remote site does not have to be running Open-Realty, but will need PHP available.

send_api_command(string $api_server, string $api_command, array $api_data, string $api_user, string $api_password) : array

Returns: (array)

Parameters:

$api_server (string)

REQUIRED - URL of the Open-Realty site to execute the api command on. Ex http://yourdomain.com/admin/index.php

$api_command (string)

REQUIRED - Name of the api command to run. Example. pclass__create

$api_data  (array)

REQUIRED - Array of data to pass to the API Command. See Each API Command for details on what to pass.

$api_user (string)

REQUIRED - OR username to run the api command as.

$api_password (string)

REQUIRED - Password for the user running the api command.