METHOD_SendFile
This method sends a file to the recipient in a one-to-one chat.
The following table lists the parameters that you can include in this method.
Parameter | Type | Required | Description |
---|---|---|---|
contactId | String | √ | This parameter specifies the ID of the contact that sends the file. Note : For the first message, BEMS generates a StartChat method to invite the contact to accept or decline a chat. For more information, see METHOD_StartChat. |
fileName | String | √ | This parameter specifies the name of the file to send. |
fileSize | Long | √ | This parameter specifies the size of the file to send. |
dependencies | String | — | This parameter specifies the other methods that this method is dependent on. It specifies the comma delimited dependent request IDs. |
percentDone | Number | √ | This parameter provides the percentage of the file that is downloaded to BEMS . |
BEMS response and notification
BEMS
response and notificationThe following table describes the parameters that
BEMS
returns and the notification sent to the BlackBerry Connect
app when a file is sent in the chat.Parameter | Type | Description |
---|---|---|
chatId | String | This parameter specifies the ID of the chat to send the file to. |
timestamp | State | This parameter specifies the date that the file was sent. The timestamp is in Epoch UTC Unix timestamp. |
method | String | This parameter specifies the invoked method (for example, SendFile). |
Code example
The following example sends a request to
BEMS
for the recipient to receive the file from the one-to-one chat.REST call URL:https://SERVER:8080/GaslampService/file/im/Contact-ID/FILE-NAME/FileSize?fileId=FILE-REQUEST-ID Verb:PUT HEADERS: Cookie:sessionId=... Accept:application/json X-User-Agent:<iOS or Android>
If the request is successful,
BEMS
sends the following response. The response body is the file contents.HTTP/1.1 200 OK
BEMS
sends the following notification to the BlackBerry Connect
app to send the file. The send file states are Processing > Progress > Complete. The send includes a percentage of the file sent that has completed.{ "id":"S11595", "sequence": 1118327100011764, "result": { "data": { "file": "MyFile.txt", "state": "PROGRESS", "fileRequestId": "d951ee49", "percentDone": 91, "method": "SendFile" } }, "jsonrpc":"2.0" }