Jump to content

Search the Community

Showing results for tags 'dropbox'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Delphi Questions and Answers
    • Algorithms, Data Structures and Class Design
    • VCL
    • FMX
    • RTL and Delphi Object Pascal
    • Databases
    • Network, Cloud and Web
    • Windows API
    • Cross-platform
    • Delphi IDE and APIs
    • General Help
    • Delphi Third-Party
  • C++Builder Questions and Answers
    • General Help
  • General Discussions
    • Embarcadero Lounge
    • Tips / Blogs / Tutorials / Videos
    • Job Opportunities / Coder for Hire
    • I made this
  • Software Development
    • Project Planning and -Management
    • Software Testing and Quality Assurance
  • Community
    • Community Management

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Delphi-Version

Found 2 results

  1. I save a JSON file on Dropbox, after reading it I don't get it in the correct UTF-8 state as it left, please advise. I am sending Czech characters {"auth":{"text1":"cz_čřšť","text2":"ýáíé","int":10}} I will get {"auth":{"text1":"cz_èø","text2":"ýáíé","int":10}} POST code procedure TForm2.btn_Upload_JsonClick(Sender: TObject); const API_URL = 'https://content.dropboxapi.com/2/files/upload'; var IdHTTP: TIdHTTP; Res : string; Ssl: TIdSSLIOHandlerSocketOpenSSL; Json : string; Req_Json:TStringStream; begin Json := '{"auth":{"text1":"cz_čřšť","text2":"ýáíé","int":10}}'; Req_Json:=TstringStream.Create(Json); Req_Json.Position:=0; IdHTTP := TIdHTTP.Create(nil); try Memo1.Lines.Clear; IdHTTP.HandleRedirects := True; ssl := TIdSSLIOHandlerSocketOpenSSL.Create(); ssl.SSLOptions.Method := sslvTLSv1_2; ssl.SSLOptions.SSLVersions := [sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2]; ssl.SSLOptions.Mode := TidSSLMode.sslmUnassigned; ssl.SSLOptions.VerifyMode := []; ssl.SSLOptions.VerifyDepth := 0; ssl.host := ''; IdHTTP.IOHandler := ssl; IdHTTP.Request.CustomHeaders.Values['Authorization'] := 'Bearer ' + myAccessToken; IdHTTP.Request.CustomHeaders.Values['Dropbox-API-Arg'] := '{ "autorename": false, "mode": "add", "mute": false, "path": "/CUZK/test3.json", "strict_conflict": false }'; IdHTTP.Request.CustomHeaders.Values['Content-Type'] := 'application/octet-stream'; IdHTTP.Request.CharSet:='utf-8'; Memo1.Lines.Add('** IdHTTP.Request.CustomHeaders.Text **'); Memo1.Lines.Add(IdHTTP.Request.CustomHeaders.Text); Memo1.Lines.Add('** ssl.OnStatusInfoEx **'); ssl.OnStatusInfoEx := IdSSLIOHandlerSocketOpenSSL1StatusInfoEx; (**) Res := IdHTTP.Post(API_URL, Req_Json); memo1.Lines.Add('------------------------------------'); Memo1.Lines.Add(Res); finally IdHTTP.Free; Req_Json.Free; end; GET CODE procedure TForm2.btn_Download_File_Click(Sender: TObject); const API_URL = 'https://content.dropboxapi.com/2/files/download'; var Source: TMemoryStream; IdHTTP: TIdHTTP; Res : string; Ssl: TIdSSLIOHandlerSocketOpenSSL; begin IdHTTP := TIdHTTP.Create(nil); try IdHTTP.HandleRedirects := True; ssl := TIdSSLIOHandlerSocketOpenSSL.Create(); ssl.SSLOptions.Method := sslvTLSv1_2; Ssl.SSLOptions.SSLVersions := [sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2]; ssl.SSLOptions.Mode := TidSSLMode.sslmUnassigned; ssl.SSLOptions.VerifyMode := []; ssl.SSLOptions.VerifyDepth := 0; ssl.host := ''; Source := TMemoryStream.Create; IdHTTP.IOHandler := ssl; IdHTTP.Request.CustomHeaders.Values['Authorization'] := 'Bearer ' + myAccessToken; IdHTTP.Request.CustomHeaders.Values['Dropbox-API-Arg'] := '{ "path": "/CUZK/test3.json" }'; IdHTTP.Request.CharSet := 'utf-8'; Res := ansitoutf8(IdHTTP.Get(API_URL)); memo1.Lines.Add('------------------------------------'); Memo1.Lines.Add(Res); finally IdHTTP.Free; Source.Free; end; end;
  2. I'm having trouble connecting to my DROPBOX account via TidHTTP and I don't know what to do anymore. I want to send a simple text file to DROPBOX in the first stage. procedure TForm2.btn1Click(Sender: TObject); const API_URL = 'https://content.dropboxapi.com/2/files/upload'; cFile = 'D:\testfile.txt'; var wAccessToken : string; Source: TFileStream; IdHTTP: TIdHTTP; Res : string; Ssl: TIdSSLIOHandlerSocketOpenSSL; begin wAccessToken := 'muj_token'; IdHTTP := TIdHTTP.Create(nil); try (* ShowMessage('Indy version: ' + IdHTTP.Version); RESULT MESSAGE : INDY 10.5.9.0 *) IdHTTP.HandleRedirects := True; ssl := TIdSSLIOHandlerSocketOpenSSL.Create(); ssl.SSLOptions.Method := sslvTLSv1_2; ssl.SSLOptions.Mode := sslmUnassigned; ssl.SSLOptions.VerifyMode := []; ssl.SSLOptions.VerifyDepth := 0; ssl.host := ''; Source := TFileStream.Create(cFile, fmOpenRead); IdHTTP.IOHandler := ssl; IdHTTP.Request.CustomHeaders.Values['Authorization'] := 'Bearer ' + wAccessToken; IdHTTP.Request.CustomHeaders.Values['Dropbox-API-Arg'] := '{ "autorename": false,"mode": "add","mute": false,"path": "/test.txt","strict_conflict": false}'; IdHTTP.Request.CustomHeaders.Values['Content-Type'] := 'application/octet-stream'; Memo1.Lines.Add(IdHTTP.Request.CustomHeaders.Text); Res := IdHTTP.Post(API_URL, Source); finally IdHTTP.Free; end; But after the POST command I get the error "error: 1409442E:SSL routines: SSL3_READ_BYTES:tlsv 1 alert protocol" - class EIdOSSLUnderlyingCryptoError with message "Error connectin with SSL" http://imgway.cz/m/hneT.jpg I don't know how to proceed, there is a stupid mistake somewhere. I found similar problems on https://stackoverflow.com/questions/1742900/tidhttp-in-indy-10 , https://stackoverflow.com/questions/7762584/post-problems-with-indy-tidhttp and many other forums. Somewhere it says it may be old INDY (which it is), but DROPBOX's probably has the TLS v1.2 required when TIDHTTP enables it ssl.SSLOptions.Method := sslvTLSv1_2 For the Request track, I stuck to the DROBOX.API structure DROPBOX API DOCUMENTATION https://www.dropbox.com/developers/documentation/http/documentation#files-upload Get access token for: ****************************************************** ************** curl -X POST https://content.dropboxapi.com/2/files/upload \ --header "Authorization: Bearer <get access token>" \ --header "Dropbox-API-Arg: {\"autorename\":false,\"mode\":\"add\",\"mute\":false,\"path\":\"/Homework/ math/Matrices.txt\",\"strict_conflict\":false}" \ --header "Content-Type: application/octet-stream" \ --data-binary @local_file.txt ****************************************************** ************** Even more information: Delphi XE3 Indy 10.5.9.0 with the exe I have the Open SSL files libeay32.dll (v. 1.0.2.17) and ssleay32.dll (v. 1.0.2.17) - but that will not be it. if I throw them away the error is the same DROPBOX requires TLS 1.2 from April On some forums they wrote the same error with old Open SSL files, old INDY, sending via TLS which is not supported by the addressee. But I don't feel either way. I downloaded Open SSL from https://github.com/IndySockets/OpenSSL-Binaries file openssl-1.0.2u-x64_86-win64.zip (I don't know if it's good, there are a bunch of them in the table with differences in the name "r", "s", "t", "u", he chose I'm the last one). Thanks for any advice.
×