Using the REST API in your own software

Do you want to access the Jomres functionality through a simple, well documented API? You can, easily, using the REST API.


The API is well documented here, and it provides you with a sigificant amount of flexibility to manipulate the system, but did you know that you can also access the API from within the same server?


Let's say that you're building a feature for your client, it's in another component/plugin on the same server. You want to access some Jomres data without making any changes to Jomres Core files. Here's how you do it.


/** Create definitions */
if (!defined('_JOMRES_INITCHECK')) { define('_JOMRES_INITCHECK', 1 ); }

if (!defined('JOMRES_ROOT_DIRECTORY')) { define ( 'JOMRES_ROOT_DIRECTORY' , "jomres" ) ; }

/** Include the Jomres Framework */

/** Import the Jomres Call API class */

$call_api = new jomres_call_api('system');

/** Set the request method to GET and the endpoint to search for properties with 3 stars ( ) */

$method = 'GET';
$endpoint = 'search/stars/3';
$result = $call_api->send_request( $method , $endpoint );


The "system" user is a special REST API user that allows the system to call any installed REST API feature, see

If you need to send headers, you can do something like

$headers = array ( "X-JOMRES-channel-name : ".$channel_name );

And to POST data you could do something like

$post_data = array ("params" => json_encode($data_object) );

to build the POST data.

When you inspect (or dump) the content of the result you will see something like :

object(stdClass)#4112 (2) {
  object(stdClass)#4111 (1) {
    object(stdClass)#4078 (14) {
      object(stdClass)#4073 (15) {
        string(13) "Jaguar S Type"
        string(16) "26 Goldhawk Road"