FindUsersBySubstrName
Retrieves profile information for an exact text match, then it retrieves partial matches of the specified text.
If there are more results than the maximum requested, then maximum requested results are returned.
Does not require the calling user to be a friend of the retrieved users.
In event that the call takes too long, this call has a timelimit enforcement on retrieving partial matches. When a timeout occurs, it will return no partial matches. The user will need to narrow down their search criteria.
Service | Operation |
---|---|
friend | FIND_USERS_BY_SUBSTR_NAME |
Method Parameters
Parameter | Description |
---|---|
searchText | The substring to search for. Minimum length of 3 characters. |
maxResults | Maximum number of results to return. |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
string searchText = "someText";
int maxResults = 5;
SuccessCallback successCallback = (response, cbObject) =>
{
Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error));
};
_bc.FriendService.FindUsersBySubstrName(searchText, maxResults, successCallback, failureCallback);
const char *searchText = "someText";
int maxResults = 5;
_bc->getFriendService()->findUsersBySubstrName(searchText, maxResults, this);
NSString *searchText = @"someText";
int maxResults = 5;
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[[_bc friendService] findUsersBySubstrName:searchText
maxResults:maxResults
completionBlock:successBlock
errorCompletionBlock:failureBlock
cbObject:nil];
String searchText = "someText";
int maxResults = 5;
this; // implements IServerCallback
_bc.getFriendService().findUsersBySubstrName(searchText, maxResults, this);
public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
System.out.print(String.format("Failed | %d %d %s", statusCode, reasonCode, jsonError.toString()));
}
var searchText = "someText";
var maxResults = 5;
_bc.friend.findUsersBySubstrName(searchText, maxResults, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});
var searchText = "someText";
var maxResults = 5;
ServerResponse result = await _bc.friendService.findUsersBySubstrName(searchText:searchText, maxResults:maxResults);
if (result.statusCode == 200) {
print("Success");
} else {
print("Failed ${result.error['status_message'] ?? result.error}");
}
var searchText = "someText";
var maxResults = 5;
var friendProxy = bridge.getFriendServiceProxy();
var postResult = friendProxy.findUsersBySubstrName(searchText, maxResults);
if (postResult.status == 200) {
// Success!
}
{
"service": "friend",
"operation": "FIND_USERS_BY_SUBSTR_NAME",
"data": {
"searchText": "someText",
"maxResults": 5
}
}
JSON Response
{
"status": 200,
"data": {
"matches": [
{
"profileId": "4f2edc69-b3c3-458b-8b4b-6bbd7259b55f",
"profileName": "Test2",
"playerSummaryData": null,
"pictureUrl": "http://somesite.com/test/picture.jpg"
},
{
"profileId": "0da5ad24-2341-42f8-acb5-57aa2dd4ae94",
"profileName": "Test1",
"playerSummaryData": null,
"pictureUrl": "http://somesite.com/test/picture.jpg"
}
],
"matchedCount": 2
}
}