cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco API

radhika_shivara
Champ in-the-making
Champ in-the-making
Is it possible to  add custom API which does following things
-Upload a file (pdf, doc etc) to alfresco and return link for that file
-send this link to an external site from the same API

9 REPLIES 9

mitpatoliya
Star Collaborator
Star Collaborator
You need to use different APIs for each of operation

Upload file - Return noderef of created file
Other API  return link of file based on noderef
then you can use that link to send it any application you want.

radhika_shivara
Champ in-the-making
Champ in-the-making
Thanks for the reply
Does this APIs are available, if then how and where to make the call to that API

kaynezhang
World-Class Innovator
World-Class Innovator
Alfresco 's security mechanisms ensure that only authenticated users have the permissions to access content,so even if you can send a note's repository link to an external site ,the user can't access this content through the url,because the use request the url is not authenticated .
I suggest you write a proxy servlet ,you proxy sevlet do following things.
1.users upload files to your proxy servlet,and your proxy servlet call alfresco api to add content,alfresco api will return the uploaded content node's uuid or path.
2. your proxy servlet generate an url base on your sevlet's cotextpath and node's uuid or path .when use request the url ,your proxy servlet parses the request and call alfresco api to download the file and sent it to user browser.

I installed "alfresco-community-4.2.e-installer-win-x64" in my local machine. Want to know where should I write these servlet or making API calls.

Thank you for your quick reply

kaynezhang
World-Class Innovator
World-Class Innovator
It depends on how you will use alfresco .
If you want to use share application ,you can customize share (for example custom webscript).
If you want to use alfresco as a ecm repository and build your own web application,you can write a proxy servlet in your application.

I want to use share application.

kaynezhang
World-Class Innovator
World-Class Innovator
You can write a java-backed custom webscript which dose not need authentication .the webscript will download file from repository and provoide link that can be aceesed from external site.

How to add this java backed web-script for repository folder, do i need to use curl for data transfer? I did a hello world using web-script using following doc
http://docs.alfresco.com/3.4/index.jsp?topic=%2Fcom.alfresco.Enterprise_3_4_0.doc%2Ftasks%2Fws-hello...
Thanks in advance

kaynezhang
World-Class Innovator
World-Class Innovator
There are many options on how to call webscript api
1.you can call webscript from java using apache commons httpclient.
2.you can call webscript from java using ScriptRemote object in share.
3.you can call webscript from javascript using remote object in share.
There are no difference whether data webscript is saved in repository or classpath.