{ "opencollection": "1.0.0", "info": { "name": "Discourse API Documentation Admin Uploads API", "version": "latest" }, "items": [ { "info": { "name": "Uploads", "type": "folder" }, "items": [ { "info": { "name": "Creates an upload", "type": "http" }, "http": { "method": "POST", "url": "https://{defaultHost}/uploads.json", "body": { "type": "multipart-form", "data": [ { "name": "type", "type": "text", "value": "" }, { "name": "user_id", "type": "text", "value": "" }, { "name": "synchronous", "type": "text", "value": "" }, { "name": "file", "type": "text", "value": "" } ] } }, "docs": "Creates an upload" }, { "info": { "name": "Initiates a direct external upload", "type": "http" }, "http": { "method": "POST", "url": "https://{defaultHost}/uploads/generate-presigned-put.json", "body": { "type": "json", "data": "{}" } }, "docs": "Direct external uploads bypass the usual method of creating uploads\nvia the POST /uploads route, and upload directly to an external provider,\nwhich by default is S3. This route begins the process, and will return\na unique identifier for the external upload as well as a presigned URL\nwhich is where the file binary blob should be uploaded to.\n\nOnce the upload is complete to the external service, you must call the\nPOST /complete-external-upload route using the unique identifier returned\nby this rou" }, { "info": { "name": "Completes a direct external upload", "type": "http" }, "http": { "method": "POST", "url": "https://{defaultHost}/uploads/complete-external-upload.json", "body": { "type": "json", "data": "{}" } }, "docs": "Completes an external upload initialized with /get-presigned-put. The\nfile will be moved from its temporary location in external storage to\na final destination in the S3 bucket. An Upload record will also be\ncreated in the database in most cases.\n\nIf a sha1-checksum was provided in the initial request it will also\nbe compared with the uploaded file in storage to make sure the same\nfile was uploaded. The file size will be compared for the same reason.\n\nYou must have the correct permissions and CO" }, { "info": { "name": "Creates a multipart external upload", "type": "http" }, "http": { "method": "POST", "url": "https://{defaultHost}/uploads/create-multipart.json", "body": { "type": "json", "data": "{}" } }, "docs": "Creates a multipart upload in the external storage provider, storing\na temporary reference to the external upload similar to /get-presigned-put.\n\nYou must have the correct permissions and CORS settings configured in your\nexternal provider. We support AWS S3 as the default. See:\n\nhttps://meta.discourse.org/t/-/210469#s3-multipart-direct-uploads-4.\n\nAn external file store must be set up and `enable_direct_s3_uploads` must\nbe set to true for this endpoint to function.\n\n" }, { "info": { "name": "Generates batches of presigned URLs for multipart parts", "type": "http" }, "http": { "method": "POST", "url": "https://{defaultHost}/uploads/batch-presign-multipart-parts.json", "body": { "type": "json", "data": "{}" } }, "docs": "Multipart uploads are uploaded in chunks or parts to individual presigned\nURLs, similar to the one generated by /generate-presigned-put. The part\nnumbers provided must be between 1 and 10000. The total number of parts\nwill depend on the chunk size in bytes that you intend to use to upload\neach chunk. For example a 12MB file may have 2 5MB chunks and a final\n2MB chunk, for part numbers 1, 2, and 3.\n\nThis endpoint will return a presigned URL for each part number provided,\nwhich you can then use to" }, { "info": { "name": "Abort multipart upload", "type": "http" }, "http": { "method": "POST", "url": "https://{defaultHost}/uploads/abort-multipart.json", "body": { "type": "json", "data": "{}" } }, "docs": "This endpoint aborts the multipart upload initiated with /create-multipart.\nThis should be used when cancelling the upload. It does not matter if parts\nwere already uploaded into the external storage provider.\n\nYou must have the correct permissions and CORS settings configured in your\nexternal provider. We support AWS S3 as the default. See:\n\nhttps://meta.discourse.org/t/-/210469#s3-multipart-direct-uploads-4.\n\nAn external file store must be set up and `enable_direct_s3_uploads` must\nbe set to t" }, { "info": { "name": "Complete multipart upload", "type": "http" }, "http": { "method": "POST", "url": "https://{defaultHost}/uploads/complete-multipart.json", "body": { "type": "json", "data": "{}" } }, "docs": "Completes the multipart upload in the external store, and copies the\nfile from its temporary location to its final location in the store.\nAll of the parts must have been uploaded to the external storage provider.\nAn Upload record will be completed in most cases once the file is copied\nto its final location.\n\nYou must have the correct permissions and CORS settings configured in your\nexternal provider. We support AWS S3 as the default. See:\n\nhttps://meta.discourse.org/t/-/210469#s3-multipart-direc" } ] } ], "bundled": true }