UnlockAndRelockΒΆ
- Required for
Online iOS Android
-
POST
/wopi/files/
(file_id)ΒΆ The UnlockAndRelock operation releases a lock on a file, and then immediately takes a new lock on the file.
Important
This operation must be atomic.
UnlockAndRelock is very similar semantically to the Lock operation. The two operations share the same X-WOPI-Override value. Thus, hosts must differentiate the two operations based on the presence, or lack of, the X-WOPI-OldLock request header.
Unlike the Lock operation, the UnlockAndRelock operation passes the current expected lock ID in the X-WOPI-OldLock request header. The X-WOPI-Lock value is the lock ID for the new lock.
If the file is currently locked and the X-WOPI-OldLock value does not match the lock currently on the file, or if the file is unlocked, the host must return a βlock mismatchβ response (409 Conflict) and include an X-WOPI-Lock response header containing the value of the current lock on the file. In the case where the file is unlocked, the host must set X-WOPI-Lock to the empty string.
In the case where the file is locked by someone other than a WOPI client, hosts should still always include the current lock ID in the X-WOPI-Lock response header. However, if the current lock ID is not representable as a WOPI lock (for example, it is longer than the maximum lock length), the X-WOPI-Lock response header should be set to the empty string or omitted completely.
See Lock for more general information regarding locks.
- Parameters
file_id (string) β A string that specifies a file ID of a file managed by host. This string must be URL safe.
- Query Parameters
access_token (string) β An access token that the host will use to determine whether the request is authorized.
- Request Headers
X-WOPI-Override β The string
LOCK
. Required.X-WOPI-Lock β A string provided by the WOPI client that the host must use to identify the new lock on the file. The maximum length of a lock ID is 1024 ASCII characters. Required.
X-WOPI-OldLock β A string provided by the WOPI client that is the existing lock on the file. Required. Note that if X-WOPI-OldLock is not provided, the request is identical to a Lock request.
- Response Headers
X-WOPI-Lock β A string value identifying the current lock on the file. This header must always be included when responding to the request with 409 Conflict. It should not be included when responding to the request with 200 OK.
X-WOPI-LockFailureReason β An optional string value indicating the cause of a lock failure. This header may be included when responding to the request with 409 Conflict. There is no standard for how this string is formatted, and it must only be used for logging purposes.
X-WOPI-LockedByOtherInterface β
Deprecated since version 2015-12-15: This header is deprecated and should be ignored by WOPI clients.
- Status Codes
200 OK β Success
400 Bad Request β X-WOPI-Lock was not provided or was empty
401 Unauthorized β Invalid access token
404 Not Found β Resource not found/user unauthorized
409 Conflict β Lock mismatch/locked by another interface; an X-WOPI-Lock response header containing the value of the current lock on the file must always be included when using this response code
500 Internal Server Error β Server error
501 Not Implemented β Operation not supported
See also
- Standard WOPI request and response headers
In addition to the request/response headers listed here, this operation may also use the Standard WOPI request and response headers.