Skip Navigation

METHOD_GetContactsState

This method sends a request to 
BEMS
 to retrieve a one-time updated presence status of the user's contacts in the 
BlackBerry Connect
 app contacts list. 
The following table describes the parameters that you can include in this method.
Parameter
Type
Required
Description
contactIds
JsonArray
This parameter specifies an array of contact IDs of the user for which to retrieve the state of the users in the contact list.
dependencies
String
This parameter specifies the other methods that this method is dependent on. It specifies the comma delimited dependent request ids.
reconnect
String
This parameter specifies that the 
BlackBerry Connect
 app re-establish the existing session. For example, if 
BlackBerry Connect
 goes to the background, when it comes to the foreground the same session is continued. 

BEMS
 response and notification

The following table describes the parameters that 
BEMS
 returns and the notification to send to the 
BlackBerry Connect
 app when the contact's state is retrieved.
Parameter
Type
Description
method
String
This parameter specifies the method invoked (for example, GetContactState). 
state
String
This parameter specifies the state of the request to 
BEMS
 (for example, Processing or Complete).
userId
String
This parameter specifies the user ID of the user making the request.
contacts
JsonArray
This parameter specifies the updated presence status of the contacts in the user's contacts list.

Example code

The following example sends a request to 
BEMS
 to retrieve the user's contacts presence status.
{ "id":"c12", "method":"GetContactsState", "params": { "contactIds":{["sip:user1@example.com", "sip:user2@example.com", "sip:user3@example.com"]} }, "jsonrpc":"2.0" }
If the request is successful, 
BEMS
 sends the following response to the 
BlackBerry Connect
 app and processes the request.
{ "id":"c12", "error":null, "result": { "data": { "method":"GetContactsState", "state":"PROCESSING" } }, "jsonrpc":"2.0", "background":true }
If there are no errors, 
BEMS
 sends the following notification and a one-time updated presence for all contact's in the user's contact list is displayed.
{ "id": "c21", "sequence":1018557800000049, "result": { "data": { "contacts": { "user1@example.com": { "availability":"15500", "presence":"Away" }, "user2@example.com": { "availability":"6500", "presence":"Busy" }, "user3@example.com": { "availability":"3500", "presence":"Available" } }, "method":"GetContactsState", "state":"COMPLETE" } }, "jsonrpc":"2.0" }