Skip Navigation

METHOD_PC_FileDownload

This method downloads a file from a group discussion. Before users can download a file from a group discussion, users must join the the group discussion. This method requires 
BEMS
 2.8 or later.
The following features are not supported:  
  • Resumable downloads
For code sample information on how to download files from a group discussion, visit msdn.microsoft.com to read 
How to: Upload and download files to and from a Persistent Chat room
The following table describes the parameters that you can include in this method. 
Parameter
Type
Required
Description
roomId
String
This parameter specifies the group discussion ID from which to download the file.
fileName
String
This parameter specifies the name of the file to download from the group discussion.
Group discussion messages can include one or more embedded file links and use the following format: {{file:
file-name
:
file-path
:
file-size
}}
fileRequestId
String
This parameter specifies the ID of the file to download. The fileRequestID parameter allows the API call to correlate the request and response notifications. All notifications related to the file download request include this parameter.
percentDone
Number
This parameter provides the percentage of the file that is downloaded to 
BEMS
.

Code sample 

The following example sends a request to 
BEMS
 to download a file from a group discussion.
REST call URL:https://SERVER:8080/GaslampService/file/pc/ROOM-ID/FILE-NAME?fileRequestId=FILE-REQUEST-ID Verb:PUT HEADERS: Cookie:sessionId=... Accept:application/json X-User-Agent:<
iOS or Android
>
If the request is successful, 
BEMS
 returns the following response. The response body is the file contents.
HTTP/1.1 200 OK
BEMS
 sends the following notifications to the 
BlackBerry Connect
 app to download the file. The file download states are Processing > Progress > Complete. The download includes a percentage of the file download that has completed.  
{ "id":"c5", "error":null, "result": { State: PROGRESS "data": { "method":"pc.FileDownload", "fileName":"Latest instructions", "roomId":"ma-chan://gems.example.com/25ac15e7-9bff-4e78-9261-6e08aa43231e", "percentDone":"75" } }, "jsonrpc":"2.0" }