Logoreact-native-s3-bg-uploader

Backend endpoints

Endpoints your backend must implement for the library to work

For each file, the library calls the endpoints below. Configure the endpoints to use by calling setConfig via the API reference.

startUpload

POST{startUploadApi}/

Initiates a multipart upload for a single file.

Request Body (JSON)

{
  "fileName": "video.mp4",
  "fileHash": "a1b2c3d4e5f6...",
  "fileSize": 104857600,
  ...userParams
}
FieldTypeDescription
fileNamestringOriginal file name
fileHashstringxxHash of the file
fileSizenumberFile size in bytes
...userParamsobjectAny additional params you passed via uploadFile, merged flat into the body

Response (JSON)

{
  "key": "uploads/abc123/video.mp4",
  "uploadId": "VXBsb2FkSWQ...",
  "partSize": 10485760
}
FieldTypeDescription
keystringObject key to use for all subsequent calls
uploadIdstringUpload ID for this file
partSizenumberPart size the uploader should use

getUploadUrls

POST{getUploadUrlsApi}/

Returns presigned S3 URLs for a set of parts.

Request Body (JSON)

{
  "key": "uploads/abc123/video.mp4",
  "uploadId": "VXBsb2FkSWQ...",
  "parts": [1, 2, 3, 4]
}
FieldTypeDescription
keystringS3 object key from startUpload
uploadIdstringMultipart upload ID from startUpload
partsnumber[]Part numbers to get URLs for

Response (JSON)

{
  "urls": {
    "1": "https://bucket.s3.amazonaws.com/...?partNumber=1&...",
    "2": "https://bucket.s3.amazonaws.com/...?partNumber=2&...",
    "3": "...",
    "4": "..."
  }
}
FieldTypeDescription
urlsRecord<string, string>Map of part number → presigned URL

upload

PUT{uploadUrl}/

Request Body contains the file part

Response Must provide an Etag header that identifies the uploaded part. This E-Tag will be re-provided by the library to the complete endpoint.

complete

POST{completeApi}/{uploadId}/{key}

Finalizes the multipart upload after all parts have been uploaded.

Request Body (JSON)

{
  "parts": [
    { "PartNumber": 1, "ETag": "abc123..." },
    { "PartNumber": 2, "ETag": "def456..." }
  ]
}
FieldTypeDescription
partsPart[]List of completed parts, sorted by PartNumber
parts[].PartNumbernumberPart number
parts[].ETagstringETag returned by PUT upload response Etag header for that part

Response

The response body is ignored. The library only expects an HTTP 2xx status code.

On this page