METHOD_InviteFileXfer

This method sends an invitation to accept 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.

fileName

String

√

This parameter specifies the name of the file to send.

fileSize

Long

√

This parameter specifies the size of the file to send.

fileId

String

√

This parameter specifies the file ID created by the BlackBerry Connect client for the file.

BEMS response and notification

The following table describes the parameters that BEMS returns and the notification sent to the BlackBerry Connect app when a file transfer invitation is sent to the recipient.

Parameter

Type

Description

chatId

String

This parameter specifies the ID of the chat that the file transfer invite is sent to.

method

String

This parameter specifies the invoked method (for example, InviteFileXfer).

state

String

This parameter specifies the state of the request to BEMS (for example, Processing or Completed).

Code example

The following example sends a request to BEMS to send an file transfer invitation from "user1" in the chat.

{
 "method":"InviteFileXfer",
 "params":
  {
    "contactId":"sip:user1@example.com",
    "fileName":"MyFile.txt",
    "fileSize":55550000,
    "fileId":"dbc2e7b6-25e8-450e-9670-c9e4f32341bb"
  },
 "id":"c55",
 "jsonrpc":"2.0"
}

If the request is successful, BEMS sends the following response to the BlackBerry Connect app and processes the request.

{
  "id":"c55",
  "error": null,
  "result": 
     {
       "data": 
         {
          "method": "InviteFileXfer",
          "state": "PROCESSING"
         }
     },
  "jsonrpc": "2.0"
}

If there are no errors, BEMS sends the following notification to the BlackBerry Connect app and sends the file.

{
  "id":"c55",
  "error": null,
  "result": 
     {
       "data": 
         {
          "method": "InviteFileXfer",
          "state": "COMPLETED"
         }
     },
  "jsonrpc": "2.0"
}