Skip to content

Instantly share code, notes, and snippets.

@kristjan
Created September 19, 2012 22:42
Show Gist options
  • Save kristjan/3752806 to your computer and use it in GitHub Desktop.
Save kristjan/3752806 to your computer and use it in GitHub Desktop.
Uploading a Photo to Singly
require 'rubygems'
require 'rest_client'
TOKEN = ENV['TOKEN']
PHOTO_ENDPOINT = 'https://api.singly.com/types/photos'
PHOTO_PATH = ARGV[0]
puts "Uploading #{PHOTO_PATH}"
puts RestClient.post(PHOTO_ENDPOINT, {
:access_token => TOKEN,
:services => 'facebook,twitter',
:photo => File.new(PHOTO_PATH)
})
puts "Done"
curl https://api.singly.com/types/photos -F services=facebook,twitter-F access_token=$TOKEN -F body='Cat' -F photo=@/path/to/kitten.jpg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment