#!/home/rahul/.rbenv/shims/ruby require 'rest_client' require 'base64' image_data = Base64.encode64(File.open("/home/rahul/Pictures/download.jpg", "rb").read) url = "http://myapiserver.com/api/user_profile/454-Rahul-Chaudhari?auth_token=XXXXXXXXXXXXXXX" data = { user_profile: { picture: { content_type: "image/jpeg", filename: "DSCN436xxx0.JPG", data: image_data}}} header = {content_type: "json", accept: "json", Authorization: "Token token=\"e4be11da6efca91461d4fd8fc5edb175\""} RestClient.put( url, data, header)