Skip to main content

Lock

POST /wopi/files/(file_id)

Locks a file so it can be edited by the WOPI client application instance that requested the lock.

This operation works as follows:

  1. The WOPI host checks whether the file is currently locked.
  2. If the file is not locked, the host locks the file and returns 200 OK.
  3. If the file is already locked and the X-WOPI-Lock value matches the current lock, the host refreshes the lock timer and returns 200 OK.
  4. In all other cases, the host must return 409 Conflict ("lock mismatch") and include the X-WOPI-Lock response header with the current lock value.
  5. If the file is locked by a third-party client, the host should still always include the current lock ID in the X-WOPI-Lock response header.

Parameters​

NameTypeDescription
file_idstringThe file ID. The ID must be URL-safe.

Query parameters​

NameTypeDescription
access_tokenstringThe access token the host uses to determine whether the request is authorized.

Request headers​

NameTypeRequiredDescription
X-WOPI-OverridestringRequiredRequested operation from the WOPI server (LOCK).
X-WOPI-LockstringRequiredLock ID that identifies the lock on the file.

Response headers​

NameTypeRequiredDescription
X-WOPI-LockstringOptionalLock ID identifying the current lock. Must always be included when responding with 409 Conflict. Should not be included when responding with 200 OK.
X-WOPI-LockFailureReasonstringOptionalReason for lock failure. May be included when responding with 409 Conflict (logging only).
X-WOPI-ItemVersionstringOptionalFile version.