Skip to content
EN RU

cURL examples

The following examples demonstrate standard command-line interactions with the storage REST API.

Retrieve the first 10 files matching a search query:

Terminal window
curl -s -H "Authorization: Bearer mmwc_0123456789abcdef_secretkeyhere" \
"https://api.mmwcloud.tech/v1/files?limit=10&search=report"

Query quota utilization for the active account:

Terminal window
curl -s -H "Authorization: Bearer mmwc_0123456789abcdef_secretkeyhere" \
https://api.mmwcloud.tech/v1/quota

Uploading a single file under 8 MiB requires three steps:

Terminal window
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\"}"
Terminal window
curl -s -X PUT "https://storage.mmwcloud.tech/v1/upload/file_01h8upload123?capability=token" \
-H "Content-Type: application/octet-stream" \
--data-binary @document.pdf
Terminal window
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"}'
Terminal window
curl -s -H "Authorization: Bearer mmwc_0123456789abcdef_secretkeyhere" \
https://api.mmwcloud.tech/v1/files/file_01h8upload123
Terminal window
curl -s -H "Authorization: Bearer mmwc_0123456789abcdef_secretkeyhere" \
https://api.mmwcloud.tech/v1/files/file_01h8upload123/download
Terminal window
curl -s -o document.pdf \
"https://storage.mmwcloud.tech/v1/download/file_01h8upload123?capability=token"

Perform soft deletion of a stored object:

Terminal window
curl -s -X DELETE https://api.mmwcloud.tech/v1/files/file_01h8upload123 \
-H "Authorization: Bearer mmwc_0123456789abcdef_secretkeyhere"