createUploadLink

Version 2024-04-01

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
  }
}