downloadLink

Version 2024-04-01

Overview

Get a temporary URL for downloading a file. Use this URL to download files using file ids returned by other Buy with Prime operations, like the catalogFeed query.

ℹ️

Required scope(s)

View product media and csv files

Response

Return type DownloadLink

Arguments

ArgumentDescription
fileId (String required)

The id of the file to download.

The size should be greater than or equal to 0 and less than or equal to 36.

Examples


Get Download Link

Request

query {
    downloadLink(fileId: "66d8bef0-726e-4c17-a8f1-87640116e9b2") {
        downloadUrl
    }
}

Response

{
  "data": {
    "downloadLink": {
      "downloadUrl": "https://sps-long-lived-prod-us-east-1-191632677283.s3.amazonaws.com/f5411b1a-9ab4-4ce5-ab0c-fea8ce13ef4c/media/66d8bef0-726e-4c17-a8f1-87640116e9b2.csv?response-content-disposition=attachment%3B%20filename%3D%2266d8bef0-726e-4c17-a8f1-87640116e9b2.csv%22&X-Amz-Security-Token=redacted&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20230823T010153Z&X-Amz-SignedHeaders=host&X-Amz-Expires=5&X-Amz-Credential=ASIASZHRSTGRYLDXMP52%2F20230823%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=513fe19c5962cb473114e6b78eea574ce8287b7d116b7fb11b9b8efe95845610"
    }
  }
}

Validation Exception

Request

query {
    downloadLink(fileId: " invalid id ") {
        downloadUrl
    }
}

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": [
        "downloadLink"
      ],
      "extensions": {
        "classification": {
          "errorType": "ValidationException",
          "errorCode": 400
        }
      }
    }
  ],
  "data": null
}