File transfers
File transfer is implemented in the same way as for EDM SOAP WS:
-
- To send file input to some query, first create an empty temporary file on the web server, then upload some contents into that file, and finally pass the name of that file name as a parameter to the query (files are scoped to a single session only, and are deleted when a session is closed or expired, but it is also possible to explicitly delete a single temporary file).
-
- To get file output from some query, first create an empty temporary file on the web server, then invoke the query and pass that file name as a parameter. After completion of the query download the contents from that temporary file (files are scoped to single session only, and are deleted when session is closed or expired, but it is also possible to explicitly delete a single temporary file).
(Future releases should allow sending/receiving files directly - as part of multipart HTTP request/response for REST Query invocation method)
To create a temporary file (set 'UPLOAD' to 'TRUE' if the file shall be sent into the query; 'FILENAME'
and 'FILETYPE' are optional – default to 'temp' and '.txt' correspondingly):
AccessControl/ createTemporaryFile?EDMSESSIONID=&FILENAME=&FILETYPE=&UPLOAD=
Or
AccessControl/ createTemporaryFile?
EDMSESSIONID=&jsonstring={"FILENAME":"","FILETYPE":"","UPLOAD":""}
After successful creation, the following JSON object is returned:
{
"uploadOrDownloadUrl":"", "progressInfoUrl":"", "fileNameOnServer":"", "operation":""
}
"fileNameOnServer" value should be used as a parameter to query or to delete the file. "uploadOrDownloadUrl" should be used as HTTP URL to download file returned from the query or to upload a file that shall be sent into a query (NOTE: before using this URL, session ID should be added to the end of the URL string – it will serve as a value for 'sessionId=' parameter, which is located at the end of this URL string).
*_+To delete temporary file:+_*
AccessControl/ deleteTemporaryFile?EDMSESSIONID=& fileNameOnServer=
Or
AccessControl/ deleteTemporaryFile?EDMSESSIONID=&jsonstring={"fileNameOnServer":""}
NOTE: To upload or download a file perform HTTP POST (important – in current version even downloading of file should be done via POST method) to the URL provided by 'uploadOrDownloadUrl' (with added session ID to the end of URL); these operations are performed by a separate 'HttpFileTransfer' servlet.