Difference between revisions of "Integration/ContentConnector"
old>Admin |
m (39 revisions imported) |
||
(33 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
== CMS content provider == | == CMS content provider == | ||
The CMS connector will allow CMS systems to extract information from a TempusServa system, and display it inline in other pages. | |||
Example: | |||
Data extracted from the Tempus Serva connector | |||
http://alpha.tempusserva.dk/TempusServa/cmsinterface?q=examdates | |||
The final result inside a page in our website | |||
http://tempusserva.dk/site/index.php/da/eksamensdatoer | |||
Notes on usage | |||
* A CMS system is no requirement and static HTML files will work too. | |||
* The TS backend will not be slowed because all content is cached in the connector (configurable) | |||
* Connectors have NO influence on licensing | |||
== Tempus Serva setup (provider) == | == Tempus Serva setup (provider) == | ||
Frontend | |||
# Make the request that suits youre needs | |||
#* Filters and parameters | |||
#* Sorting / grouping | |||
#* Fields to display | |||
#* Fields to display | |||
#* Page size | |||
# Save the view | |||
# Click on the view and copy the parameters | |||
Backend | |||
# Check that anonumous users have the right permissions | |||
#* Note the interface will only allow READ operations | |||
# Go to "Integration" > "Content connector" | |||
# Add new element | |||
## Give the connector a unique name (CONNECTOR_NAME>) | |||
## Choose solution and set command type (as seen in the "command" parameter in the URL) | |||
## Paste alle parameters from the URL above | |||
##* Optionally add other settings like Language and Stylesheet | |||
## Optionally define a variable that the "v" parameter will be mapped to (OPTIONAL_VARIABLE) | |||
# Test the new connector | |||
URL format | |||
* http://myserver.dk/TS/'''cmsinterface?q='''<CONNECTOR_NAME> | |||
* http://myserver.dk/TS/'''cmsinterface?q='''<CONNECTOR_NAME>'''&v='''<OPTIONAL_VARIABLE> | |||
Example URL's | |||
* http://myserver.dk/TS/'''cmsinterface?q=customerList&v=3''' | |||
* http://myserver.dk/TS/'''cmsinterface?q=longActivityList&v=3''' | |||
* http://myserver.dk/TS/'''cmsinterface?q=singleActivityById&v=782382386''' | |||
Note that links between lists and single items will first be supported by Q2/2014. | |||
== CMS system setup (consumer) == | == CMS system setup (consumer) == | ||
=== Overcoming | === Option: Client rendering === | ||
The following procedure | |||
# Make sure JQuery is available (normal JS can do the job) | |||
# Insert content placeholder and Javascript code | |||
<div id='tsContent' class='tsContent'></div> | |||
<script> | |||
jQuery.ajax( | |||
{ | |||
url: 'http://myserver.com/TempusServaProxy.php?q=examdates', | |||
success: function(data) { jQuery('#tsContent').html(data); } | |||
}); | |||
</script> | |||
Note: The URL above reflects the use of a proxy script (see below). | |||
=== Option: Server side include === | |||
Insert code that fetches the content | |||
echo file_get_contents("http://myserver.com/TS/cmsinterface?q=examdates") | |||
In some cases you might want to remove the wrapper, header etc. from normal pages. This is done by adding the AjaxMode parameter. | |||
echo file_get_contents("https://talentpiper.com/demo/mainpublic?command=dk.p2e.blanket.codeunit.common.PagePublicRecordsListAndShow&AjaxMode=1"); | |||
Note: The URL above reflects the direct use of interface. | |||
=== Overcoming CORS protection === | |||
I cases where the TempusServa server and the CMS system is on different domains (ex. acme.shared.com and cms.acme.com), browsers will prevent pages from accessing content from other servers. | I cases where the TempusServa server and the CMS system is on different domains (ex. acme.shared.com and cms.acme.com), browsers will prevent pages from accessing content from other servers. | ||
Two options exist | |||
# Use server side includes (ok, but not supported everywhere) | # Use server side includes (ok, but not supported everywhere) | ||
# Set up a mini proxyserver | # Set up a mini proxyserver | ||
A mini proxyserver written i PHP is very simple (aspx/jsp will have similar features). | A mini proxyserver written i PHP is very simple (aspx/jsp will have similar features) and placed on the CMS side. | ||
<?php | <?php | ||
echo file_get_contents("http://myserver.dk/TS/cmsinterface?q=".$_GET["q"]."&v=".$_GET["v"]); | echo file_get_contents("http://myserver.dk/TS/cmsinterface?q=".$_GET["q"]."&v=".$_GET["v"]); | ||
The proxy can also be deployed on another domain than the CMS system. | |||
<?php | |||
header("Access-Control-Allow-Origin: *"); | |||
echo file_get_contents("http://myserver.dk/TS/cmsinterface?q=".$_GET["q"]."&v=".$_GET["v"]); | |||
For a more safe version write the name of the CMS domain | |||
header("Access-Control-Allow-Origin: www.tempusserva.dk"); | |||
Afterwards you just make the calls through the proxy using exact same parameters. | Afterwards you just make the calls through the proxy using exact same parameters. |
Latest revision as of 11:52, 10 December 2021
CMS content provider
The CMS connector will allow CMS systems to extract information from a TempusServa system, and display it inline in other pages.
Example:
Data extracted from the Tempus Serva connector http://alpha.tempusserva.dk/TempusServa/cmsinterface?q=examdates
The final result inside a page in our website http://tempusserva.dk/site/index.php/da/eksamensdatoer
Notes on usage
- A CMS system is no requirement and static HTML files will work too.
- The TS backend will not be slowed because all content is cached in the connector (configurable)
- Connectors have NO influence on licensing
Tempus Serva setup (provider)
Frontend
- Make the request that suits youre needs
- Filters and parameters
- Sorting / grouping
- Fields to display
- Fields to display
- Page size
- Save the view
- Click on the view and copy the parameters
Backend
- Check that anonumous users have the right permissions
- Note the interface will only allow READ operations
- Go to "Integration" > "Content connector"
- Add new element
- Give the connector a unique name (CONNECTOR_NAME>)
- Choose solution and set command type (as seen in the "command" parameter in the URL)
- Paste alle parameters from the URL above
- Optionally add other settings like Language and Stylesheet
- Optionally define a variable that the "v" parameter will be mapped to (OPTIONAL_VARIABLE)
- Test the new connector
URL format
- http://myserver.dk/TS/cmsinterface?q=<CONNECTOR_NAME>
- http://myserver.dk/TS/cmsinterface?q=<CONNECTOR_NAME>&v=<OPTIONAL_VARIABLE>
Example URL's
- http://myserver.dk/TS/cmsinterface?q=customerList&v=3
- http://myserver.dk/TS/cmsinterface?q=longActivityList&v=3
- http://myserver.dk/TS/cmsinterface?q=singleActivityById&v=782382386
Note that links between lists and single items will first be supported by Q2/2014.
CMS system setup (consumer)
Option: Client rendering
The following procedure
- Make sure JQuery is available (normal JS can do the job)
- Insert content placeholder and Javascript code
<script> jQuery.ajax( { url: 'http://myserver.com/TempusServaProxy.php?q=examdates', success: function(data) { jQuery('#tsContent').html(data); } }); </script>
Note: The URL above reflects the use of a proxy script (see below).
Option: Server side include
Insert code that fetches the content
echo file_get_contents("http://myserver.com/TS/cmsinterface?q=examdates")
In some cases you might want to remove the wrapper, header etc. from normal pages. This is done by adding the AjaxMode parameter.
echo file_get_contents("https://talentpiper.com/demo/mainpublic?command=dk.p2e.blanket.codeunit.common.PagePublicRecordsListAndShow&AjaxMode=1");
Note: The URL above reflects the direct use of interface.
Overcoming CORS protection
I cases where the TempusServa server and the CMS system is on different domains (ex. acme.shared.com and cms.acme.com), browsers will prevent pages from accessing content from other servers.
Two options exist
- Use server side includes (ok, but not supported everywhere)
- Set up a mini proxyserver
A mini proxyserver written i PHP is very simple (aspx/jsp will have similar features) and placed on the CMS side.
<?php echo file_get_contents("http://myserver.dk/TS/cmsinterface?q=".$_GET["q"]."&v=".$_GET["v"]);
The proxy can also be deployed on another domain than the CMS system.
<?php header("Access-Control-Allow-Origin: *"); echo file_get_contents("http://myserver.dk/TS/cmsinterface?q=".$_GET["q"]."&v=".$_GET["v"]);
For a more safe version write the name of the CMS domain
header("Access-Control-Allow-Origin: www.tempusserva.dk");
Afterwards you just make the calls through the proxy using exact same parameters.