UpdateAttributes
Update user attributes.
Service | Operation |
---|---|
playerState | UPDATE_ATTRIBUTES |
Method Parameters
Parameter | Description |
---|---|
jsonAttributes | Single layer JSON string that is a set of key-value pairs |
wipeExisting | Whether to wipe existing attributes prior to update. |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
string attributes = "{\"key1\":\"value1\",\"key2\":\"value2\"}";
bool wipeExisting = false;
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.PlayerStateService.UpdateAttributes(attributes, wipeExisting, successCallback, failureCallback);
const char *attributes = "{\"key1\":\"value1\",\"key2\":\"value2\"}";
bool wipeExisting = false;
_bc->getPlayerStateService()->updateAttributes(attributes, wipeExisting, this);
NSString *attributes = @"{\"key1\":\"value1\",\"key2\":\"value2\"}";
bool wipeExisting = false;
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[[_bc playerStateService] updateAttributes:attributes
wipeExisting:wipeExisting
completionBlock:successBlock
errorCompletionBlock:failureBlock
cbObject:nil];
String attributes = "{\"key1\":\"value1\",\"key2\":\"value2\"}";
boolean wipeExisting = false;
this; // implements IServerCallback
_bc.getPlayerStateService().updateAttributes(attributes, wipeExisting, 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 attributes = {
"key1": "value1",
"key2": "value2"
};
var wipeExisting = false;
_bc.playerState.updateAttributes(attributes, wipeExisting, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});
var attributes = {
"key1": "value1",
"key2": "value2"
};
var wipeExisting = false;
ServerResponse result = await _bc.playerStateService.updateAttributes(attributes:attributes, wipeExisting:wipeExisting);
if (result.statusCode == 200) {
print("Success");
} else {
print("Failed ${result.error['status_message'] ?? result.error}");
}
var attributes = {
"key1": "value1",
"key2": "value2"
};
var wipeExisting = false;
var playerStateProxy = bridge.getPlayerStateServiceProxy();
var postResult = playerStateProxy.updateAttributes(attributes, wipeExisting);
if (postResult.status == 200) {
// Success!
}
{
"service": "playerState",
"operation": "UPDATE_ATTRIBUTES",
"data": {
"attributes": {
"key1": "value1",
"key2": "value2"
},
"wipeExisting": false
}
}
JSON Response
{
"status" : 200,
"data" : null
}