How to use curl with minio - cniackz/public GitHub Wiki

Objective:

How to use curl with MinIO

Links from where we got it:

PUT:

cd /Users/cniackz/Desktop
bucket=testing
file=arbol.jpg
host=play.min.io
s3_key='Q3AM3UQ867SPQQA43P2F'
s3_secret='zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG'
resource="/testing/arbol.jpg"
content_type="application/octet-stream"
date=`date -R`
_signature="PUT\n\n${content_type}\n${date}\n${resource}"
signature=`echo -en ${_signature} | openssl sha1 -hmac ${s3_secret} -binary | base64`
curl -v -X PUT -T "${file}" \
          -H "Host: $host" \
          -H "Date: ${date}" \
          -H "Content-Type: ${content_type}" \
          -H "Authorization: AWS ${s3_key}:${signature}" \
          https://$host${resource}

GET:

cd /Users/cniackz/Desktop/temporalnewdiretory
bucket=testing
file=arbol.jpg
host=play.min.io
s3_key='Q3AM3UQ867SPQQA43P2F'
s3_secret='zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG'
resource="/testing/arbol.jpg"
content_type="application/octet-stream"
date=`date -R`
_signature="GET\n\n${content_type}\n${date}\n${resource}"
signature=`echo -en ${_signature} | openssl sha1 -hmac ${s3_secret} -binary | base64`
curl -o ./arbol-2.jpg -v \
          -H "Host: $host" \
          -H "Date: ${date}" \
          -H "Content-Type: ${content_type}" \
          -H "Authorization: AWS ${s3_key}:${signature}" \
          https://$host${resource}


Cesars-MacBook-Pro:temporalnewdiretory cniackz$ ls
arbol-2.jpg
Cesars-MacBook-Pro:temporalnewdiretory cniackz$ open .