Entity
brainCloud User Entities (also called Player Entities) are full json objects (similar to Global Entities) except that are private to a brainCloud user. User entities can be as simple or complex as you would like. All User Entities:
- have a unique
entityId
, generated by brainCloud - have a developer-defined
entityType
(string) - have a
version
to help control updates - have a json
data
section for developer-defined content - are by default private to a user, though can be set as shareable via
acl
User Entities are normally retrieved in bulk after a user logs in, and then updated in real-time as the user interacts with them.
Prior to release 2.22, all user entities were returned in the Authenticate and GetProfileState methods. This is no longer the default behavior, but it can be re-enabled via the Compatibility settings on the Advanced Settings page the portal.
Note that User Entities are by default private (only accessible by the owner), but you can make the accessible to other users via the GetSharedEntityForProfileId and GetSharedEntitiesForProfileId APIs. To do so, you must make them shareable to others via the ACL settings.
User Entity methods are organized into the following categories:
- Core Access - the basic user entity methods
- Singleton - for accessing entities as a singleton - useful for when there will only ever be a single entity of that type. Note that you don't have to explicitly create singletons, just blindly update them, and the system will create them if they don't exist
- Shared Data - used for accessing the shared user entities of another user
API Summary
Core Access:
- CreateEntity
- DeleteEntity
- GetList
- GetListCount
- GetEntitiesByType
- GetEntity
- GetPage
- GetPageOffset
- UpdateEntity
- IncrementUserEntityData
Singleton
Shared Data
- GetSharedEntityForProfileId
- GetSharedEntitiesForProfileId
- GetSharedEntitiesListForProfileId
- UpdateSharedEntity
For more information on how brainCloud organizes data, refer to the Cloud Data Overview.
📄️ CreateEntity
Method creates a new entity on the server.
📄️ DeleteEntity
Method deletes the given entity on the server.
📄️ DeleteSingleton
Method deletes the given singleton on the server.
📄️ GetEntitiesByType
Method returns all user entities that match the given type.
📄️ GetEntity
Method to get a specific entity.
📄️ GetList
Method gets list of entities from the server base on type and/or where clause.
📄️ GetListCount
Method gets a count of entities based on the where clause.
📄️ GetPage
Method uses a paging system to iterate through user entities.
📄️ GetPageOffset
Method to retrieve previous or next pages after having called the GetPage method.
📄️ GetSharedEntitiesForProfileId
Method returns all shared entities for the given profile id.
📄️ GetSharedEntitiesListForProfileId
Method gets list of shared entities for the specified user based on type and/or where clause.
📄️ GetSharedEntityForProfileId
Method returns a shared entity for the given profile and entity ID.
📄️ GetSingleton
Method retrieves a singleton entity on the server. If the entity doesn't exist, null is returned.
📄️ IncrementSharedUserEntityData
Partial increment of entity data field items. Partial set of items incremented as specified.
📄️ IncrementUserEntityData
Partial increment of entity data field items. Partial set of items incremented as specified.
📄️ UpdateEntity
Method updates an entity on the server. This operation results in the entity data being completely replaced by the passed in JSON string.
📄️ UpdateSharedEntity
Method updates a shared entity owned by another user. This operation results in the entity data being completely replaced by the passed in JSON string.
📄️ UpdateSingleton
Method updates a singleton entity on the server. This operation results in the entity data being completely replaced by the passed in JSON string. If the entity doesn't exist it is created.