Profile service

// service which methods will accept callbacks to deliver result, the request will be performed in the background delivering result in UI thread.
service = client.service().profileWithDefaults();
// service which methods will return observables you need to subscribe to
service = client.rxService().profileWithDefaults();

Reactive version returns Observables you need to subscribe to. For callback version pass callback as the last parameter and the request will be performed in the background delivering result in UI thread.

data consistency

In order to manage concurrent updates of an profile from many devices/websites use ETag. When obtaining profile details from COMAPI services you can find an ETag in ComapiResult object. It describes what version of server data you got. When you want to update this data pass the same ETag with the new profile details. If the server data will change before your next update the services will not allow such modification until you obtain the recent version of the data and pass correct ETag with the next update. This way you can keep consistency of the data across many devices.

profile details

Get profile details of an user registered in the same API Space as the SDK

   new Callback<ComapiResult<ComapiProfile>>(){/* implement */});
   .subscribe(new Observer<ComapiResult<ComapiProfile>>(){/* implement */});

Result contains containing a string-object map of properties associated with a given user profile.

query profiles

Query profiles registered on API Space

   new Callback<ComapiResult<List<ComapiProfile>>>(){/* implement */});
   .subscribe(new Observer<ComapiResult<List<ComapiProfile>>>(){/* implement */});

In result you will get a string-object map with a list of profile properties, each associated with a user profile conforming to provided query.

See query syntax. You can use QueryBuilder helper class to construct valid query string.


String queryString = new QueryBuilder().addExists("email").build();

and queryProfiles will look for all profiles containing a field named 'email'.

update profile

Update your user profile providing custom map of values that should be associated with it.

service.updateProfile(profileDetails, eTag,
   new Callback<ComapiResult<List<ComapiProfile>>>(){/* implement */});
rxService.updateProfile(profileDetailsMap, eTag)
   .subscribe(new Observer<ComapiResult<List<ComapiProfile>>>(){/* implement */});

result contains updated details.

patch profile

Applies patch for an user profile. This method won't erase previous profile details with different keys.

service.patchProfile(profileId, profileDetails, eTag,
   new Callback<ComapiResult<ComapiProfile>>(){/* implement */});
rxService.patchProfile(profileId, profileDetails, eTag)
   .subscribe(new Observer<ComapiResult<ComapiProfile>>(){/* implement */});