Official Plugins (Kuzzle v2.x)
S3 v3.x
2

getUrl #

Returns a Presigned URL to upload directly to S3.
The URL expires after a configurable TTL. (Configurable in the kuzzlerc file)


Query Syntax #

HTTP #

URL: http://kuzzle:7512/upload/get-url/<bucketRegion>/<bucketName>/<filename>?uploadDir=<uploadDir>&publicUrl=false
Method: GET

Other protocols #

{
  "controller": "s3/upload",
  "action": "getUploadUrl",
  "bucketName": "bucket-name"
  "bucketRegion": "bucket-region"
  "filename": "headcrab.png", 
  "uploadDir": "xen",
  "publicUrl" : false
}

Arguments #

  • filename: Uploaded file name
  • uploadDir: Upload directory (see s3 file key)
  • bucketName : Name of the bucket
  • bucketRegion : Region of the bucket
  • publicUrl (optionnal): boolean indicating that plugin should return public URL

Response #

Returns an object with the following properties:

  • fileKey: file key in S3 bucket
  • uploadUrl: presigned upload URL
  • ttl: TTL in ms for the URL validity and before the uploaded file deletion
{
  "status": 200,
  "error": null,
  "controller": "s3/upload",
  "action": "getUploadUrl",
  "requestId": "<unique request identifier>",
  "result": {
    "fileKey": "xen/<uuid>-headcrab.png", 
    "uploadUrl": "https://s3.eu-west-3.amazonaws.com/...", 
    "ttl": 1200000 
  }
}

Possible errors #