RTI_Util_Dropbox function
Description
The RTI_UTIL_DROPBOX utility provides a way to programmatically copy, move, rename, download, or delete a dropbox file.
RTI_UTIL_DROPBOX requires that a configuration record (CFG_DROPBOX) be created in the SYSENV table; this record may be global (CFG_DROPBOX), or application specific (CFG_DROPBOX*<appid>), or user-specific (CFG_DROPBOX**<userid>), or application and user specific (CFG_DROPBOX*<appid>*<userid>). The contents of the record must be:
1. The URL to the dropbox API you wish to use to create a temporary upload link - for example, https://api.dropboxapi.com/2/files/get_temporary_upload_link 2. Your unique "authorization key" generated for your dropbox account - you must request this key from dropbox if you wish to use their API 3. (optional) The duration a temporary link will remain valid (leave empty to use the default) 4. (optional) The folder and/or file name to upload to 5. (optional) The comma-delimited list of file extensions that are allowed to be uploaded. Note that this is a list of just the 3-4 character extensions, in lower case, without any leading "." or other characters. For example: jpg,jpeg,png
For more information on getting your dropbox authorization key, see https://www.dropbox.com/developers/reference/getting-started
Syntax
RTI_UTIL_DROPBOX(action, param1, param2, param3, param4, response)
Parameters
The function has the following parameters:
Parameter | Description |
---|---|
action | Where action is one of the following: MOVE, RENAME, COPY, DOWNLOAD, DOWNLOAD_ZIP, UPLOAD,UPLOAD_DIRECT, UPLOAD_FILE, DELETE, UPLOAD_LINK, SHARE_LINK For each action, the parameters are as follows (NOTE: for any path and file name parameters, if the configuration record field #4 is non-null, and the parameter does not start with a "/", then the parameter will be prefixed with the configuration record information. Also note that any "#" in any file name parameters will be replaced with the current DATE():TIME():"_" string. The changed parameter's value will be returned in the same parameter): MOVE: Move a file from one dropbox folder to another param1: The source path and file name on Dropbox param2: The destination path and file name on Dropbox RENAME: Change the name of a dropbox file (note that you must still specify full paths for the original and new file name) param1: The source path and file name on Dropbox param2: The new path and file name on Dropbox COPY: Duplicate the source dropbox file to the destination dropbox folder and name param1: The source path and file name on Dropbox param2: The new path and file name to create on Dropbox DOWNLOAD: Download the content of the specified dropbox file to your local workstation param1: The source path and file name on Dropbox param2: (Optional) The file path and name on your location workstation where the data should be written. If not specified, the data is returned as the function result DOWNLOAD_ZIP: Download the entire contents of the specified dropbox folder as a zip file to your local workstation param1: The source path on Dropbox. Note that this is a PATH ONLY and should NOT specify an individual file param2: (Optional) The file path and name on your location workstation where the zip file data should be written. If not specified, the data is returned as the function result UPLOAD: Upload the specified file or value to a dropbox file param1: The destination path and file name on Dropbox param2: The explicit content to upload, or the name of the operating system file on the Workstation param3: "F" if param2 is a path and filename that contains plain-text data; "FB" if param2 is a path and filename that contains binary data; "b" if param2 is the literal binary data to upload; "" if param2 is the literal plain-text data to upload param4: "1" if any existing Dropbox file with the same name should be overwritten; "0" or null if overwrite is forbidden UPLOAD_DIRECT: Upload the specified value to a dropbox file param1: The destination path and file name on Dropbox param2: The explicit content to upload param3: "1" if param2 is binary data to upload; "" or "0" if param2 is the plain-text data to upload param4: "1" if any existing Dropbox file with the same name should be overwritten; "0" or null if overwrite is forbidden UPLOAD_FILE: Upload the specified file to a dropbox file param1: The destination path and file name on Dropbox param2: The name of the operating system file on the Workstation param3: "1" if the file specified in param2 contains binary data; "" or "0" if param2 specifies a file with plain-text data param4: "1" if any existing Dropbox file with the same name should be overwritten; "0" or null if overwrite is forbidden DELETE: Delete the named dropbox file from the specified location param1: The path and file name on Dropbox to delete UPLOAD_LINK: Generate a temporary upload link to use for uploading a file to a specific location on DropBox param1: The path and file name on Dropbox where the file should be uploaded to SHARE_LINK: Generate a 'shared link' to allow others to view a Dropbox file or folder param1: The path (and optionally file name) on Dropbox that you wish to share via link param2: The settings for the share. Field 1 is an @VM delimited array of setting names (including requested_visibility, audience, and/or access); Field 2 is the associated @VM delimited array of setting values |
Returns
This function will normally return "OK" if the processing completed successfully, and "ERROR" (possibly followed by additional error information in field 2) if there were any errors during processing. In certain circumstances (for example, DOWNLOAD and DOWNLOAD_ZIP actions), the return result may be the file contents themselves or "ERROR"; for the UPLOAD_LINK and SHARE_LINK actions, the return result will be the URL or "ERROR".
In all cases, the response parameter (if present) will be filled in with the response to the call from Dropbox.
Remarks
OpenInsight 10.0.8 and later