Upload file to alfresco using java spring boot

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Active Member

Upload file to alfresco using java spring boot

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.

11 Replies
Highlighted
Alfresco Employee

Re: Upload file to alfresco using java spring boot

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.

Software Engineer in Alfresco Search Team.
Highlighted
Active Member

Re: Upload file to alfresco using java spring boot

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

Highlighted
Alfresco Employee

Re: Upload file to alfresco using java spring boot

Take a look at

https://ecmarchitect.com/archives/2013/08/26/3528

Software Engineer in Alfresco Search Team.
Highlighted
Active Member

Re: Upload file to alfresco using java spring boot

thanks a lot for replying so quicky. Much appreciated. I'll go through that document and let you know.

Highlighted
Senior Member

Re: Upload file to alfresco using java spring boot

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

Regards,
Kintu | ContCentric
Highlighted
Active Member

Re: Upload file to alfresco using java spring boot

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 ? 


Highlighted
Active Member

Re: Upload file to alfresco using java spring boot

i'll go through this and let you know. Thank you for replying to me.

Highlighted
Active Member

Re: Upload file to alfresco using java spring boot

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.

Highlighted
Professional

Re: Upload file to alfresco using java spring boot

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.