createUploadLink

Version 2024-11-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.

Response

Return type CreateUploadLinkResponse

Arguments

ArgumentDescription
input (CreateUploadLinkInput required)

Specifies the input fields to create an UploadLink.

Examples


Create Upload Link

Request

mutation {
    createUploadLink(input: {
        fileType: CSV,
        size: 123
    }) {
        payload {
            uploadUrl,
            fileId
        }
    }
}

Response

{
  "data": {
    "createUploadLink": {
      "payload": {
        "uploadUrl": "example.com",
        "fileId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111"
      }
    }
  }
}

Validation Exception

Request

mutation {
    createUploadLink(input: {
        fileType: CSV,
        size: -123
    }) {
        payload {
            uploadUrl,
            fileId
        }
    }
}

Response

{
  "errors": [
    {
      "message": "Input request is not valid, the following issues were encountered: [/createUploadLink/input/size must be greater than or equal to 1]",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "createUploadLink"
      ],
      "extensions": {
        "classification": {
          "type": "ValidationError",
          "code": "UnspecifiedError",
          "details": {},
          "errorType": "ValidationException",
          "errorCode": 400
        }
      }
    }
  ],
  "data": {
    "createUploadLink": null
  }
}