PutFile
POST /wopi/files/(file_id)/contents
The PutFile operation updates the binary contents of a file.
This operation works as follows:
- The WOPI host checks whether the file is currently locked.
- If the file is currently locked and the X-WOPI-Lock value does not match the current lock, the host must return 409 Conflict ("lock mismatch") and include the X-WOPI-Lock response header with the current lock value. If the file is not locked, the host must set X-WOPI-Lock to an empty string.
- If the file is not locked, the host must check the current file size. If it is 0 bytes, the PutFile request is considered valid and can proceed. If it is any value other than 0 bytes, or if the size is missing, the host should respond with 409 Conflict.
- 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
| Name | Type | Description |
|---|---|---|
| file_id | string | The file ID. The ID must be URL-safe. |
Query parameters
| Name | Type | Description |
|---|---|---|
| access_token | string | The access token the host uses to determine whether the request is authorized. |
Request headers
| Name | Type | Required | Description |
|---|---|---|---|
| X-WOPI-Override | string | Required | Requested operation from the WOPI server (PUT). |
| X-WOPI-Lock | string | Optional | Lock ID that identifies the lock on the file. |
Request body
The request body must be the complete binary contents of the file.
Response headers
| Name | Type | Required | Description |
|---|---|---|---|
| X-WOPI-Lock | string | Optional | Lock 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-LockFailureReason | string | Optional | Reason for lock failure. May be included when responding with 409 Conflict (logging only). |
| X-WOPI-ItemVersion | string | Optional | File version. |