cancel
Showing results for 
Search instead for 
Did you mean: 

Create file on the cloud with the API

dahevos
Champ in-the-making
Champ in-the-making
Hello,

On the documentation it said that we have to use a POST request but not where and not which parameter must be set.
So, how to send data (content of a text file for example) with a POST request ?

Thanks
5 REPLIES 5

jpotts
World-Class Innovator
World-Class Innovator
This is quite an old post, so perhaps you figured it out in the meantime. If not, or for others, when you are performing CRUD operations on files and folders against Alfresco in the Cloud you are using CMIS. So if you've ever used CMIS to create, read, update, or delete folders or documents against a CMIS server like Alfresco on-premise, you already know how to do it against Alfresco in the Cloud.

I have some example code here: http://code.google.com/p/alfresco-api-java-examples/

Starting with Alfresco 4.2, the same public API available in the cloud is also available locally. The code examples work against either.

If you are not using Java and you want to use a POST directly, look at that source code to understand how the URLs work, then take a look at <a href="http://ecmarchitect.com/images/articles/cmis/cmis-article.pdf">this tutorial</a> which shows how to use CURL and CMIS together.

Also, the documentation for the public API is available <a href="https://www.alfresco.com/develop/cloud">here</a>.

Hope that helps,

Jeff

syncovery
Champ in-the-making
Champ in-the-making
Dear Jpotts

can you please show workable http request path for POST upload. the example in your tutorial shows local path.

Also, can you please bring clean example of Atom Entry XML package. I have been trying with one from your tutorial but betting bad XML format error response.

thank you very much,

jpotts
World-Class Innovator
World-Class Innovator
The API example I refer to works for both cloud and local.

You should really use one of the libraries so that you don't have to deal with the binding directly. But if you cannot do that, try getting the example running, then use a proxy or a packet sniffer to see the XML that goes across.

Jeff

syncovery
Champ in-the-making
Champ in-the-making
Thank you for idea Jeff,
since I don't work in Java environment, any reference to compiled Java client that can upload to Alfresco is welcome.

url for create document in Cloud Alfresco is:
https://api.alfresco.com/'+CompanyName+'/public/cmis/versions/1.1/browser/root/sites/'+ AccountName +'/documentlibrary/'

please let me know if you can figure out url for update document.

thanks in advance,

syncovery
Champ in-the-making
Champ in-the-making
In my case PUT request to
https://api.alfresco.com/'+ CompanyName +'/public/cmis/versions/1.0/atom/content?id=' + FileGUID;
with sending content of file,

replaces content of current document.