Sharing a folder

In this How-To we will share a folder with a friend. At the moment DriveOnWeb will only allow sharing of folders inside the “Shared Folder” folder.
So we will create the folder inside the “Shared Folder” folder and share it with our friend granting him read/write/delete access.

Step 1

Request:

Create a contact for our friend.

POST /rest/contacts

{
  "email": "TestKontakt@ asd.de",
  "firstname": "Test",
  "lastname": "Kontakt"
}

Response:

{
  "id": 225852,
  "email": "testKontakt@ asd.de",
  "firstname": "Test",
  "lastname": "Kontakt",
  "type": "contact"
}

Step 2

Request:

Create a folder inside the “Shared Folder”.

Create a folder.

POST /rest/folders/225826/folders

{
  "name": "Test Share",
  "description": ""
}

Response:

The response includes the id of the new folder, which we need to share the folder.

{
  "id": 225853,
  "name": "Test Share",
  "description": "",
  "createdDate": "1456144089983",
  "modifiedDate": "1456144090073",
  "createdUser": {
    "id": 225822,
    "username": "REST.DEMO",
    "firstname": "Demo",
    "lastname": "Demonicum",
    "type": "user"
  },
  "modifiedUser": {
    "id": 225822,
    "username": "REST.DEMO",
    "firstname": "Demo",
    "lastname": "Demonicum",
    "type": "user"
  },
  "parent": {
    "id": 225819,
    "name": "Root",
    "type": "folder"
  },
  "status": {
    "published": false,
    "locked": false,
    "type": "status"
  },
  "sharedLink": {
    "url": null,
    "passwordEnabled": false,
    "password": null,
    "expirationDate": null,
    "canEdit": false,
    "type": "link"
  },
  "type": "folder"
}

Step 3

Request:

Find the “Shared Folder”.

For that we need all folders inside the “root” folder.

GET /rest/folders/225819/folders

Response:

The response includes all Folders inside the root folder. I.E. loop through response and look for the “Shared Folder” folder id = 225826.

[
 {
  "id": 225826,
  "name": "Shared Folder",
  "description": "",
  "createdDate": "1456134890354",
  "modifiedDate": "1456134890508",
  "createdUser": {
    "id": 225822,
    "username": "REST.DEMO",
    "firstname": "Demo",
    "lastname": "Demonicum",
    "type": "user"
  },
  "modifiedUser": {
    "id": 225822,
    "username": "REST.DEMO",
    "firstname": "Demo",
    "lastname": "Demonicum",
    "type": "user"
  },
  "parent": {
    "id": 225819,
    "name": "Root",
    "type": "folder"
  },
  "status": {
    "published": false,
    "locked": false,
    "type": "status"
  },
  "sharedLink": {
    "url": null,
    "passwordEnabled": false,
    "password": null,
    "expirationDate": null,
    "canEdit": false,
    "type": "link"
  },
  "type": "folder"
},
 {
  "id": 225833,
  "name": "Mitarbeiter",
  "description": "",
  "createdDate": "1456134890833",
  "modifiedDate": "1456134891240",
  "createdUser": {
    "id": 225822,
    "username": "REST.DEMO",
    "firstname": "Demo",
    "lastname": "Demonicum",
    "type": "user"
  },
  "modifiedUser": {
    "id": 225822,
    "username": "REST.DEMO",
    "firstname": "Demo",
    "lastname": "Demonicum",
    "type": "user"
  },
  "parent": {
    "id": 225819,
    "name": "Root",
    "type": "folder"
  },
  "status": {
    "published": false,
    "locked": false,
    "type": "status"
  },
  "sharedLink": {
    "url": null,
    "passwordEnabled": false,
    "password": null,
    "expirationDate": null,
    "canEdit": false,
    "type": "link"
  },
  "type": "folder"
 },
 {
  "id": 225829,
  "name": "Public Folder",
  "description": "",
  "createdDate": "1456134890526",
  "modifiedDate": "1456134890604",
  "createdUser": {
    "id": 225822,
    "username": "REST.DEMO",
    "firstname": "Demo",
    "lastname": "Demonicum",
    "type": "user"
  },
  "modifiedUser": {
    "id": 225822,
    "username": "REST.DEMO",
    "firstname": "Demo",
    "lastname": "Demonicum",
    "type": "user"
  },
  "parent": {
    "id": 225819,
    "name": "Root",
    "type": "folder"
  },
  "status": {
    "published": true,
    "locked": false,
    "type": "status"
  },
  "sharedLink": {
    "url": "https://localhost/dowdoc/f7d1b638f619ddbb5e2ec07878a29754",
    "passwordEnabled": false,
    "password": null,
    "expirationDate": null,
    "canEdit": true,
    "type": "link"
  },
  "type": "folder"
 },
 {
  "id": 225849,
  "name": "Test Upload",
  "description": "",
  "createdDate": "1456135638236",
  "modifiedDate": "1456136017338",
  "createdUser": {
    "id": 225822,
    "username": "REST.DEMO",
    "firstname": "Demo",
    "lastname": "Demonicum",
    "type": "user"
  },
    "modifiedUser": {
    "id": 225822,
    "username": "REST.DEMO",
    "firstname": "Demo",
    "lastname": "Demonicum",
    "type": "user"
  },
  "parent": {
    "id": 225819,
    "name": "Root",
    "type": "folder"
  },
  "status": {
    "published": false,
    "locked": false,
    "type": "status"
  },
  "sharedLink": {
    "url": null,
    "passwordEnabled": false,
    "password": null,
    "expirationDate": null,
    "canEdit": false,
    "type": "link"
  },
  "type": "folder"
},
 {
  "id": 225834,
  "name": "Abteilung",
  "description": "",
  "createdDate": "1456134890909",
  "modifiedDate": "1456134891022",
  "createdUser": {
    "id": 225822,
    "username": "REST.DEMO",
    "firstname": "Demo",
    "lastname": "Demonicum",
    "type": "user"
  },
  "modifiedUser": {
    "id": 225822,
    "username": "REST.DEMO",
    "firstname": "Demo",
    "lastname": "Demonicum",
    "type": "user"
  },
  "parent": {
    "id": 225819,
    "name": "Root",
    "type": "folder"
  },
  "status": {
    "published": false,
    "locked": false,
    "type": "status"
  },
  "sharedLink": {
    "url": null,
    "passwordEnabled": false,
    "password": null,
    "expirationDate": null,
    "canEdit": false,
    "type": "link"
  },
  "type": "folder"
 },
 {
  "id": 225832,
  "name": "Projekte",
  "description": "",
  "createdDate": "1456134890755",
  "modifiedDate": "1456134891339",
  "createdUser": {
    "id": 225822,
    "username": "REST.DEMO",
    "firstname": "Demo",
    "lastname": "Demonicum",
    "type": "user"
  },
  "modifiedUser": {
    "id": 225822,
    "username": "REST.DEMO",
    "firstname": "Demo",
    "lastname": "Demonicum",
    "type": "user"
  },
  "parent": {
    "id": 225819,
    "name": "Root",
    "type": "folder"
  },
  "status": {
    "published": false,
    "locked": false,
    "type": "status"
  },
  "sharedLink": {
    "url": null,
    "passwordEnabled": false,
    "password": null,
    "expirationDate": null,
    "canEdit": false,
    "type": "link"
  },
  "type": "folder"
 },
 {
  "id": 225831,
  "name": "Vertrieb",
  "description": "",
  "createdDate": "1456134890674",
  "modifiedDate": "1456134891457",
  "createdUser": {
    "id": 225822,
    "username": "REST.DEMO",
    "firstname": "Demo",
    "lastname": "Demonicum",
    "type": "user"
  },
  "modifiedUser": {
    "id": 225822,
    "username": "REST.DEMO",
    "firstname": "Demo",
    "lastname": "Demonicum",
    "type": "user"
  },
  "parent": {
    "id": 225819,
    "name": "Root",
    "type": "folder"
  },
  "status": {
    "published": false,
    "locked": false,
    "type": "status"
  },
  "sharedLink": {
    "url": null,
    "passwordEnabled": false,
    "password": null,
    "expirationDate": null,
    "canEdit": false,
    "type": "link"
  },
  "type": "folder"
 }
]

Step 4

Request:

Share the created folder with our friend.

/rest/folders/225853/shares

{
 "subject":"Hello Test",
 "message":"This is a test share.",
 "grantDEL": "true",
 "grantRW": "true",
 "buddyIds":[
 225852
 ],
 "buddyGroupIds":[
 
 ]
}

Response:

The response will contain no response body so the response status will be 204. Our friend will be notified with an email.