Skip to content

Instantly share code, notes, and snippets.

@johnelliott
Forked from dfairaizl/Bash Cloudinary Upload
Created April 25, 2018 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnelliott/1a4a0879813991167bc994fa4a8189e5 to your computer and use it in GitHub Desktop.
Save johnelliott/1a4a0879813991167bc994fa4a8189e5 to your computer and use it in GitHub Desktop.
#! /bin/bash
# This is how to sign a Cloudinary API request from bash
URL="https://api.cloudinary.com/v1_1/thedailybeast/image/upload"
API_KEY=574791189343157
API_SECRET=abcd
DATE=$(date +%s)
SHA=$(echo -n "overwrite=false&timestamp=${DATE}&unique_filename=false&upload_preset=zcjiokbi&use_filename=true${API_SECRET}" | shasum -a 1 | awk '{print $1}')
FILE="http://cdn.thedailybeast.com/content/dam/dailybeast/2017/02/23/170223-Vox-homeopathic-drug-tease.jpg"
http post $URL \
api_key==$API_KEY \
file==$FILE \
overwrite==false \
signature==$SHA \
timestamp==$DATE \
unique_filename==false \
upload_preset==zcjiokbi \
use_filename==true \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment