mercredi 29 novembre 2017

While trying to use Dropbox for creating a shared link for my file I always get the error

Bad Input: Error in call to API function "sharing/create_shared_link": request body: could not decode input as JSON I have created an App Folder and I can successfully write files to my Dropbox. All attempts on calling the methods in Dropbox.authorizedClient!.sharing generate this error. Does anyone have any idea to why?

 def upload_dropbox_image image
    app_key = ENV['AB_DROPBOX_APP_KEY_DEVELOPMENT']
    secret_key = ENV['AB_DROPBOX_APP_SECRET_DEVELOPMENT']
    p "==app key=======#{app_key}====secret key====#{secret_key}========="  
    client = 
    DropboxClient.new(ENV['AB_DROPBOX_ACCESS_TOKEN_DEVELOPMENT'])
    p "========client====#{client.inspect}=========="
    file = open(params[:contract_upload])
    file_name = params[:contract_upload].original_filename 
    p file_name
    response = client.upload("/#{Time.now.to_i}#{file_name}", file)
    result = HTTParty.post("http://ift.tt/1IGWLl2", 
:body => { :path => file.path.display  }.to_json,
:headers => { 'Authorization'=>"Bearer YB604dS5bCAAAAAAAAAACRFCvXAWXUm1lJ0bTKBO7GtnC5B_2HtXywlw2dmAXyDN",'Content-Type' => 'application/json'  } )
end

Aucun commentaire:

Enregistrer un commentaire