METHOD_PC_SearchRooms

This method sends a request to BEMS to search for group discussions.

The following table lists the parameters that you can include in this method.

Parameter

Type

Required

Description

searchTerm

String

√

This parameter specifies the search term that is used to search group discussionnames and optionally the group discussions descriptions.

searchDesc

Boolean

—

This parameter specifies whether to search for group discussions using the name and description. By default, this value is true.
  • If true, the search query searches both the group discussion name and the description.
  • If it is false, the query only searches the group discussion names.

isMemberOf

Boolean

—

This parameter specifies the list of group discussions that the user is a member of. By default, this value is false and the search query includes group discussions that the member is and isn't a member of.

disabled

Boolean

—

This parameter specifies whether to include disabled group discussions in a search. By default, this value is false.
  • If true, group discussions that are flagged as disabled are not included in the search or returned in the search results.
  • If false, group discussions that are flagged as disabled are included in the search and returned in the search results.

privacy

String Array

—

This parameter specifies the security level of the group discussion and if the group discussions are returned in a search. By default, this value is set to all. All of the privacy settings for group discussions are searched.

Note: Group discussions with the privacy set to Secret are only returned in the search query if the user is a member of the group discussion.

BEMS response and notification

The following table describes the parameters that BEMS returns and the notification to send to the BlackBerry Connect app when users search for a group discussion.

Parameter

Type

Description

Rooms Json Array This parameter specifies the array of group discussions that meet the search request parameters. The following information is included for each group discussion.

Parameter

Type

Description

id

String

This parameter specifies the ID of the group discussion.

name

String

This parameter specifies the name of the group discussion.

description

String

This parameter specifies the description of the group discussion.

numberOfParticipants Number This parameter specifies the number of participants that are in the group discussion.

Code example

The following example sends a request to BEMS to search for the retirement celebration group discussion using the search term "potluck" . The search searches closed and secret group discussions. Group discussions that are disabled are not included in the search.

{
 "method":"pc.SearchRooms",
 "params":
  {
    "searchTerm":"potluck",
    "disabled":true,
    "privacy":["Closed","Secret", "Open"]
  },
 "id":"c5",
 "jsonrpc":"2.0"
}

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

{
 "id":"c5",
 "error":null,
 "result":
   {
    "data":
      {
       "method":"pc.SearchRooms",
       "state":"PROCESSING"
      }
   },
 "jsonrpc":"2.0"
}

If there are no errors, BEMS sends the following notification to the BlackBerry Connect app and displays the group discussions that match the search query. In this example, one group discussion with 15 participants matches the search query.

{
  "id":"c5",
  "error":null,
  "result":
   {
    "data":
     {
      "method":"pc.SearchRooms",
      "rooms":
        [ 
          { 
           "id":"ma-chan://gems.example.com/25ac15e7-9bff-4e78-9261-6e08aa43231e", 
           "name":"Retirement celebration discussion", 
           "description":"Discuss potluck options", 
           "numberOfParticipants":15
          }
        ]
     }
   },
 "jsonrpc":"2.0",
 "state": "COMPLETE"
}