cancel
Showing results for 
Search instead for 
Did you mean: 

Uploading a file using CMIS API URL

Vishruti_Shah
Champ in-the-making
Champ in-the-making

Hi,

I need to upload a file to the basic alfresco repository using a CMIS 1.1 API, the API can be of any binding Atompub or browser binding. Which API URL can be used in order to upload the file?

If any such URL can be used please do provide any references.

5 REPLIES 5

kaynezhang
World-Class Innovator
World-Class Innovator

Either browser binding or Atompub binding can do ,but browser binding is recommended.
Following is code example using apache chemistry cmis api,

Fiirst you need to create a session,then using the session to create folder or document.

SessionFactory sessionFactory = SessionFactoryImpl.newInstance();
		Map<String, String> params = new HashMap<String, String>();
		params.put(SessionParameter.USER, "admin");
		params.put(SessionParameter.PASSWORD, "admin");
		params.put(SessionParameter.BROWSER_URL, "http://192.168.11.100:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser");
		params.put(SessionParameter.BINDING_TYPE, BindingType.BROWSER.value());

		List<Repository> repos = sessionFactory.getRepositories(params);
		Session session = repos.get(0).createSession();

About how to create folder or document please refer to https://chemistry.apache.org/java/examples/example-create-update.html

Can we get a direct URL which we can hit via postman because I am not looking for any custom code to be done for the same?

You can use api-explorer  create node api.

Rest APIs works fine but I am looking for CMIS API (either using browser binding method or using atompub method) to insert/upload a file on to the alfresco repository.

Can you please suggest me any of the CMIS API URL for the same? I am not looking for any custom code.