Store documents ArchiveLink compatible with CMIS
Prerequisites:
Folder must exist: /Knowledge Provider/ArchiveLink
custom Supplementaries must be available in CMIS
sapbo:boBase
sapbo:basedocument
sapbo:ArchiveLink
sapbo:ArchiveLinkExt
sapbo:BusinessObjectType
sapbo:basefolder
sapbo:KnowledgeProvider
sapbo:KnowledgeProviderExt
It should be enough to run SAP S/4 Hana Report CMIS_REPOSITORY_SETUP to fullfill these prerequisites.
Create Folder and Files
1. All ArchiveLink Documents should be placed in the Folder /Knowledge Provider/ArchiveLink. The Object ID of that folder is required. You can get it with a dimple get Request to:
http://localhost:8080/autodigit-cmis/browser/<repo>/root//Knowledge%20Provider/ArchiveLink?cmisselector=object
Response (ObjectId in Line 19):
{
"properties": {
"cmis:baseTypeId": {
"id": "cmis:baseTypeId",
"type": "id",
"cardinality": "single",
"value": "cmis:folder"
},
"cmis:objectTypeId": {
"id": "cmis:objectTypeId",
"type": "id",
"cardinality": "single",
"value": "cmis:folder"
},
"cmis:objectId": {
"id": "cmis:objectId",
"type": "id",
"cardinality": "single",
"value": "cfHN5c3RlbXwxfEZJfC9Lbm93bGVkZ2UgUHJvdmlkZXIvQXJjaGl2ZUxpbmsv"
},
...
Make sure to replace <repo> with the repositoryID e.g. rfHN5c3RlbXwxfEZJfC8%3D
See “get Object with Path” in attached Postman collection for an example.
2. Create Folder
A folder can be created with a POST request against:
http://localhost:8080/autodigit-cmis/browser/<repo>/root?objectId=<objectId>
Make sure to replace <repo> with the repositoryID e.g. rfHN5c3RlbXwxfEZJfC8%3D
ObjectID is the one from the first request ( e.g. cfHN5c3RlbXwxfEZJfC9Lbm93bGVkZ2UgUHJvdmlkZXIvQXJjaGl2ZUxpbmsv). It represents the folder where the new folder is created in.
Like in the first get request, we also get here a objectId of the newly created folder in the response. Line 19 contains the objectID.
{
"properties": {
"cmis:baseTypeId": {
"id": "cmis:baseTypeId",
"type": "id",
"cardinality": "single",
"value": "cmis:folder"
},
"cmis:objectTypeId": {
"id": "cmis:objectTypeId",
"type": "id",
"cardinality": "single",
"value": "cmis:folder"
},
"cmis:objectId": {
"id": "cmis:objectId",
"type": "id",
"cardinality": "single",
"value": "cfHN5c3RlbXwxfEZJfC9Lbm93bGVkZ2UgUHJvdmlkZXIvQXJjaGl2ZUxpbmsvZG9jSWQv"
},
See “create Folder” in attached Postman collection for an example. docID needs to be replaced with a real DocumentID.
3. create component
The component finaly is placed in the newly created folder.
http://localhost:8080/autodigit-cmis/browser/<repo>/root?objectId=<ObjectIdFromnewlyCreatedFolder>
Make sure to replace <repo> with the repositoryID e.g. rfHN5c3RlbXwxfEZJfC8%3D
ObjectID is the one from the first create request ( e.g. cfHN5c3RlbXwxfEZJfC9Lbm93bGVkZ2UgUHJvdmlkZXIvQXJjaGl2ZUxpbmsvZG9jSWQv
).
The content of thje file is in a multipart request:
...
-aPacHeCheMIStryoPEncmiS6a5a1a37createDocument1387efa49916fad9e1f
Content-Disposition: form-data; name="content"; filename=data.txt
Content-Type: text/plain
Content-Transfer-Encoding: binary
<BODY content>
See “create Folder” in attached Postman collection for an example. docID needs to be replaced with a real DocumentID. compID meeds to be replaced with a real compID.
Examples for Postman: