Reserve File
/documents/api/1.1/files/{fileId}/reserve
Reserve the specified file. A file reservation lets other users (or processes) know that the file is in use.
Request
- application/json
- application/xml
- fileId
-
Type:
stringRequired:trueGlobally unique identifier (GUID) for the file.
- dAccessCode
-
Type:
stringAccess code needed to use protected public links. It needs to be sent as part of a Cookie header in the following format:
dAccessCode-<linkID>=<passcodeValue> - linkID
-
Type:
stringPublic link ID of a public link authorizing the current user to access this file. To work, this public link must have the contributor role granted. It can be used as linkID or LinkID.
Response
- application/json
- application/xml
The request was fulfilled.
- errorCode
-
Type:
numberAn error code of zero (0) indicates no errors. - id
-
Type:
stringGlobally unique identifier (GUID) for the file. - reservationDate
-
Type:
stringGlobally unique identifier (GUID) for the parent folder. If the parent folder is the user's home folder, the value for
.parentIDisself. - reservedBy
-
Type:
objectUserAdditional Properties Allowed:User information - type
-
Type:
stringItem typefile.
- displayName
-
Type:
stringThe display name for the user. - id
-
Type:
stringGlobally unique identifier (GUID) for the user. - type
-
Type:
stringItem typeuser.
Example application/json
{
"id":"D5B8B54BA8C121BEDB91A1341212FF6185DEA5EFC0BD",
"reservationDate":"2015-06-15T19:34:17.000Z",
"reservedBy":{
"id":"U0EAA20910FAF3052ACB79E4T00000000001",
"displayName":"User AA",
"type":"user"
},
"type":"file",
"errorCode":"0"
}
Forbidden if the user does not have read permission.
File ID is not found.
Examples
The following example reserves the specified file.
POST .../files/D5B8B54BA8C121BEDB91A1341212FF6185DEA5EFC0BD/reserve
Request Header
None.
Request Body
None.
HTTP Status Code
HTTP_STATUS = 200
JSON Response
{
"errorCode": "0",
"id": "D5B8B54BA8C121BEDB91A1341212FF6185DEA5EFC0BD",
"reservationDate": "2015-06-15T19:34:17Z",
"reservedBy": {
"displayName": "Tenant1.UserA",
"id": "UC2E53B19A37A58B8CE28F3B1212FF6185DE",
"type": "user"
},
"type": "file"
}
Example 2
The following example reserves the specified file. The example uses a public link ID because this file is under a folder structure not owned by or shared with the current user.
POST .../files/D5B8B54BA8C121BEDB91A1341212FF6185DEA5EFC0BD/reserve
Request Header
LinkID: LF8D36FAFAB4388BECEAC4AEB5D17B95F47087F4E518
Request Body
None.
HTTP Status Code
HTTP_STATUS = 200
JSON Response
{
"errorCode": "0",
"id": "D5B8B54BA8C121BEDB91A1341212FF6185DEA5EFC0BD",
"reservationTime": "2016-06-30T21:16:22Z",
"reservedBy": {
"displayName": "User BB",
"id": "U6A0B35B0548F250914D18FDB5D17B95F470",
"type": "user"
},
"type": "file"
}
Example 3
The following example reserves the specified file. The example uses a public link ID protected by an access code because this file is under a folder structure not owned by or shared with the current user. An access code (test12345) is submitted as part of a Cookie in the request header.
POST .../files/D5B8B54BA8C121BEDB91A1341212FF6185DEA5EFC0BD/reserve
Request Header
LinkID: LF8D36FAFAB4388BECEAC4AEB5D17B95F47087F4E518 Cookie: dAccessCode-LF8D36FAFAB4388BECEAC4AEB5D17B95F47087F4E518=test12345
Request Body
None.
HTTP Status Code
HTTP_STATUS = 200
JSON Response
{
"errorCode": "0",
"id": "D5B8B54BA8C121BEDB91A1341212FF6185DEA5EFC0BD",
"reservationTime": "2016-06-30T21:16:22Z",
"reservedBy": {
"displayName": "User BB",
"id": "U6A0B35B0548F250914D18FDB5D17B95F470",
"type": "user"
},
"type": "file"
}
Example 4
The following example requests reservation of the specified file. Because this file is under a folder structure not owned by or shared with the current user, an access denied error message is returned.
POST .../files/D5B8B54BA8C121BEDB91A1341212FF6185DEA5EFC0BD/reserve
Request Header
None.
Request Body
None.
HTTP Status Code
HTTP_STATUS = 403
JSON Response
{
"errorCode": "-20",
"errorKey": "!csFldCouldNotSetReservation!csCloudItemInsufficientPrivileges,User BB,fFileGUID:D5B8B54BA8C121BEDB91A1341212FF6185DEA5EFC0BD,FLD_SET_RESERVATION",
"errorMessage": "Could not set reservation. User 'User BB' has insufficient privilege to access fFileGUID:D5B8B54BA8C121BEDB91A1341212FF6185DEA5EFC0BD with service FLD_SET_RESERVATION.",
"id": "D5B8B54BA8C121BEDB91A1341212FF6185DEA5EFC0BD",
"title": "Could not set reservation. User 'User BB' has insufficient privilege to access fFileGUID:D5B8B54BA8C121BEDB91A1341212FF6185DEA5EFC0BD with service FLD_SET_RESERVATION.",
"type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}
Example 5
The following example requests reservation of the specified file. This file is under a folder structure not owned by or shared with the current user, and only a public link protected by an access code is available. An error is returned because the access code was not submitted as part of the request.
POST .../files/D5B8B54BA8C121BEDB91A1341212FF6185DEA5EFC0BD/reserve
Request Header
LinkID: LF8D36FAFAB4388BECEAC4AEB5D17B95F47087F4E518
Request Body
None.
HTTP Status Code
HTTP_STATUS = 403
JSON Response
{
"errorCode": "-18",
"errorKey": "!csFldCouldNotSetReservation!csAccessCodeRequiredForLinkAccess",
"errorMessage": "Could not set reservation. The access code must be provided to access the link.",
"id": "D5B8B54BA8C121BEDB91A1341212FF6185DEA5EFC0BD",
"title": "Could not set reservation. The access code must be provided to access the link.",
"type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}