printDocument: uploadData

Namespace: microsoft.graph

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.

Upload a single binary segment of the printDocument.

You can upload the entire file, or split the file into multiple byte ranges, as long as no request is larger than 1 MB.

The segments of the file can be uploaded in any order and can be uploaded in parallel, with up to four concurrent requests. When all the binary segments of document are uploaded, the binary file is linked to the printJob.

Permissions

One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.

In addition to the following permissions, the user or app's tenant must have an active Universal Print subscription and have a permission that grants Get printer access.

Permission type Permissions (from least to most privileged)
Delegated (work or school account) PrintJob.ReadWrite, PrintJob.ReadWrite.All
Delegated (personal Microsoft account) Not Supported.
Application Not Supported. 

HTTP request

POST /print/printers/{id}/jobs/{id}/documents/{id}/uploadData

Request headers

Name Description
Authorization Bearer {token}. Required.
Range bytes={startByteIndex}-{endByteIndex}‬
Content-Length {contentLength}‬
Content-type application/json. Required.

Request body

The request body is a binary blob containing the bytes of the document that are specified as an inclusive byte range in the Range header.

Response

If successful, this method returns one of the following responses. It does not return anything in the response body.

Condition Response code
One or more binary segments still need to be uploaded 202 Accepted
All binary segments have been uploaded successfully 201 Created

Example

The following example shows how to call this API to upload the first 72797 bytes of a document.

Request
POST https://graph.microsoft.com/beta/print/printers/{id}/jobs/{id}/documents/{id}/uploadData
Range: bytes=0-72796
Content-Length: 72797
Response

One or more segments missing:

HTTP/1.1 202 Accepted

All segments received:

HTTP/1.1 201 Created