GetFile

Online icon iOS and Android Desktop

The GetFile operation retrieves a file from a host.

GET /wopi/files/(file_id)/contents

The GetFile operation retrieves a file from a host.

Tip

By default, Office for the web uses the GetFile WOPI request to retrieve files from the host. However, hosts can override this behavior by providing a direct URL to the file using the FileUrl property in the CheckFileInfo response.

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 uses to determine whether the request is authorized.

Request headers

  • X-WOPI-MaxExpectedSize – An integer specifying the upper bound of the expected size of the file being requested. Optional. The host should use the maximum value of a 4-byte integer if this value isn't set in the request. If the file requested is larger than this value, the host must respond with a 412 Precondition Failed.

Response headers

  • X-WOPI-ItemVersion – An optional string value indicating the version of the file. Its value should be the same as Version value in CheckFileInfo.

Response body

The response body must be the full binary contents of the file.

Status codes

In addition to the request and response headers listed here, this operation might also use the Standard WOPI request and response headers. For more information see Standard WOPI request and response headers.