Skip to content

Instantly share code, notes, and snippets.

@dfairaizl
Created March 9, 2017 22:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dfairaizl/d4be33e2e0241ffdbab791d7296882f3 to your computer and use it in GitHub Desktop.
Save dfairaizl/d4be33e2e0241ffdbab791d7296882f3 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