createUploadLink
Version 2024-01-01
Important
The Buy with Prime API is offered as a preview and might change as we receive feedback and iterate on the interfaces. We are sharing this early documentation to help you learn about the Buy with Prime API as we write and iterate on the content.
Overview
Get a temporary upload URL for uploading a file. Once the file is uploaded, the fileId can be passed to other Buy with Prime APIs to further process the uploaded file. This is a temporary file store. The uploaded file will expire and be deleted after 30 days.
Required scope(s)
View product media and csv files
Response
Return type UploadLink
Arguments
Argument | Description |
---|---|
input (UploadLinkInput required) | Specifies the input fields to create an UploadLink. |
Examples
Create Upload Link
Request
mutation {
createUploadLink(input: {
fileExtension: CSV,
size: 123
}) {
uploadUrl,
fileId
}
}
Response
{
"data": {
"createUploadLink": {
"uploadUrl": "https://sps-long-lived-prod-us-east-1-191632677283.s3.amazonaws.com/f5411b1a-9ab4-4ce5-ab0c-fea8ce13ef4c/media/66d8bef0-726e-4c17-a8f1-87640116e9b2.csv?X-Amz-Security-Token=redacted&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20230823T004847Z&X-Amz-SignedHeaders=content-length%3Bcontent-type%3Bhost&X-Amz-Expires=120&X-Amz-Credential=ASIASZHRSTGRVQQCIKPA%2F20230823%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=8fb0d44751f3f45faae8dac295e59b4240e57db75d71f9aaf09abb8a640dd9b5",
"fileId": "66d8bef0-726e-4c17-a8f1-87640116e9b2"
}
}
}
Validation Exception
Request
mutation {
createUploadLink(input: {
fileExtension: CSV,
size: -123 # negative size is invalid
}) {
uploadUrl,
fileId
}
}
Response
{
"errors": [
{
"message": "Input request is not valid. Retrying the same request is not likely to succeed. An example could be query or argument value is not correct or valid.",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"createUploadLink"
],
"extensions": {
"classification": {
"errorType": "ValidationException",
"errorCode": 400
}
}
}
],
"data": null
}
Updated 3 days ago