2

Im working on a Java project that needs to upload files using either REST or CMIS (both services are available). I'm completely new to these APIs and would like to ask which one would be easiest and more straightforward to implement. I can't use external libraries in the project, so I will need to implement the client from scratch.

Note: the only requirement is to upload files.

Thanks in advance.

acfoltzer
  • 5,588
  • 31
  • 48
Ladich
  • 23
  • 4

2 Answers2

2

The goal of the Content Management Interoperability Services (CMIS) specification is to provide a set of services for working with rich content repositories. It provides a entire specification for ECM applications, that can be REST or SOAP.

CMIS provides specification to operations that control folders,documents,relationships and policy.

I think that for your upload, using CMIS would be like killing a fly with a bomb.

Raduan Santos
  • 1,023
  • 1
  • 21
  • 45
1

While I admit that I don't know CMIS, file upload with REST is just classic HTTP file upload where you interpret the path name as indicative of the resource to update or replace. Basic REST usage would have you do (an HTTP) GET (method) as “read the file”, POST as “create the file while picking a new name” (typically with a redirect afterwards so that the client can find out what name was picked), PUT as “create the file with the given name or replace that file's contents”, and DELETE as “delete the file”. Moreover, you don't need to support all those methods; do as few as you want (but it's a good idea to support some GET requests, even if just to let people that their uploads worked).

However, when implementing you want in all cases to try to avoid holding much of the file's data in memory; that doesn't scale. Better to take the time to implement streaming transfers so that you never actually need to buffer more than a few kilobytes. You can certainly do this with REST/HTTP. (You could even do it with SOAP using MTOM, but that's probably out of scope for you…)

Donal Fellows
  • 133,037
  • 18
  • 149
  • 215
  • Thanks Donal, looks like with a few methods ill be sorted. Ill have a look at that... waiting for a CMIS answer... – Ladich Aug 09 '11 at 13:20
  • @Ladich Take my advice and bound how long you want to wait for an answer to a day or two. Given the relative number of questions tagged with `rest` and `cmis`, there's a fair chance it will be a long time before anyone responds on that front. A desire for perfect knowledge is well enough, but being able to deliver a working solution sooner is always a winning approach; timeboxing your wait will ensure that you don't waste your time. – Donal Fellows Aug 09 '11 at 23:10