put

Overview

The upload.put endpoint is used for performing resumable uploads that allow for better fault tolerance on poor network connections or with larger files.
You must first create your upload using the resumable strategy defined in the upload.post endpoint.
Resumable uploads can be difficult to get right. It's recommend to use one of the client libraries rather than the REST API directly, as these will perform resumable uploads for you automatically.

Resuming an interrupted upload

If an upload request is terminated before receiving a response, or if you receive a 503 or 500 Service Unavailable response, then you need to resume the interrupted upload. To resume an interrupted upload:
    1.
    To request the upload status, create an empty PUT request to the resumable session URI.
    2.
    Add a Content-Range header indicating that the current position in the file is unknown. For example, set the Content-Range to */2000000 if your total file length is 2,000,000 bytes. If you don't know the full size of the file, set the Content-Range to */*.
    3.
    Send the request.
    4.
    Process the response.
    A 200 OK or 201 Created response indicates that the upload was completed, and no further action is necessary. A 308 Resume Incomplete response indicates that you need to continue uploading the file.
    5.
    If you received a 308 Resume Incomplete response, process the response's Range header, which specifies which bytes Cloud Storage has received so far. You will use this number in the next step. The response does not have a Range header if Cloud Storage has not yet received any bytes. For example, a Range header of bytes=0-42 indicates that the first 43 bytes of the file have been received.
    6.
    Now that you know where to resume the upload, continue uploading the file, either by sending the remaining data or by sending the next chunk. Include a Content-Range header indicating which portion of the file you are sending. For example, Content-Range: bytes 43-1999999/2000000 indicates that you are sending bytes 43 through 1,999,999.

HTTP Request

1
PUT /api/v1/tables/:tableReference/uploads/:uploadId
Copied!
This endpoint extends the general API structure

Path parameters

Parameter
tableReference
A qualified reference to the table. See referencing resources for more information.
uploadId
The unique identifier for the upload.

Request headers

Header
Description
Content-Range
Set to show which bytes in the file you are uploading.
For example, Content-Range: bytes 0-524287/2000000 shows that you are uploading the first 524,288 bytes (256 x 1024 x 2) in a 2,000,000 byte file.
If the total file size isn't known beforehand (for example, during streaming uploads that might perform processing on the stream), you can specify an unknown total size as: Content-Range: bytes 0-524287/*
If you are resuming an interrupted upload and want to know its progress, set the left part of the range to a * to signal that it is unknown. E.g., Content-Range: bytes */2000000

Request body

You should provide the current chunk content in the request body.

Authorization

Edit access to the dataset is required. Your access token must have the following scope:
    data.edit
The request body contains a JSON representation of an upload resource.

Response body

If successful, returns a status code 200 with an empty response body.

Examples

Last modified 1yr ago