Homelab, Linux, JS & ABAP (~˘▾˘)~
 

[VSC] Create/Read/Delete File in CMIS Repository via VSC Rest-API Client

API Specification: http://docs.oasis-open.org/cmis/CMIS/v1.1/os/examples/browser/

Helpful Postman Collection: https://gist.github.com/aborroy/3f1f2360b0e85067675643aa648a8112

Create:

@folderId = <myFolderID>
@fileName = <myFileName>

### Create Object
# @name object
POST http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser/root
Authorization: Basic user:password
Content-Type: multipart/form-data; boundary=boundary

--boundary
Content-Disposition: form-data; name="succinct"
Content-Type: text/plain; charset=utf-8

true
--boundary
Content-Disposition: form-data; name="cmisaction"
Content-Type: text/plain; charset=utf-8

createDocument
--boundary
Content-Disposition: form-data; name="objectId"
Content-Type: text/plain; charset=utf-8

{{folderId}}
--boundary
Content-Disposition: form-data; name="propertyId[0]"
Content-Type: text/plain; charset=utf-8

cmis:name
--boundary
Content-Disposition: form-data; name="propertyValue[0]"
Content-Type: text/plain; charset=utf-8

{{fileName}}
--boundary
Content-Disposition: form-data; name="propertyId[1]"
Content-Type: text/plain; charset=utf-8

cmis:objectTypeId
--boundary
Content-Disposition: form-data; name="propertyValue[1]"
Content-Type: text/plain; charset=utf-8

cmis:document
--boundary
Content-Disposition: form-data; name="content"; filename=image.png
Content-Type: image/png
Content-Transfer-Encoding: binary

< image.png

--boundary--

### Fill Variable from Response
@ID = {{object.response.body.succinctProperties.cmis:objectId}}

Read:

### Get Object properties
GET http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser/root
?cmisselector=properties
&objectId={{ID}}
Authorization: Basic user:password

### Get Object content
GET http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser/root
?cmisselector=content
&objectId={{ID}}
Authorization: Basic user:password

### Get Object content stream
GET http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser/root
?getContentStream
&objectId={{ID}}
Authorization: Basic user:password

Delete:

### Delete Object
POST http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser/root
Authorization: Basic user:password
Content-Type: multipart/form-data; boundary=boundary

--boundary
Content-Disposition: form-data; name="objectId"
Content-Type: text/plain; charset=utf-8

{{ID}}
--boundary
Content-Disposition: form-data; name="cmisaction"
Content-Type: text/plain; charset=utf-8

delete
--boundary--

[VSC] Post form-data via VSC Rest-API Client

Next to the .http file in the same folder, place your .env for hostname and authorization and the file you want to upload.
The parameter name="file" stands for the key that the files should belong to.

### Post form-data
POST {{$dotenv hostname}}/my/endpoint HTTP/1.1
Authorization: Basic {{$dotenv auth_in_base64}}
Content-Type: multipart/form-data; boundary=boundary
Accept: */*

--boundary
Content-Disposition: form-data; name="file"; filename="image.png"
Content-Type: image/png

< ./image.png

--boundary--