Forum


Enabling API

More
6 months 6 days ago #47222 by Adam Yared
Enabling API was created by Adam Yared
Hi,

im trying to enable the API and have been following the documentation at:

www.jomres.net/manual/developers-guide-2/63-jomres-api

but it seems to be out of date, referring to a API Core Module that i dont see in the Jomres Plugin Manager under the Core Plugins tab. I have installed all the Core API and Webhook plugins but still dont have the API option in the Site Configuration tab.

Can anyone direct me to up to date doco or advise what i need to do to get the API working?

I have Jomres 9.15.0 installed.

Thanks

Please Log in or Create an account to join the conversation.

More
6 months 4 days ago #47223 by Joan
Replied by Joan on topic Enabling API
Hello,

Are you trying to install, maybe outdated, "Api Core" and/or "Webhooks Core" plugins?

If so, have you tried installing the plugin "Superserver Client" and/or "Api Feature Superserver"?

If I remember right, one of these installed "Api Core" and "Webhooks Core" plugins.


Thanks!


Attachments:

Please Log in or Create an account to join the conversation.

More
6 months 4 days ago #47224 by Adam Yared
Replied by Adam Yared on topic Enabling API
Thank you Joan! "Superserver Client" was the winner.. installed API and Webhook Core..

Please Log in or Create an account to join the conversation.

More
6 months 4 days ago #47225 by Adam Yared
Replied by Adam Yared on topic Enabling API
But this didn't seem to enable the API option under the Site Configuration tab which is needed to crated oauth credentials...

Any ideas on this?

Please Log in or Create an account to join the conversation.

More
6 months 4 days ago #47226 by Joan
Replied by Joan on topic Enabling API
Hello,

Is this what you are looking for?
I see this at the bottom of: Site configuration - Misc
API Core configuration
Webhooks

Thanks!

Attachments:

Please Log in or Create an account to join the conversation.

More
6 months 3 days ago #47227 by Adam Yared
Replied by Adam Yared on topic Enabling API
Thanks for this Joan.. I turned the API Core configuration option to Yes (was 'No') but it didn't seem to change anything unfortunately. I still cant see the 'API' tab in the Site Configuration page..

Please Log in or Create an account to join the conversation.

More
6 months 3 days ago #47230 by Vince Wooll
Replied by Vince Wooll on topic Enabling API
Once you have configured that functionality to show in the frontend, you will see this option in the frontend menu, not Site Configuration :


Follow me on twitter
Do not send me PMs, if you need to contact me use the ticket system.
Read this before you customise Jomres files

Please Log in or Create an account to join the conversation.

More
5 months 2 weeks ago #47243 by Adam Yared
Replied by Adam Yared on topic Enabling API
Thanks Vince, thats got it. Now I've got the API working insofar as i am able to generate a token and successfully call the methods described in api.jomres.net .

When i call the get all properties method though:

/jomres/api/properties/all

i only get the property ids back and there doesnt seem to be a method to get all the attributes of a property, as in:

/jomres/api/properties/[id]/details (this returns 404)

Is there a way to get the attributes back, namely those supported in the insert method:

/jomres/api/properties/add/

property_nameAPI Property
property_streetAPI Property
property_townAPI Property
region6
property_postcodeXXNN NNXX
countryAD
property_tel01234 567890
price0
lat51.50068
long-0.14317
ptype_id1
stars4
superior0
property_descriptionLorem ipsum dolor sit amet...
property_checkin_timesLorem ipsum dolor sit amet...
property_area_activitiesLorem ipsum dolor sit amet...
property_driving_directionsLorem ipsum dolor sit amet...
property_airportsLorem ipsum dolor sit amet...
property_othertransportLorem ipsum dolor sit amet...
property_policies_disclaimers

Please Log in or Create an account to join the conversation.

More
5 months 2 weeks ago #47248 by Vince Wooll
Replied by Vince Wooll on topic Enabling API
I'm not setup to test this right now and I'm pressed for time (still officially on holiday), but add it to the end of the /GET/properties.php script and let me know if it works for you.

Follow me on twitter
Do not send me PMs, if you need to contact me use the ticket system.
Read this before you customise Jomres files

Please Log in or Create an account to join the conversation.

More
5 months 2 weeks ago - 5 months 2 weeks ago #47249 by Vince Wooll
Replied by Vince Wooll on topic Enabling API
Flight::route('GET /properties/full/@language', function()
{
if (!isset($language))
$language = "en-GB";
$_REQUEST = $language;
require_once("../framework.php");

validate_scope::validate('properties_get');

$call_self = new call_self();
$elements = array(
"method"=>"GET",
"request"=>"properties/all",
"data"=>array()
);

$users_properties = json_decode($call_self->call($elements));

if ( count ($users_properties->data->ids) > 0 ) {
$current_property_details = jomres_singleton_abstract::getInstance('basic_property_details');
$current_property_details->gather_data_multi($users_properties->data->ids);
Flight::json( $response_name = "full_data" , $current_property_details->multi_query_result );
}
else {
Flight::halt(403, "User has no properties");
}
});

Follow me on twitter
Do not send me PMs, if you need to contact me use the ticket system.
Read this before you customise Jomres files
Last edit: 5 months 2 weeks ago by Vince Wooll.

Please Log in or Create an account to join the conversation.

More
5 months 2 weeks ago #47250 by Vince Wooll
Replied by Vince Wooll on topic Enabling API
Script sets up the Framework.

Using Framework means we can use Jomres core functionality without recreating the wheel. The downside of loading the Framework is that it takes time to load the various files, therefore it's optional within the API. Back when I first created the API code 2 years ago, IIRC a simple API call using pure PDO would result in responses in about 10ms. Using the Framework that goes up to about 150ms. Still not too shabby, but it's useful to know.

Next we'll make another API call to ourselves to get the manager's property uids (in fact it calls the method in that script).

Once we have the manager's UIDs we can use the basic Jomres functionality, in this case basic_property_details->gather_data_multi class method, to actually get everything we can for the properties.

Let me know how it goes. Once you've confirmed that it's working I'll add it to the plugin formally.

Follow me on twitter
Do not send me PMs, if you need to contact me use the ticket system.
Read this before you customise Jomres files

Please Log in or Create an account to join the conversation.

More
5 months 2 weeks ago - 5 months 2 weeks ago #47252 by Adam Yared
Replied by Adam Yared on topic Enabling API
Hi Vince,

thanks for looking at this on your time off!

What file is the code to be added to?

Attachments:
Last edit: 5 months 2 weeks ago by Adam Yared.

Please Log in or Create an account to join the conversation.

More
5 months 1 week ago #47254 by Vince Wooll
Replied by Vince Wooll on topic Enabling API
Look in /jomres/core-plugins/api_feature_properties/GET for properties.php

Follow me on twitter
Do not send me PMs, if you need to contact me use the ticket system.
Read this before you customise Jomres files

Please Log in or Create an account to join the conversation.

More
5 months 1 week ago - 5 months 1 week ago #47257 by Adam Yared
Replied by Adam Yared on topic Enabling API
Thanks Vince, that code was throwing errors so i just amended the existing sql query to include what i needed. It's pretty quick
Last edit: 5 months 1 week ago by Adam Yared.

Please Log in or Create an account to join the conversation.

More
5 months 1 week ago #47258 by Vince Wooll
Replied by Vince Wooll on topic Enabling API
Awesome.

Follow me on twitter
Do not send me PMs, if you need to contact me use the ticket system.
Read this before you customise Jomres files

Please Log in or Create an account to join the conversation.

ABOUT US

Vince portrait smallaladar

Developed and maintained by Vince Wooll and Aladar Barthi, Jomres was initially conceived in early 2005 as a Mambo based solution to a client’s hotel management needs. While it wasn't originally expected to be an online booking system it quickly morphed into one as users requested more and more features.

As the number of feature requests grew Vince knew that he would need to dedicate more time to the project and in July 2005 Jomres was formally released as a commercial project. Since then, Jomres has become one of Mambo’s, and now Joomla’s, longest running projects. It has survived various versions of Mambo, then Joomla 1.0, 1.5, 1.6, 1.7, 2.5 and 3.

Aladar joined the project in 2010 after using Jomres for his own projects. He was active on the forum, helping other members of the community and eventually Vince invited him to join the team. He has since become an integral part of the project and has contributed significantly to it's development over the years.

Whilst not formally part of the Jomres project, Rodrigo Rocco and the team have become firm friends. Rod is a freelancer who specialises in doing custom work for Jomres users and developing custom plugins for the system that take advantage of it's modular design. He has built many useful extensions including his fabulous new Valentina Template Package.

 

Jomres and the Jomres Logo is trademarked and can't be used without written consent from the owner.

www.jomres.net is not affiliated with or endorsed by the Joomla! Project, Open Source Matters or the WordPress project. The Joomla! & WordPress names and logos are used under a limited license granted by Open Source Matters and the WordPress Projects.

© Copyright 2005 - 2018 Woollyinwales IT.