Jump to content

Search the Community

Showing results for tags 'tsslhttprest'.



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 1 result

  1. How to send files to an API using TSslHttpRest? In Postman I can, this is the http code: POST /api/br-invoice-integration/v1/batches HTTP/1.1 Host: qed.onvio.com.br Accept: application/json Authorization: Bearer 42dc0b99-2d17-4898-9c85-0b52ae364c63Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW ----WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="file[]"; filename="/C:/MyFile.xml" Content-Type: text/xml (data) ----WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="query" {"boxe/File":true} ----WebKitFormBoundary7MA4YWxkTrZu0gW With SslHttpRest, I'm trying to SendStream, like that (similar to the sample OverbyteIcsHttpPost1): FileName := 'C:\MyFile.xml'; RandBoundary := '-----------------------------' + IntToHex(Random(MaxInt), 8) + IntToHex(Random(MaxInt), 8); SslHttpRest1.ContentTypePost := 'multipart/form-data; boundary=' + RandBoundary; Header := RandBoundary + #13#10 + 'Content-Disposition: form-data; name="file[]"; filename="' + 'MyFile.xml' + '"' + #13#10 + 'Content-Type: text/xml' + #13#10 + #13#10; Footer := RandBoundary + #13#10 + 'Content-Disposition: form-data; name="query"' + #13#10 + #13#10 + '{"boxe/File":true}' + #13#10 + RandBoundary + #13#10; SslHttpRest1.SendStream := TMultiPartFileReader.Create(Filename, Header, Footer); SslHttpRest1.SendStream.Position := 0; SslHttpRest1.RestRequest(httpPOST, Myurl); But it doesn't work, just get error: Request completed: 500 Request done, StatusCode #500 {"error":{"code":500,"errors":[],"message":"HTTP 400 Bad Request"}} Has anyone ever needed to do something similar, would this be the way? If anyone can help, I appreciate it.
×