API - Receive and Send hotel calendar data - Rest API extension
This is an open discussion with 5 replies, filed under Extensions.
Search
I've never used the rest API extension (so may be a good option), but we did need to integrate a clients custom API into a site once, we managed to do this relatively simply by creating an extension specifically for the API.
The general process is (all in an extension.driver.php file):
- Register PHP functions for the frontend.
- Define a few basic delegates/callbacks
- Create your PHP functions as you would normally within the file, all referenced from either the delegates or from the front end using the PHP functions that were registered.
See a gist covering this here.
And then in your event you have something like this in your __trigger
function:
if($result->getAttribute('result') == "success") { require_once(EXTENSIONS . '/custom_api/extension.driver.php'); $APISend = new extension_custom_api(); $APISend::APICustomAction($value); }
Sidenote: I'm not sure how 'proper' the above approach is. It works absolutely fine, but some more seasoned Symphonists might be disgusted by the approach - I'll be interested to see! :)
If you can handle it with only datasouce filters:
Make a new page type xml
and Admin
Include the desired datasource and in the page template:
<xsl:template match="/"> <xsl:copy-of select="data"/> </xsl:template>
And you can share a dynamic xml page with auth token
Nathan,
saving a booking form in a symphony section and sending it with the custom_api is working, how can i now receive the room inventory and rates? The central platform can send the xml to our api page, but whats the best approach to transform this data and save it to our corresponding sections? THX
whats the best approach to transform this data and save it to our corresponding sections
I would say consider looking at XML Importer the integration branch. used it in production environments, for major website migrations, it should be able to handle what you have in mind. And if you want to transfer it into symphony data you could run a cron and have the data update automatically.
Gunglien, yes, this could be a perfect solution, thank you for the hint, will keep you posted.
Create an account or sign in to comment.
We are developing a hotel website platform and need to synchronise the rooms inventory and rates with another external platform by giving our API to the external platform.
Is this possible with the REST API extension? How to set this up?