Skip to main content

stagedUploadsCreate

Requires at least one of the permissions products:import:stage or products:product:update.

Gives the app a presigned URL to upload one file to. The key it returns is what productImportCreate and productImageAdd accept; URLs are never accepted. Needs the permission of the mutation that will use the file.

Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.

Example:

mutation StagedUploadsCreate($input: StagedUploadInput!) {
stagedUploadsCreate(input: $input) {
contentType
key
maxBytes
purpose
uploadUrl
}
}

Variables:

{
"input": {
"filename": "string",
"purpose": "PRODUCT_IMAGE"
}
}

Response:

{
"data": {
"stagedUploadsCreate": {
"contentType": "string",
"key": "id",
"maxBytes": 0,
"purpose": "PRODUCT_IMAGE",
"uploadUrl": "string"
}
}
}
stagedUploadsCreate(
input: StagedUploadInput!
): StagedUpload!

Arguments​

stagedUploadsCreate.input ● StagedUploadInput! non-null input​

What the file is for, and its name.

Type​

StagedUpload object​

Where to upload one file. PUT the bytes to uploadUrl with the given contentType, then pass key to the mutation that uses it. The file is checked when the key is first used; a file over maxBytes or of another type is deleted and refused.