RTC Forums
May 05, 2024, 10:24:44 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Applications (not written in Delphi) uploading files to RTC REST server.  (Read 4013 times)
ClementDoss
RTC License
***
Posts: 36


« on: September 09, 2017, 08:02:46 PM »

Hi,

I will start a new project where my rtcServer will handle REST requests (JSON).
My customer wants to receive registration data (Name, document, address, etc ) and might get also some files (TXT, PDF, JPGs, DOC, XLS, etc ).
Those files can easily get over 10 MBytes. I googled and some say everything should come in a single POST. But I believe it would be better to have a POST for registration data that returns an ID that can be used in a second POST to upload the required files. Anyway, this API will be called from other applications (no browser as far as I know) written in other languages (even SAP). What would be the best to achieve max performance and responsiveness ?
Those files will be part of an analysis. To that end my customer's team will need to download them. In that scenario, would it best to store those files in the File system, or Database BLOB (NexusDB). 

I build several RTC REST application with server and client written in Delphi, but I have no experience writting a rtcServer that will receive files from a POST made from another language. Is there any difference?  Any sample code that might help would be great.

Best regards,
Clément
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: September 10, 2017, 07:17:29 AM »

There should be no differences in the data being sent, regardless of the programming language or platform used, if everyone agrees to use the same protocol and data formats. Web Browsers are also nothing else than HTTP Clients. As long as all Web Browsers follow the HTTP standard, they can communicate with any HTTP Server. And if that HTTP Server provides a service using JSON (or any other data format), it should work the same from Web Browsers as well as any other HTTP-based Client, regardless of the programming language used to write that Client and/or the platform where that Client is running on.

The simplest option when uploading files would be to use HTTP POST, where the raw file content is sent as HTTP content body, but you could also use JSON or XML or any other format to send your files together with any other information required to process it, as long as the format used to encode/decode your content is well defined and you know how to process it. When working with a 3rd-party over HTTP, the only "problem" is to agree on the data format you will be using (raw bytes or JSON or XML or ... whatever).

In a nutshell, if your Server can handle HTTP POST requests containing data in a specific format received from your Delphi applications running on Windows, it should also handle data sent in that same format from any other device running on any other platform and programmed in any language. The only important bit is that the Application sending these requests uses the same protocol (HTTP) and data format (raw bytes or JSON or XML or anything else you agree on).

Best Regards,
Danijel Tkalcec
Logged
Star5
RTC Expired
*
Posts: 27


« Reply #2 on: September 13, 2017, 07:02:22 AM »

Demos\RTC_WebServer        rtcFileProvider,JSON response and file download
QuickStart\BrowserUpload        multipart/form-data,File upload
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.024 seconds with 18 queries.