The following examples demonstrate standard command-line interactions with the storage REST API.
Listing files
Section titled “Listing files”Retrieve the first 10 files matching a search query:
curl -s -H "Authorization: Bearer mmwc_0123456789abcdef_secretkeyhere" \ "https://api.mmwcloud.tech/v1/files?limit=10&search=report"Checking storage quota
Section titled “Checking storage quota”Query quota utilization for the active account:
curl -s -H "Authorization: Bearer mmwc_0123456789abcdef_secretkeyhere" \ https://api.mmwcloud.tech/v1/quotaUploading a small file
Section titled “Uploading a small file”Uploading a single file under 8 MiB requires three steps:
1. Request an upload ticket
Section titled “1. Request an upload ticket”SIZE=$(stat -c %s document.pdf)SHA=$(sha256sum document.pdf | cut -d" " -f1)
curl -s -X POST https://api.mmwcloud.tech/v1/files/upload-ticket \ -H "Authorization: Bearer mmwc_0123456789abcdef_secretkeyhere" \ -H "Content-Type: application/json" \ -d "{\"name\": \"document.pdf\", \"size_bytes\": $SIZE, \"sha256\": \"$SHA\"}"2. Upload binary payload to upload_url
Section titled “2. Upload binary payload to upload_url”curl -s -X PUT "https://storage.mmwcloud.tech/v1/upload/file_01h8upload123?capability=token" \ -H "Content-Type: application/octet-stream" \ --data-binary @document.pdf3. Complete the transfer
Section titled “3. Complete the transfer”curl -s -X POST https://api.mmwcloud.tech/v1/files/complete \ -H "Authorization: Bearer mmwc_0123456789abcdef_secretkeyhere" \ -H "Content-Type: application/json" \ -d '{"id": "file_01h8upload123"}'4. Inspect file processing status
Section titled “4. Inspect file processing status”curl -s -H "Authorization: Bearer mmwc_0123456789abcdef_secretkeyhere" \ https://api.mmwcloud.tech/v1/files/file_01h8upload123Downloading a file
Section titled “Downloading a file”1. Request a temporary signed link
Section titled “1. Request a temporary signed link”curl -s -H "Authorization: Bearer mmwc_0123456789abcdef_secretkeyhere" \ https://api.mmwcloud.tech/v1/files/file_01h8upload123/download2. Download file contents
Section titled “2. Download file contents”curl -s -o document.pdf \ "https://storage.mmwcloud.tech/v1/download/file_01h8upload123?capability=token"Deleting a file
Section titled “Deleting a file”Perform soft deletion of a stored object:
curl -s -X DELETE https://api.mmwcloud.tech/v1/files/file_01h8upload123 \ -H "Authorization: Bearer mmwc_0123456789abcdef_secretkeyhere"