As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
Hi, I'm new to Alfresco. I have a simple report generation using jasper and that document(pdf) is currently save to "public" folder in my project. My task is to save my report to alfresco document manager. I'm using alfresco 6.1.Can someone please guide me on this. I read several blogs and i dont have a clear idea on how to do above task. Thank you.
Hope this helps:
https://github.com/aborroy/cmis-associations-alfresco
This project is creating associations, but it can be used as template for your requirement.
thanks a lot for the reply. I'll go though that. Can you provide a simple guidline to upload a file to alfresco using java. My alfresco version is 6.1.I tried several blogs. But i can find CMIS in alfresco 6.1. Some have mentioned that it will start with alfresco and i'm not getting a clear idea. Can you give a clear guidance on how to upload a file using alfresco 6.1 in java. Thank you
Take a look at
https://ecmarchitect.com/archives/2013/08/26/3528
thanks a lot for replying so quicky. Much appreciated. I'll go through that document and let you know.
You can use the following OOTB APIs in order to upload a document from your java application to Alfresco.
1. Authentication - http://localhost:8080/alfresco/api/s/login
2. Upload document - http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/{nodeId}/children
You will need to pass the authentication ticket in upload document API.
Please refer the following link for the response and body required to pass:
https://api-explorer.alfresco.com/api-explorer/#/
Thanks,
Kintu
ContCentric
In the document you provided, when we grab the session, we provide username, password, ATOMPUB_URL. In here what is username ? is this the admin of my alfresco user or any user in alfresco ? And what should i provide for ATOMPUB_URL ? In a stack overflow asnwer i saw a url like this >"http://127.0.0.1:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom"
What should i use for atompub_url with alfresco 6.1 ?
i'll go through this and let you know. Thank you for replying to me.
hi, I tried to authenticate it by typing this url >"http://localhost:8080/alfresco/api/s/login?u=myUSER&pw=myPW"And i am not getting a token. I only get a blank response body. It has nothing in it. Btw i provided my admin username and password.
Answering your question about the CMIS URL, yes, what you found is the correct CMIS service URL. Yes, just use any username and password that has access to the folder in Alfresco you are trying to write to.
CMIS will be easier to use than the Alfresco REST API for this, in my opinion, but either one can be used.
I'm a bit surprised almost all replies propose an upload through CMIS here. (Only @jpotts shortly mentions the possibility to use the REST API.)
Isn't Alfresco promoting the public REST API as primary integration point?
For reference: Alfresco's REST API which could also be used to perform the upload of your document: https://api-explorer.alfresco.com/api-explorer/#/nodes
I suspect the replies propose using CMIS because it is easier in this case. You are already in Java. OpenCMIS gives you a nice library to work with Java objects. Why go to the trouble of using the REST API? Plus, the OP wants to create documents, which is right in the CMIS wheelhouse.
Alfresco is promoting the use of the REST API primarily from remote, non-Java clients, such as a JavaScript front-end.
Either way you choose it doesn't matter--the nice thing is that developer's have options. Use what comes natural for you and the project.