cancel
Showing results for 
Search instead for 
Did you mean: 

Content making RESTful calls

wilsonb
Champ on-the-rise
Champ on-the-rise
Hi, as I’m relatively new to Alfresco I was not sure if there was a way to do the following: I was asked by a colleague if content created in Alfresco could use some out of the box Alfresco mechanism to pull data back from external RESTful services. I suspect the answer in no as I would expect an app server to have to do the processing of these requests and Alfresco does not work that way, however as I say, I’m new to it and so I thought I would ask a dumb question. I know I can do this in a bespoke manner by creating tags myself and processing them in an app server but they were looking to have some magic out of the box solution.
3 REPLIES 3

mrogers
Star Contributor
Star Contributor
If you are, for example, running a rule then you can do anything, including reading data from an external location. 
Or you could add a scheduled job in a similar way that user accounts get pulled from LDAP.

However you are exposing Alfresco to an external dependency so you would need to consider very carefuly what you are trying to achieve, and what happens if that dependency is not available or is compromised.  Yes its possible, however the bigger question is whether you should.

wilsonb
Champ on-the-rise
Champ on-the-rise
Hi, Sorry to be on the ignorant side but you say "…running a rule…", I have briefly looked into this but I can't see how a rule can be used to create a call to a RESTful service. I would appreciate a pointer to something I can do some further reading on as I'm not sure where to start.

mrogers
Star Contributor
Star Contributor
You need something to call your code.   I picked on a rule since that's a common way of triggering some code to run when something happens  (In particular to run some code when a new content item is added).   You could also have your code called by policies or actions.      

Once you are in Java Code you can do anything including reading an external URL.  The Apache HTTP Commons library is already included within the alfresco.war since there are already a few instances where the repo calls web scripts in particular the transfer service which is web script based.