User Management Service

Almost every app requires User Management, at the simplest level Registration and Authentication. The App42 APIs provides a comprehensive User Management solution to handle users both as App42 Users and Social Users. The service contains operations for managing user creation, authentication, state (revoking, locking, expiry etc.), role management, profile management, password policy, etc. Almost everything that one can do is available through the AppHQ console. These users can be also exported in various formats at the click of a button, if required.

User Management service is designed to be orthogonal. Other App42 services can be used independently of this service, they are not connected or dependent. It can also be integrated with existing CRM, LDAP, Active Directory, etc. This module also works in conjunction with App42 Marketing Automation which provides comprehensive actionable analytics on user’s behavior and the ability to take action e.g. Push Notification, In-App Message, Social Post, Email, Survey, Coupon, Lead Generation, NPS (Net Promoter Score) etc. With App42 MA you can track funnels and cohorts, through which action can be taken as campaigns or on demand.

Along with User Management, the library provides APIs for persistent Session Management across Omni-Channel devices that help in maintaining context based sessions across.

Import Statement

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
import com.shephertz.app42.paas.sdk.android.App42API;
import com.shephertz.app42.paas.sdk.android.App42Response;
import com.shephertz.app42.paas.sdk.android.App42Exception;
import com.shephertz.app42.paas.sdk.android.App42BadParameterException;
import com.shephertz.app42.paas.sdk.android.App42NotFoundException;
import com.shephertz.app42.paas.sdk.android.user.User;
import com.shephertz.app42.paas.sdk.android.user.User.Profile;
import com.shephertz.app42.paas.sdk.android.user.User.UserGender;
import com.shephertz.app42.paas.sdk.android.user.UserService;
using com.shephertz.app42.paas.sdk.windows;  
using com.shephertz.app42.paas.sdk.windows.user;   
#import "Shephertz_App42_iOS_API/Shephertz_App42_iOS_API.h"   
#import<Shephertz_App42_iOS_API/Shephertz_App42_iOS_API.h>
import com.shephertz.app42.paas.sdk.java.App42API;
import com.shephertz.app42.paas.sdk.java.App42Response;
import com.shephertz.app42.paas.sdk.java.App42Exception;
import com.shephertz.app42.paas.sdk.java.App42BadParameterException;
import com.shephertz.app42.paas.sdk.java.App42NotFoundException;
import com.shephertz.app42.paas.sdk.java.user.User;
import com.shephertz.app42.paas.sdk.java.user.User.Profile;
import com.shephertz.app42.paas.sdk.java.user.User.UserGender;
import com.shephertz.app42.paas.sdk.java.user.UserService;
using com.shephertz.app42.paas.sdk.csharp;  
using com.shephertz.app42.paas.sdk.csharp.user;  
<script type="text/javascript" src="App42-all-x.x.x.min.js"></script>
local App42API = require("App42-Lua-API.App42API")
#include "App42API.h"
using com.shephertz.app42.paas.sdk.csharp;  
using com.shephertz.app42.paas.sdk.csharp.user;  
include_once '../UserService.php'; 
include_once '../App42Response.php';  
include_once '../App42Exception.php';   
include_once '../App42BadParameterException.php';  
include_once '../App42NotFoundException.php'; 
include_once '../App42Log.php';
#include "App42API.h"
require 'App42_Ruby_API'
import com.shephertz.app42.paas.sdk.as3.App42API;
import com.shephertz.app42.paas.sdk.as3.App42Response;
import com.shephertz.app42.paas.sdk.as3.App42Exception;
import com.shephertz.app42.paas.sdk.as3.App42BadParameterException;
import com.shephertz.app42.paas.sdk.as3.App42NotFoundException;	
import com.shephertz.app42.paas.sdk.as3.user.Profile;
import com.shephertz.app42.paas.sdk.as3.user.UserGender;
import com.shephertz.app42.paas.sdk.as3.user.User;
import com.shephertz.app42.paas.sdk.as3.user.UserService;
Coming Soon
import com.shephertz.app42.paas.sdk.jme.App42API;
import com.shephertz.app42.paas.sdk.jme.App42Response;
import com.shephertz.app42.paas.sdk.jme.App42Exception;
import com.shephertz.app42.paas.sdk.jme.App42BadParameterException;
import com.shephertz.app42.paas.sdk.jme.App42NotFoundException;
import com.shephertz.app42.paas.sdk.jme.user.User;
import com.shephertz.app42.paas.sdk.jme.user.User.Profile;
import com.shephertz.app42.paas.sdk.jme.user.User.UserGender;
import com.shephertz.app42.paas.sdk.jme.user.UserService;

Initialize

In order to use the various functions available in a specific API, a developer has to initialize with App42API by passing the apiKey and the secretKey which will become available after the app creation from AppHQ dashboard.

Required Parameters

apiKey - The Application key given when the application was created. secretKey - The secret key corresponding to the application key given when the application was created.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
App42API.Initialize("API_KEY","SECRET_KEY");
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")        
App42API.initialize("API_KEY","SECRET_KEY");
App42API.Initialize("API_KEY","SECRET_KEY");
App42.initialize("API_KEY","SECRET_KEY");
App42API:initialize("API_KEY","SECRET_KEY")
App42API::Initialize("APP_KEY", "SECRET_KEY");
App42API.Initialize("API_KEY","SECRET_KEY");
App42API::initialize("API_KEY","SECRET_KEY"); 
App42API::Initialize("APP_KEY", "SECRET_KEY");
api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY")
App42API.initialize("API_KEY","SECRET_KEY");
Coming Soon
App42API.initialize("API_KEY","SECRET_KEY");

Build Service

After initialization, the developer will have to call the buildXXXService method on App42API to get the instance of the particular API that you wish to build. For example, to build an instance of UserService, buildUserService() method needs to be called.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
UserService userService = App42API.buildUserService(); 
UserService userService = App42API.BuildUserService();  
UserService *userService = [App42API buildUserService]; 
let userService = App42API.buildUserService() as? UserService      
UserService userService = App42API.buildUserService(); 
UserService userService = App42API.BuildUserService();
var userService  = new App42User();
local userService  = App42API:buildUserService()
UserService *userService = App42API::BuildUserService();
UserService userService = App42API.BuildUserService(); 
$userService = App42API::buildUserService(); 
UserService *userService = App42API::BuildUserService();
user_service = api.build_user_service
var userService:UserService = App42API.buildUserService(); 
Coming Soon
UserService userService = App42API.buildUserService(); 

Create User

This function allows you to create a User session for the specified User. Note: Username and EmailId should be unique for the App.

Required Parameters

userName - Name of the user for whom the user session is to be created. pwd - Password of the user. emailId - EmailId of the user.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String userName = "Nick";
String pwd = "********";
String emailId = "nick@shephertz.co.in";    
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.createUser( userName, pwd, emailId, new App42CallBack() {
public void onSuccess(Object response) 
{
	User user = (User)response;
	System.out.println("userName is " + user.getUserName());
	System.out.println("emailId is " + user.getEmail());
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});   
String userName = "Nick";   
String pwd  = "********";
String emailId = "nick@shephertz.co.in";
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.CreateUser(userName,pwd,emailId, new Callback());  
public class Callback : App42Callback  
{  	
	public void OnSuccess(Object response)  
	{  
		User user = (User) response;
		Console.WriteLine("userName is " + user.GetUserName());
		Console.WriteLine("emailId is " + user.GetEmail());     
		String jsonResponse = user.ToString();  
	}  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
}  
NSString *userName = @"Nick";
NSString *pwd = @"********";
NSString *emailId = @"nick@shephertz.co.in";
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService createUser:userName password:pwd emailAddress:emailId completionBlock:^(BOOL success, id responseObj, App42Exception *exception)
{
	if (success)
	{
		User *user = (User*)responseObj;
		NSLog(@"userName is %@" , user.userName);
		NSLog(@"emailId is %@" ,  user.email);
		NSLog(@"SessionId is %@",user.sessionId);
		NSString *jsonResponse = [user toString]; 
	}
	else
	{
		NSLog(@"Exception is %@",[exception reason]);
		NSLog(@"HTTP error Code is %d",[exception httpErrorCode]);
		NSLog(@"App Error Code is %d",[exception appErrorCode]);
		NSLog(@"User Info is %@",[exception userInfo]);
	}
}];
let userName = "Nick"
let pwd = "*****"
let emailId = "nick@shephertz.co.in"
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")     
let userService = App42API.buildUserService() as? UserService    
userService?.createUser(userName, password: password, emailAddress:emailAddress, completionBlock: { (success, response, exception) -> Void in
    if(success)
    {
        let user = response as! User
        NSLog("%@", user.userName)
        NSLog("%@", user.email)
        NSLog("%@", user.sessionId)
    }
    else
    {
        NSLog("%@", exception.reason!)
        NSLog("%d", exception.appErrorCode)
        NSLog("%d", exception.httpErrorCode)
        NSLog("%@", exception.userInfo!)
    }
})
String userName = "Nick";
String pwd = "********";
String emailId = "nick@shephertz.co.in";    
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
User user = userService.createUser(userName, pwd, emailId); 
System.out.println("userName is " + user.getUserName());
System.out.println("emailId is " + user.getEmail());
String jsonResponse = user.toString();  
String userName = "Nick";
String pwd = "********";
String emailId = "nick@shephertz.co.in";
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.CreateUser(userName, pwd, emailId, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		User user = (User) response;
		App42Log.Console("userName is " + user.GetUserName());
		App42Log.Console("emailId is " + user.GetEmail()); 
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var userName = "Nick";  
var pwd = "*********";  
var emailId = "nick@shephertz.co.in";  
var result ;  
App42.initialize("API_KEY","SECRET_KEY");
var userService  = new App42User();
userService.createUser(userName, pwd, emailId,{  
	success: function(object) 
	{  
		var userObj = JSON.parse(object);  
		result = userObj.app42.response.users.user;
		console.log("userName is " + result.userName)
		console.log("emailId is " + result.email)
	},  
	error: function(error) {  
	}  
}); 
local userName  = "Nick"
local pwd = "********"
local emailId = "nick@shephertz.co.in"
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local userService  = App42API:buildUserService()
userService:createUser(userName,pwd,emailId,App42CallBack)
function App42CallBack:onSuccess(object)
	print("userName is "..object:getUserName())
	print("emailId is "..object:getEmail())
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* userName = "Nick";
const char* pwd = "*******";
const char* emailId = "nick@shephertz.co.in";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->CreateUser(userName, pwd, emailId,app42callback(Sample_Class::onUserRequestCompleted, this));
void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            printf("\n SessionId=%s",it->sessionId.c_str());
            printf("\n isAccountLocked=%d",it->isAccountLocked);
            printf("\n CreatedOn=%s",it->createdOn.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
String userName = "Nick";
String pwd = "********";
String emailId = "nick@shephertz.co.in";
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
User user = userService.CreateUser(userName, pwd, emailId); 
Console.WriteLine("userName is " + user.GetUserName());
Console.WriteLine("emailId is " + user.GetEmail());
String jsonResponse = user.ToString();         
$userName = "Nick";
$pwd = "********";
$emailId = "nick@shephertz.co.in";
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$user = $userService->createUser($userName, $pwd, $emailId); 
print_r("userName is " . $user->getUserName());
print_r("emailId is " . $user->getEmail());
$jsonResponse = $user->toString(); 
const char* userName = "Nick";
const char* pwd = "*******";
const char* emailId = "nick@shephertz.co.in";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->CreateUser(userName, pwd, emailId,this,app42callfuncND_selector(Sample_Class::onUserRequestCompleted));
void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            printf("\n SessionId=%s",it->sessionId.c_str());
            printf("\n isAccountLocked=%d",it->isAccountLocked);
            printf("\n CreatedOn=%s",it->createdOn.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
userName = "Nick";
pwd = "********";
emailId = "nick@shephertz.com";
api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY")
user_service = api.build_user_service
user = user_service.create_user(userName, pwd, emailId); 
puts "userName is #{user.userName}";
puts "email is #{user.email}";
jsonResponse = user.to_s(); 
var userName:String = "Nick";   
var pwd:String  = "*****";
var emailId:String = "nick@shephertz.co.in";
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.createUser(userName,pwd,emailId, new callback());  
public class callback implements App42CallBack  
{  
	public function onSuccess(response:Object):void  
	{  
		var user:User = User(response); 
		trace("userName is " + user.getUserName());
		trace("emailId is " + user.getEmail());
	}  
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}  
}  
    Coming Soon 
String userName = "Nick";
String pwd = "********";
String emailId = "nick@shephertz.co.in";    
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
User user = userService.createUser(userName, pwd, emailId); 
System.out.println("userName is " + user.getUserName());
System.out.println("emailId is " + user.getEmail());
String jsonResponse = user.toString();    

Create User With Role

This function enables you to create app users along with granting them specific roles.

Required Parameters

userName - Name of the user for whom the user session is to be created. pwd - Password of the user. emailId - EmailId of the user. roleList - List of roles to be assigned to the user.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String userName = "Nick";
String pwd = "********";
String emailId = "nick@shephertz.co.in";   
ArrayList<String> roleList = new ArrayList<String>();
roleList.add("Admin");
roleList.add("Manager");
roleList.add("Programmer");
roleList.add("Tester"); 
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.createUser(userName, pwd, emailId, roleList, new App42CallBack() {
public void onSuccess(Object response) 
{
	User user = (User)response;
	System.out.println("userName is " + user.getUserName());  
	System.out.println("emailId is " + user.getEmail());  
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});
String userName = "Nick";   
String pwd  = "********";
String emailId = "nick@shephertz.co.in";
IList<String> roleList = new List<String>();  
roleList.Add("Admin");  
roleList.Add("Manager");  
roleList.Add("Programmer");  
roleList.Add("Tester");  
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.CreateUser(userName, pwd, emailId, roleList, new Callback());
public class Callback : App42Callback  
{   
	public void OnSuccess(Object response)  
	{  
		User user = (User) response;   
		Console.WriteLine("userName is " + user.GetUserName());
		Console.WriteLine("emailId is " + user.GetEmail());  
		String jsonResponse = user.ToString();  
	}  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
}  
NSString *userName = @"Nick";
NSString *pwd = @"********";
NSString *emailId = @"nick@shephertz.co.in";
NSArray *roleArray = [[NSArray alloc]initWithObjects:@"Admin",@"Manager",@"Programmer",@"Tester", nil];
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService createUser:userName password:pwd emailAddress:emailId roleList:roleArray completionBlock:^(BOOL success, id responseObj, App42Exception *exception)
 {
	 if (success)
	 {
		User *user = (User*)responseObj;
		NSLog(@"userName is %@" , user.userName);
		NSLog(@"emailId is %@" ,  user.email);		
		NSLog(@"SessionId = %@",user.sessionId);
		NSString *jsonResponse = [user toString]; 

	 }
	else
	{
		NSLog(@"Exception is %@",[exception reason]);
		NSLog(@"HTTP error Code is %d",[exception httpErrorCode]);
		NSLog(@"App Error Code is %d",[exception appErrorCode]);
		NSLog(@"User Info is %@",[exception userInfo]);
	}

}];		
let userName = "Nick"
let password = "*****"
let emailId = "nick@shephertz.co.in"
let roles = ["COO","Lead"]
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")     
let userService = App42API.buildUserService() as? UserService    
userService?.createUser(userName, password:password, emailAddress:emailAddress, roleList:roles, completionBlock: { (success, response, exception) -> Void in

    if(success)
    {
        let user = response as! User
        NSLog("%@", user.userName)
        NSLog("%@", user.sessionId)
        let roles = user.roleList as! [String]
        for role in roles{
            NSLog("%@",role)
        }
    }
    else
    {
        NSLog("%@", exception.reason!)
        NSLog("%d", exception.appErrorCode)
        NSLog("%d", exception.httpErrorCode)
        NSLog("%@", exception.userInfo!)
    }
})
String userName = "Nick";
String pwd = "********";
String emailId = "nick@shephertz.co.in";   
ArrayList<String> roleList = new ArrayList<String>();
roleList.add("Admin");
roleList.add("Manager");
roleList.add("Programmer");
roleList.add("Tester"); 
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
User user = userService.createUser(userName, pwd, emailId,roleList); 
System.out.println("userName is " + user.getUserName());  
System.out.println("emailId is " + user.getEmail());  
String jsonResponse = user.toString();   
String userName = "Nick";
String pwd = "********";
String emailId = "nick@shephertz.co.in";
IList<String> roleList = new List<String>();  
roleList.Add("Admin");  
roleList.Add("Manager");  
roleList.Add("Programmer");  
roleList.Add("Tester"); 
App42Log.SetDebug(true);		//Print output in your editor console 
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.CreateUser(userName, pwd, emailId,roleList,new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		User user = (User) response;   
		App42Log.Console("userName is " + user.GetUserName());
		App42Log.Console("emailId is " + user.GetEmail()); 
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var userName = "Nick";
var pwd = "*********";
var emailId = "nick@shephertz.co.in";
var roleList = new Array();
roleList.push("Admin")
roleList.push("Manager")
roleList.push("Programmer")
roleList.push("Tester")
var result;
App42.initialize("API_KEY","SECRET_KEY");
var userService = new App42User();
userService.createUserWithRole(userName, pwd, emailId, roleList, {
	success: function (object) {
		var userObj = JSON.parse(object);
		result = userObj.app42.response.users.user;
		console.log("userName is " + result.userName)
		console.log("emailId is " + result.email)
	},
	error: function (error) {
	}
});    
Not Availabe
const char* userName = "Nick";
const char* pwd = "*******";
const char* emailId = "nick@shephertz.co.in";   
vector<string>roles;
roles.push_back("s_admin");
roles.push_back("s_manager");
roles.push_back("s_techlead");
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->CreateUser(userName, pwd, emailId, roles, app42callback(Sample_Class::onUserRequestCompleted, this));

void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            printf("\n SessionId=%s",it->sessionId.c_str());
            printf("\n isAccountLocked=%d",it->isAccountLocked);
            printf("\n CreatedOn=%s",it->createdOn.c_str());
            //Fetching Roles
            std::vector<string>::iterator iit;
            for(iit=it->roleList.begin(); iit!=it->roleList.end(); ++iit)
            {
                printf("\n%s",iit->c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
String userName = "Nick";
String pwd = "********";
String emailId = "nick@shephertz.co.in";
IList<String> roleList = new List<String>();  
roleList.Add("Admin");  
roleList.Add("Manager");  
roleList.Add("Programmer");  
roleList.Add("Tester");  
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
User user = userService.CreateUser(userName, pwd, emailId, roleList); 
Console.WriteLine("userName is " + user.GetUserName());
Console.WriteLine("emailId is " + user.GetEmail());
String jsonResponse = user.ToString();         
$userName = "Nick";
$pwd = "********";
$emailId = "nick@shephertz.co.in";
$roleList = array();
array_push($roleList, "Admin");
array_push($roleList, "Manager");
array_push($roleList, "Programmer");
array_push($roleList, "Tester");
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$user = $userService->createUser($userName, $pwd, $emailId, $roleList); 
print_r("userName is " . $user->getUserName());
print_r("emailId is " . $user->getEmail());
$jsonResponse = $user->toString(); 
const char* userName = "Nick";
const char* pwd = "*******";
const char* emailId = "nick@shephertz.co.in";   
vector<string>roles;
roles.push_back("s_admin");
roles.push_back("s_manager");
roles.push_back("s_techlead");
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->CreateUser(userName, pwd, emailId, roles, this, app42callfuncND_selector(Sample_Class::onUserRequestCompleted));

void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            printf("\n SessionId=%s",it->sessionId.c_str());
            printf("\n isAccountLocked=%d",it->isAccountLocked);
            printf("\n CreatedOn=%s",it->createdOn.c_str());
            //Fetching Roles
            std::vector<string>::iterator iit;
            for(iit=it->roleList.begin(); iit!=it->roleList.end(); ++iit)
            {
                printf("\n%s",iit->c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
userName = "Nick";
pwd = "********";
emailId = "nick@shephertz.com";
roleList = Array.new();
roleList.push("Admin");
roleList.push("Manager");
roleList.push("Programmer");
roleList.push("Tester");		
api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY")
user_service = api.build_user_service
user = user_service.create_user_with_role(userName,pwd,emailId,roleList); 
puts "userName is #{user.userName}";
puts "email is #{user.email}";
userRoleList  = user.roleList();
for roles in userRoleList do
puts "role is #{roles}";
end
jsonResponse = user.to_s();
var userName:String = "Nick";   
var pwd:String  = "*****";
var emailId:String = "nick@shephertz.co.in";
var roleList:Array = new Array();
roleList.push("Admin");  
roleList.push("Manager");  
roleList.push("Programmer");  
roleList.push("Tester");  
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.createUserWithRole(userName,pwd,emailId,roleList, new callback());  
public class callback implements App42CallBack  
{  
	public function onSuccess(response:Object):void  
	{  
		var user:User = User (response);     
		trace("userName is " + user.getUserName());
		trace("emailId is " + user.getEmail());
	}  
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}  
}  
Coming Soon
String userName = "Nick";
String pwd = "********";
String emailId = "nick@shephertz.co.in";   
Vector roleList = new Vector();
roleList.addElement("Admin");
roleList.addElement("Manager");
roleList.addElement("Programmer");
roleList.addElement("Tester"); 
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
User user = userService.createUser(userName, pwd, emailId,roleList); 
System.out.println("userName is " + user.getUserName());
System.out.println("emailId is " + user.getEmail());
String jsonResponse = user.toString();   

Create Or Update User Profile

Note: This service creates a new profile for the first time user and on subsequent visits user information keeps on getting updated. This will always update the profile with the new value passed in profile object. Call to this method should have all the values you want to retain in user profile object, otherwise old values of the profile will get updated with null. This method only updates the profile of user, Passing email/password in the user object does not have any significance on it.

Required Parameters

user - User for which profile has to be created/updated.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String userName = "Nick";						
String pwd = "********";
String emailId = "nick@shephertz.co.in";					
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
User user = userService.createUser(userName, pwd, emailId);  
Profile profile = user.new Profile();
Date date = new Date(); 			 
profile.setFirstName("Nick");
profile.setLastName("Gill");
profile.setSex(UserGender.MALE);
profile.setDateOfBirth(date);
profile.setCity("Houston");
profile.setState("Texas");
profile.setPincode("74193");
profile.setCountry("USA");
profile.setMobile("+1-1111-111-111");
profile.setHomeLandLine("+1-2222-222-222");
profile.setOfficeLandLine("+1-33333-333-333");
userService.createOrUpdateProfile(userObj,new App42CallBack() {
public void onSuccess(Object response) 
{
	User user = (User)response;
	System.out.println("userName is " + user.getUserName());
	System.out.println("firstName is " + user.getProfile().getFirstName()); 
	System.out.println("city is " + user.getProfile().getCity()); 
	System.out.println("country is " + user.getProfile().getCountry()); 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});
String userName = "Nick";   
String pwd  = "*****";
String emailId = "nick@shephertz.co.in";
bool flag  = true;
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.CreateUser(userName,pwd,emailId, new Callback()); 
public class Callback : App42Callback  
{  
	public void OnSuccess(Object response)  
	{  
		if(flag)
		{
			User user = (User) response; 
			User.Profile profile = new User.Profile(user);
			profile.SetCountry("USA");
			profile.SetCity("Houston");
			profile.SetDateOfBirth(new DateTime());
			profile.SetFirstName("Nick");
			profile.SetLastName("Gill");
			profile.SetHomeLandLine("+1-1800-877-453");
			profile.SetOfficeLandLine("+1-1800-111-999");
			profile.SetMobile("+958901234571");
			profile.SetSex(UserGender.MALE); 
			flag = false;
			userService.CreateOrUpdateProfile(user, requestCallback);
		}
		String jsonResponse = user.ToString();  
	} 
	public void OnException(App42Exception exception)  
	{  
	Console.WriteLine("Exception Message : " + exception);  
	}  	
}  
NSString *userName = @"Nick";
NSString *pwd = @"********";
NSString *emailId = @"nick@shephertz.co.in";
Profile *profile = [[Profile alloc]init];	
profile.firstName = @"Nick";
profile.lastName = @"Gill";
profile.sex = MALE;
NSDate *date = [NSDate date]; 	 		
profile.dateOfBirth = date;
profile.city = @"Houston";
profile.state = @"Texas";
profile.pincode = @"74193";
profile.country = @"USA";
profile.mobile = @"+1-1111-111-111";
profile.homeLandLine = @"+1-2222-222-222";
profile.officeLandLine = @"+1-33333-333-333";	
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService createUserWithProfile:userName password:pwd emailAddress:emailId profile:profile completionBlock:^(BOOL success, id responseObj, App42Exception *exception)
{
	if (success)
	{
		User *user = (User*)responseObj;
		NSLog(@"userName is %@" , user.userName);
		NSLog(@"emailId is %@" ,  user.email);
		NSString *jsonResponse = [user toString];
	}
	else
	{
		NSLog(@"Exception is %@",[exception reason]);
		NSLog(@"HTTP error Code is %d",[exception httpErrorCode]);
		NSLog(@"App Error Code is %d",[exception appErrorCode]);
		NSLog(@"User Info is %@",[exception userInfo]);
	}
}];			
let userName = "Nick"
let password = "*****"
let emailId = "nick@shephertz.co.in"
userService?.createUser(userName, password: password, emailAddress:emailAddress, completionBlock: { (success, response, exception) -> Void in
    if(success)
    {
        let user = response as! User
        let profile = Profile()
        profile.firstName = "Nick"
        profile.lastName = "Gill"
        profile.sex = MALE
        profile.dateOfBirth = NSDate(timeIntervalSinceNow: 0)
        profile.city = "Houston"
        profile.state = "Texas"
        profile.pincode = "74193"
        profile.country = "USA"
        profile.mobile = "+1-1111-111-111"
        profile.homeLandLine = "+1-2222-222-222"
        profile.officeLandLine = "+1-33333-333-333"
        user.profile = profile

        self.userService?.createOrUpdateProfile(user, completionBlock: { (success, response, exception) -> Void in

            if(success)
            {
                let updatedUser = response as! User
                NSLog("User Name = %@", updatedUser.userName)
                NSLog("First Name = %@", updatedUser.profile.firstName)
                NSLog("Sex = %@", updatedUser.profile.sex)
                NSLog("Date Of Birth = %@", updatedUser.profile.dateOfBirth)
                NSLog("City = %@", updatedUser.profile.city)
                NSLog("state = %@", updatedUser.profile.state)
            }
            else
            {
                NSLog("%@", exception.reason!)
                NSLog("%d", exception.appErrorCode)
                NSLog("%d", exception.httpErrorCode)
                NSLog("%@", exception.userInfo!)
            }
        })
    }
    else
    {
        NSLog("%@", exception.reason!)
        NSLog("%d", exception.appErrorCode)
        NSLog("%d", exception.httpErrorCode)
        NSLog("%@", exception.userInfo!)
    }
})
String userName = "Nick";
String pwd = "********";
String emailId = "nick@shephertz.co.in";
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
User userObj = userService.createUser(userName, pwd, emailId);
Profile profile = userObj.new Profile();
Date date = new Date();
profile.setFirstName("Nick");
profile.setLastName("Gill");
profile.setSex(UserGender.MALE);
profile.setDateOfBirth(date);
profile.setCity("Houston");
profile.setState("Texas");
profile.setPincode("74193");
profile.setCountry("USA");
profile.setMobile("+1-1111-111-111");
profile.setHomeLandLine("+1-2222-222-222");
profile.setOfficeLandLine("+1-33333-333-333");
User user = userService.createOrUpdateProfile(userObj); 
System.out.println("userName is " + user.getUserName());
System.out.println("firstName is " + user.getProfile().getFirstName()); 
System.out.println("city is " + user.getProfile().getCity()); 
System.out.println("country is " + user.getProfile().getCountry());  
String userName = "Nick";   
String pwd  = "*****";
String emailId = "nick@shephertz.com";
bool flag  = true;
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.CreateUser(userName,pwd,emailId, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		if(flag)
		{
			User user = (User) response; 
			User.Profile profile = new User.Profile(user);
			profile.SetCountry("USA");
			profile.SetCity("Houston");
			profile.SetDateOfBirth(new DateTime());
			profile.SetFirstName("Nick");
			profile.SetLastName("Gill");
			profile.SetHomeLandLine("+1-1800-877-453");
			profile.SetOfficeLandLine("+1-1800-111-999");
			profile.SetMobile("+958901234571");
			profile.SetSex(UserGender.MALE); 
			flag = false;
			userService.CreateOrUpdateProfile(user, new UnityCallBack());
			/* Above line will create user profile and returns User object which has profile object in it. */
		}
		else {
			User user = (User) response;
			/* This will create user in App42 cloud and will return User object */  
			App42Log.Console("userName is " + user.GetUserName());
			App42Log.Console("emailId is " + user.GetEmail()); 
		}
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var userName  = "Nick",
result ;
userService.setFirstName("Nick");
userService.setLastName("Gill");
userService.setOfficeLandLine("+1-1800-111-999");
userService.setCountry("USA");
userService.setCity("Houston");
userService.setMobile("+958901234571");
App42.initialize("API_KEY","SECRET_KEY");
var userService  = new App42User();
userService.createOrUpdateProfile(userName,{
success: function(object) 
{  
	var userObj = JSON.parse(object);  
	result = userObj.app42.response.users.user;
	console.log("userName is : " + result.userName)
	var profile = result.profile;
	console.log("firstName is : " + profile.firstName);
	console.log("lastName is : " + profile.lastName);
	
},  
error: function(error) {  
	}  
});        
Coming Soon
App42User user;
user.userName = "Nick";
App42UserProfile userProfile;
userProfile.firstName = "Nick";
userProfile.lastName = "Gill";
userProfile.setSex(App42UserProfile::MALE);
userProfile.city = "Houston";
userProfile.state = "Texas";
userProfile.pincode = "74193";
userProfile.country = "USA";
userProfile.mobile = "+1-1111-111-111";
userProfile.homeLandLine = "+1-2222-222-222";
userProfile.officeLandLine = "+1-33333-333-333";
user.profile = userProfile;
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->createOrUpdateProfile(&user, app42callback(Sample_Class::onUserRequestCompleted, this));

void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            printf("\n isAccountLocked=%d",it->isAccountLocked);            
            //Fetching Profile Info
            printf("\n FirstName=%s",it->profile.firstName.c_str());
            printf("\n LastName=%s",it->profile.lastName.c_str());
            printf("\n Sex=%s",it->profile.getSex().c_str());
            printf("\n Date of Birth=%s",it->profile.dateOfBirth.c_str());
            printf("\n Line1=%s",it->profile.line1.c_str());
            printf("\n Line2=%s",it->profile.line2.c_str());
            printf("\n City=%s",it->profile.city.c_str());
            printf("\n State=%s",it->profile.state.c_str());
            printf("\n Pincode=%s",it->profile.pincode.c_str());
            printf("\n Country=%s",it->profile.country.c_str());
            printf("\n Mobile=%s",it->profile.mobile.c_str());
            printf("\n HomeLandLine=%s",it->profile.homeLandLine.c_str());
            printf("\n OfficeLandLine=%s",it->profile.officeLandLine.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
String userName = "Nick";
String pwd = "********";
String emailId = "nick@shephertz.co.in";
User userObj = userService.CreateUser(userName, pwd, emailId);  
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
User.Profile profile = new User.Profile(userObj);
profile.SetFirstName("Nick");
profile.SetLastName("Gill");
profile.SetSex(UserGender.MALE);
profile.SetDateOfBirth(DateTime.Now);
profile.SetCity("Houston");
profile.SetState("Texas");
profile.SetPincode("74193");
profile.SetCountry("USA");
profile.SetMobile("+1-1111-111-111");
profile.SetHomeLandLine("+1-2222-222-222");
profile.SetOfficeLandLine("+1-33333-333-333");
User user = userService.CreateOrUpdateProfile(userObj); 
Console.WriteLine("userName is " + user.GetUserName());
Console.WriteLine("firstName is " + user.GetProfile().GetFirstName()); 
Console.WriteLine("city is " + user.GetProfile().GetCity()); 
Console.WriteLine("country is " + user.GetProfile().GetCountry()); 
$userName = "Nick";
$pwd = "********";
$emailId = "nick@shephertz.co.in";
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$userObj = $userService->createUser($userName, $pwd, $emailId);  
$profile = new Profile($userObj);
$date = date(DATE_ATOM, mktime());
$date1 = strtotime($date);
$currentDate= date('Y-m-j', $date1); 
$profile->setCountry("USA");
$profile->setCity("Houston");
$profile->setDateOfBirth($currentDate);
$profile->setFirstName("Nick");
$profile->setLastName("Gill");
$profile->setHomeLandLine("+1-1800-877-453");
$profile->setOfficeLandLine("+1-1800-111-999");
$profile->setMobile("+1-1111-111-111");
$profile->setSex(UserGender::MALE);
$profile->setState("Texas");
$user = $userService->createOrUpdateProfile($userObj); 
print_r("userName is " . $user->getUserName());
print_r("emailId is " . $user->getEmail());
$profileObj = $user->getProfile();
print_r("firstName is" . $profileObj->getFirstName());
print_r("City is" . $profileObj->getCity());
print_r("Country is" . $profileObj->getCountry());
$jsonResponse = $user->toString();   
App42User user;
user.userName = "Nick";
App42UserProfile userProfile;
userProfile.firstName = "Nick";
userProfile.lastName = "Gill";
userProfile.setSex(App42UserProfile::MALE);
userProfile.city = "Houston";
userProfile.state = "Texas";
userProfile.pincode = "74193";
userProfile.country = "USA";
userProfile.mobile = "+1-1111-111-111";
userProfile.homeLandLine = "+1-2222-222-222";
userProfile.officeLandLine = "+1-33333-333-333";
user.profile = userProfile;
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->createOrUpdateProfile(&user, this, app42callfuncND_selector(Sample_Class::onUserRequestCompleted));

void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            printf("\n isAccountLocked=%d",it->isAccountLocked);            
            //Fetching Profile Info
            printf("\n FirstName=%s",it->profile.firstName.c_str());
            printf("\n LastName=%s",it->profile.lastName.c_str());
            printf("\n Sex=%s",it->profile.getSex().c_str());
            printf("\n Date of Birth=%s",it->profile.dateOfBirth.c_str());
            printf("\n Line1=%s",it->profile.line1.c_str());
            printf("\n Line2=%s",it->profile.line2.c_str());
            printf("\n City=%s",it->profile.city.c_str());
            printf("\n State=%s",it->profile.state.c_str());
            printf("\n Pincode=%s",it->profile.pincode.c_str());
            printf("\n Country=%s",it->profile.country.c_str());
            printf("\n Mobile=%s",it->profile.mobile.c_str());
            printf("\n HomeLandLine=%s",it->profile.homeLandLine.c_str());
            printf("\n OfficeLandLine=%s",it->profile.officeLandLine.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
userName = "Nick";
pwd = "********";
emailId = "nick@shephertz.com";
api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY")
user_service = api.build_user_service
user = user_service.createUser(userName, pwd, emailId);
profileObj = App42::User::User::Profile.new();
profileObj.officeLandLine = ("+1-1800-111-999");
profileObj.firstName = "Nick";
profileObj.dateOfBirth = "03-11-2012";
profileObj.country = ("USA");
profileObj.city = ("Houston");
profileObj.lastName = ("Gill");
profileObj.mobile = ("+958901234571");
profileObj.pincode = ("74193");
profileObj.sex = App42::User::User::UserGender.new.enum("MALE");
profileObj.homeLandLine = ("+1-1800-877-453");
profileObj.state = ("Texas");
user.profile= profileObj;
userObj = user_service.createOrUpdateProfile(user);
puts "userName is #{userObj.userName}";
puts "email is #{userObj.emailId}";
puts "firstName #{userObj.profile.firstName}";
jsonResponse = userObj.to_s(); 
var userName:String = "Nick";   
var pwd:String  = "*****";
var bool:Boolean = true;
var emailId:String = "nick@shephertz.co.in";
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.createUser(userName,pwd,emailId, new callback());  
public class callback implements App42CallBack  
{
	public function onSuccess(response:Object):void  
	{  
		var user:User = User (response);  
		if(bool) 
		{
			var profile:Profile = user.getProfile();
			profile.setFirstName("Nick");
			profile.setLastName("Gill");
			profile.setSex(UserGender.MALE);
			profile.setDateOfBirth(new Date());
			profile.setCity("Houston");
			profile.setState("Texas");
			profile.setPincode("74193");
			profile.setCountry("USA");
			profile.setMobile("+1-1111-111-111");
			profile.setHomeLandLine("+1-2222-222-222");
			profile.setOfficeLandLine("+1-33333-333-333");
			userService.createOrUpdateProfile(user,new callback());
			bool = false;
		}
		else{
			var profileObject:Profile = Profile(user.getProfile());
			trace("FirstName is : " + profileObject.getFirstName());
			trace("LastName is : " + profileObject.getLastName());
			trace("Sex is : " + profileObject.getSex());
			trace("DateOfBirth is : " + profileObject.getDateOfBirth());
			trace("City is : " + profileObject.getCity());
			trace("State is : " + profileObject.getState());
			trace("Pincode is : " + profileObject.getPincode());
			trace("Country is : " + profileObject.getCountry());
			trace("MobileNo is  : " + profileObject.getMobile());
			trace("HomeLandLineNo is : " + profileObject.getHomeLandLine());
			trace("OfficeLandLineNo is : " + profileObject.getOfficeLandLine());
		}
	}   
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	} 
}  
Coming Soon
String userName = "Nick";						
String pwd = "********";
String emailId = "nick@shephertz.co.in";					
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
User userObj = userService.createUser(userName, pwd, emailId);  
Profile profile = userObj.new Profile();
Date date = new Date(); 			 
profile.setFirstName("Nick");
profile.setLastName("Gill");
profile.setSex(UserGender.MALE);
profile.setDateOfBirth(date);
profile.setCity("Houston");
profile.setState("Texas");
profile.setPincode("74193");
profile.setCountry("USA");
profile.setMobile("+1-1111-111-111");
profile.setHomeLandLine("+1-2222-222-222");
profile.setOfficeLandLine("+1-33333-333-333");
User user = userService.createOrUpdateProfile(userObj); 
System.out.println("userName is " + user.getUserName());
System.out.println("firstName is " + user.getProfile().getFirstName()); 
System.out.println("city is " + user.getProfile().getCity()); 
System.out.println("country is " + user.getProfile().getCountry()); 

Authenticate

Authenticate user based on username and password.

Required Parameters

userName - Username that you want to authenticate. pwd - Password that was entered when the user created their profile.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String userName = "Nick";
String pwd = "********";   
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.authenticate(userName , pwd, new App42CallBack() {
public void onSuccess(Object response)
{
	User user = (User)response;
	System.out.println("userName is " + user.getUserName());  
	System.out.println("sessionId is " + user.getSessionId());  
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message : "+ex.getMessage());
}
});
String userName = "Nick";   
String pwd  = "*****";
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.Authenticate(userName,pwd, new Callback()); 
public class Callback : App42Callback  
{  
	public void OnSuccess(Object response)  
	{  
		User user = (User) response;     
		Console.WriteLine("userName is : " + user.GetUserName());
		Console.WriteLine("sessionId is : " + user.GetSessionId());
	} 
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  	
}  
NSString *userName = @"Nick";
NSString *pwd = @"********";
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService authenticateUser:userName password:pwd completionBlock:^(BOOL success, id responseObj, App42Exception *exception)
{
	if (success)
	{
		User *user = (User*)responseObj;
		NSLog(@"userName is %@" , user.userName);
		NSLog(@"sessionId is %@" ,  user.sessionId);
	}
	else
	{
		NSLog(@"Exception is %@",[exception reason]);
		NSLog(@"HTTP error Code is %d",[exception httpErrorCode]);
		NSLog(@"App Error Code is %d",[exception appErrorCode]);
		NSLog(@"User Info is %@",[exception userInfo]);
	}
}];
let userName = "Nick"
let pwd = "*******";
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")     
let userService = App42API.buildUserService() as? UserService  
userService?.authenticateUser(userName, password:pwd, completionBlock: { (success, response, exception) -> Void in
    if(success)
    {
        let user = response as! User
        NSLog("%@", user.userName)
        NSLog("%@", user.email)
        NSLog("%@", user.sessionId)
    }
    else
    {
        NSLog("%@", exception.reason!)
        NSLog("%d", exception.appErrorCode)
        NSLog("%d", exception.httpErrorCode)
        NSLog("%@", exception.userInfo!)
    }
})
String userName = "Nick";
String pwd = "********";   
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
User user = userService.authenticate(userName, pwd); 
System.out.println("userName is " + user.getUserName());  
System.out.println("sessionId is " + user.getSessionId());  
String userName = "Nick";
String pwd = "********";
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.Authenticate(userName, pwd,new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		User user = (User) response;     
		App42Log.Console("userName is " + user.GetUserName());
		App42Log.Console("sessionId is " + user.GetSessionId());
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var userName = "Nick";  
var pwd = "*********";  
var result ;  
App42.initialize("API_KEY","SECRET_KEY");
var userService  = new App42User();
userService.authenticate(userName, pwd,{  
	success: function(object) 
	{  
		var userObj = JSON.parse(object);  
		result = userObj.app42.response.users.user;
		console.log("userName is " + result.userName)
		console.log("sessionId is " + result.sessionId)
	},  
	error: function(error) {
	}  
}); 
local userName  = "Nick"
local pwd = "********"
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local userService  = App42API:buildUserService()
userService:authenticate(userName,pwd,App42CallBack)
function App42CallBack:onSuccess(object)
	print("userName is "..object:getUserName())
	print("session id is "..object:getSessionId())
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
std::string userName = "Nick";
std::string pwd = "********";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->Authenticate(userName, pwd, app42callback(Sample_Class::onUserRequestCompleted, this));
void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            printf("\n SessionId=%s",it->sessionId.c_str());
            printf("\n isAccountLocked=%d",it->isAccountLocked);
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
String userName = "Nick";
String pwd = "********";
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
User user = userService.Authenticate(userName, pwd); 
Console.WriteLine("userName is " + user.GetUserName());
Console.WriteLine("sessionId is " + user.GetSessionId());
String jsonResponse = user.ToString();         
$userName = "Nick";
$pwd = "********";
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$user = $userService->authenticate($userName, $pwd); 
print_r("userName is " . $user->getUserName());
print_r("sessionId is " . $user->getSessionId());
$jsonResponse = $user->toString(); 
std::string userName = "Nick";
std::string pwd = "********";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->Authenticate(userName, pwd, this, app42callfuncND_selector(Sample_Class::onUserRequestCompleted));
void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            printf("\n SessionId=%s",it->sessionId.c_str());
            printf("\n isAccountLocked=%d",it->isAccountLocked);
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
userName = "Nick";
pwd = "*******";
api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY")
user_service = api.build_user_service
user = user_service.authenticate(userName, pwd); 
puts "UserName is #{user.userName}";
jsonResponse = user.to_s(); 
var userName:String = "Nick";   
var pwd:String  = "*****";
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.authenticate(userName,pwd, new callback());  
public class callback implements App42CallBack  
{  
	public function onSuccess(response:Object):void  
	{  
		var user:User = User(response);
		trace("userName is " + user.getUserName());
		trace("sessionId is " + user.getSessionId());
	}  
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}  
}
Coming Soon 
String userName = "Nick";
String pwd = "********";   
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
User user = userService.authenticate(userName, pwd); 
System.out.println("userName is " + user.getUserName());
System.out.println("sessionId is " + user.getSessionId());

Change User Password

Change the password for a user based on their username, only if the old password is valid.

Required Parameters

userName - User whose password has to be changed. oldPwd - Old Password of the user for authentication. newPwd - New Password entered by the user.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String userName = "Nick";
String oldPwd   = "********";
String newPwd   = "*******";	
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.changeUserPassword(userName, oldPwd, newPwd,new App42CallBack() {
public void onSuccess(Object response) 
{
App42Response app42response = (App42Response)response;      
System.out.println("response is " + app42response) ;  
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
}); 
String userName = "Nick"; 
String oldPwd   = "********";
String newPwd   = "*******";	
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.ChangeUserPassword(userName,oldPwd,newPwd, new Callback());  
public class Callback : App42Callback  
{ 
	public void OnSuccess(Object response)  
	{  
		App42Response app42response = (App42Response) response;     
		String jsonResponse = app42response.ToString();  
	}  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
}  
NSString *userName = @"Nick"; 
NSString *oldPwd = @"********"; 
NSString *newPwd = @"*******"; 
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService changeUserPassword:userName oldPassword:oldPwd newPassword:newPwd completionBlock:^(BOOL success, id responseObj, App42Exception *exception)
{
	if (success)
	{
		App42Response *response = (App42Response*)responseObj;
		NSString *success = response.isResponseSuccess;
		NSString *jsonResponse = [response toString];        
	}
	else
	{
		NSLog(@"Exception is %@",[exception reason]);
		NSLog(@"HTTP error Code is %d",[exception httpErrorCode]);
		NSLog(@"App Error Code is %d",[exception appErrorCode]);
		NSLog(@"User Info is %@",[exception userInfo]);
	}
}];                     
let userName = "Nick"; 
let oldPwd = "********";
let newPwd = "********";	
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")     
let userService = App42API.buildUserService() as? UserService   
userService?.changeUserPassword(userName , oldPassword:oldPassword, newPassword:newPassword, completionBlock: { (success, response, exception) -> Void in

    if(success)
    {
        let user = response as! App42Response
        NSLog("%@", user.isResponseSuccess)
        NSLog("%@", user.strResponse)
    }
    else
    {
        NSLog("%@", exception.reason!)
        NSLog("%d", exception.appErrorCode)
        NSLog("%d", exception.httpErrorCode)
        NSLog("%@", exception.userInfo!)
    }
})
String userName = "Nick";
String oldPwd   = "********";
String newPwd   = "*******";	
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
App42Response app42response = userService.changeUserPassword(userName, oldPwd, newPwd); 
System.out.println("response is " + app42response) ; 
boolean  success = app42response.isResponseSuccess();
String jsonResponse = app42response.toString(); 
String userName = "Nick";
String oldPwd   = "********";
String newPwd   = "*******";	
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.ChangeUserPassword(userName, oldPwd, newPwd,new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		App42Response app42response = (App42Response) response;     
		String jsonResponse = app42response.ToString();  
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var userName = "Nick",
oldPwd   = "********",
newPwd   = "*******",
result ;  
App42.initialize("API_KEY","SECRET_KEY");
var userService  = new App42User();
userService.changeUserPassword(userName, oldPwd, newPwd,{  
	success: function(object) 
	{  
		var userObj = JSON.parse(object);  
		result = userObj.app42.response;
		console.log("success is " + result.success)
	},  
	error: function(error) {
	}  
}); 
local userName  = "Nick"
local oldPwd   = "********"
local newPwd   = "*******"
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local userService  = App42API:buildUserService()
userService:changeUserPassword(userName,oldPwd,newPwd,App42CallBack)
function App42CallBack:onSuccess(object)
	print(object:getResponseSuccess())
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* userName = "Nick";
const char* oldPwd = "*******";
const char* newPwd = "1234567";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->ChangeUserPassword(userName, oldPwd, newPwd, app42callback(Sample_Class::onUserRequestCompleted, this));

void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
String userName = "Nick";
String oldPwd   = "********";
String newPwd   = "*******";	
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
App42Response response = userService.ChangeUserPassword(userName, oldPwd, newPwd); 
Boolean  success = response.IsResponseSuccess();
String jsonResponse = response.ToString(); 
$userName = "Nick";
$oldPwd   = "********";
$newPwd   = "*******";
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$response = $userService->changeUserPassword($userName, $oldPwd, $newPwd); 
print_r("Response is :  ".$response->toString());
$success = $response->isResponseSuccess();
$jsonResponse = $response->toString();
const char* userName = "Nick";
const char* oldPwd = "*******";
const char* newPwd = "1234567";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->ChangeUserPassword(userName, oldPwd, newPwd, this, app42callfuncND_selector(Sample_Class::onUserRequestCompleted));

void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
userName = "Nick";
oldPwd = "********";
newPwd = "*******";
api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY")
user_service = api.build_user_service
response = user_service.change_user_password(userName, oldPwd, newPwd); 
success = response.is_response_success();
jsonResponse = response.to_s(); 
var userName:String = "Nick"; 
var oldPwd:String = "********";
var newPwd:String = "*******";	
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.changeUserPassword(userName,oldPwd,newPwd, new callback());  
public class callback implements App42CallBack  
{  
	public function onSuccess(response:Object):void
	{  
		var response:App42Response = App42Response (response);
		trace("response is : " + response);
	}  
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	} 
}  
Coming Soon 
String userName = "Nick";
String oldPwd   = "********";
String newPwd   = "*******";	
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
App42Response response = userService.changeUserPassword(userName, oldPwd, newPwd); 
boolean  success = response.isResponseSuccess();
String jsonResponse = response.toString(); 

Assign Roles

Assign Roles to the existing user.

Required Parameters

userName - Name of the user to whom the roles have to be assigned. roleList - List of roles to be assigned to user.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String userName = "Nick";
ArrayList<String> roleList = new ArrayList<String>();
roleList.add("Admin");
roleList.add("Manager");
roleList.add("Programmer");
roleList.add("Tester"); 
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.assignRoles(userName,roleList,new App42CallBack() {
public void onSuccess(Object response) 
{
	User user = (User)response;
	System.out.println("userName is " + user.getUserName());  
	for(int i = 0; i < user.getRoleList().size();i++)  
	{  
		System.out.println("roleList is " + user.getRoleList().get(i));  
	}  
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message : " + ex.getMessage());
}
});
String userName = "Nick";  
IList<String> roleList = new List<String>();  
roleList.Add("Admin");  
roleList.Add("Manager");  
roleList.Add("Programmer");  
roleList.Add("Tester");  
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.AssignRoles(userName, roleList, new Callback()); 
public class Callback : App42Callback  
{   
	public void OnSuccess(Object response)  
	{  
		User user = (User) response;     
		Console.WriteLine("userName is " + user.GetUserName());
		Console.WriteLine("emailId is " + user.GetEmail());
		for(int i = 0; i < user.GetRoleList().Count; i++)
		{
			Console.WriteLine("roleList is " + user.GetRoleList()[i]);
		}
	}  
	public void OnException(App42Exception exception)  
	{  
		trace("Exception Message");  
	} 
}  
NSString *userName = @"Nick";
NSArray *roleArray = [[NSArray alloc]initWithObjects:@"Admin",@"Manager",@"Programmer",@"Tester", nil];
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService assignRoles:userName roleList:roleArray completionBlock:^(BOOL success, id responseObj, App42Exception *exception) {
	if (success)
	{
		User *user = (User*)responseObj;
		NSLog(@"userName is %@" , user.userName);
		NSLog(@"emailId is %@" ,  user.email);
		NSLog(@"RollList  is %@", user.roleList);
		NSString *jsonResponse = [user toString]; 
	}
	else
	{
		NSLog(@"Exception is %@",[exception reason]);
		NSLog(@"HTTP error Code is %d",[exception httpErrorCode]);
		NSLog(@"App Error Code is %d",[exception appErrorCode]);
		NSLog(@"User Info is %@",[exception userInfo]);
	}
}];
let userName = "Nick"
let roles = ["COO","Lead"] 
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")     
let userService = App42API.buildUserService() as? UserService   
userService?.assignRoles(userName, roleList: roles, completionBlock: { (success, response, exception) -> Void in

    if(success)
    {
        let user = response as! User
        NSLog("%@", user.userName)
        let roles = user.roleList as! [String]
        for role in roles{
            NSLog("%@",role)
        }
    }
    else
    {
        NSLog("%@", exception.reason!)
        NSLog("%d", exception.appErrorCode)
        NSLog("%d", exception.httpErrorCode)
        NSLog("%@", exception.userInfo!)
    }
})
String userName = "Nick";
ArrayList<String> roleList = new ArrayList<String>();
roleList.add("Admin");
roleList.add("Manager");
roleList.add("Programmer");
roleList.add("Tester"); 
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
User user = userService.assignRoles(userName,roleList); 
System.out.println("userName is " + user.getUserName());  
for(int i = 0; i < user.getRoleList().size();i++)  
{  
	System.out.println("roleList is " + user.getRoleList().get(i));  
}  
String userName = "Nick";
IList<String> roleList = new List<String>();  
roleList.Add("Admin");  
roleList.Add("Manager");  
roleList.Add("Programmer");  
roleList.Add("Tester");  
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.AssignRoles(userName, roleList, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		User user = (User) response;     
		App42Log.Console("userName is " + user.GetUserName());
		for(int i = 0; i < user.GetRoleList().Count;i++)
		{
			App42Log.Console("roleList is " + user.GetRoleList()[i]);
		}
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var userName = "Nick";
var roleList = new Array();
roleList.push("Admin")
roleList.push("Manager")
roleList.push("Programmer")
roleList.push("Tester")
var result;
var userService = new App42User();
userService.assignRoles(userName, roleList, {
	success: function (object) {
		var userObj = JSON.parse(object);
		result = userObj.app42.response.users.user;
		console.log("userName is " + result.userName);
	},
	error: function (error) {
	}
}); 
Not Available
const char* userName = "Nick";  
vector<string>roles;
roles.push_back("s_Manager");
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->AssignRoles(userName, roles, app42callback(Sample_Class::onUserRequestCompleted, this));

void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            //Fetching Roles
            std::vector<string>::iterator iit;
            for(iit=it->roleList.begin(); iit!=it->roleList.end(); ++iit)
            {
                printf("\n%s",iit->c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
String userName = "Nick";
IList<String> roleList = new List<String>();  
roleList.Add("Admin");  
roleList.Add("Manager");  
roleList.Add("Programmer");  
roleList.Add("Tester");  
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
User user = userService.AssignRoles(userName,roleList); 
Console.WriteLine("userName is " + user.GetUserName());
Console.WriteLine("emailId is " + user.GetEmail());
for(int i = 0; i < user.GetRoleList().Count;i++)
{
	Console.WriteLine("roleList is " + user.GetRoleList()[i]);
}
$userName = "Nick";
$roleList = array();
array_push($roleList, "Admin");
array_push($roleList, "Manager");
array_push($roleList, "Programmer");
array_push($roleList, "Tester");
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$user = $userService->assignRoles($userName, $roleList); 
print_r("userName is " . $user->getUserName());
$userRoleList = $user->getRoleList();
foreach($userRoleList as $roles)
{
	print_r("Role is " . $roles);
}
$jsonResponse = $user->toString(); 
const char* userName = "Nick";  
vector<string>roles;
roles.push_back("s_Manager");
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->AssignRoles(userName, roles, this,app42callfuncND_selector(Sample_Class::onUserRequestCompleted));

void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            //Fetching Roles
            std::vector<string>::iterator iit;
            for(iit=it->roleList.begin(); iit!=it->roleList.end(); ++iit)
            {
                printf("\n%s",iit->c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
userName = "Nick";
roleList = Array.new();
roleList.push("Admin");
roleList.push("Manager");
roleList.push("Programmer");
roleList.push("Tester");
api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY")
user_service = api.build_user_service
user = userService.assign_roles(userName,roleList); 
puts "userName is #{user.userName}";
userRoleList = user.roleList();
for roles in userRoleList do
puts "role is #{roles}";
end
jsonResponse = user.to_s(); 
var userName:String = "Nick";  
var roleList:Array = new Array();  
roleList.push("Admin");  
roleList.push("Manager");  
roleList.push("Programmer");  
roleList.push("Tester");  
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.assignRoles(userName,roleList, new callback());  
public class callback implements App42CallBack  
{   
	public function onSuccess(response:Object):void  
	{  
		var user:User = User(response);
		trace("userName is : " + user.getUserName());
		trace("emailId is : " + user.getEmail());
		for(var i:int=0;i<user.getRoleList().length;i++)
		{
			trace("roleList is " + user.getRoleList()[i]);		
		}
	}  
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	} 
}  
Coming Soon
String userName = "Nick";
Vector roleList = new Vector();
roleList.addElement("Admin");
roleList.addElement("Manager");
roleList.addElement("Programmer");
roleList.addElement("Tester"); 
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
User user = userService.assignRoles(userName,roleList); 
System.out.println("userName is " + user.getUserName());
System.out.println("emailId is " + user.getEmail());
Vector roles = user.getRoleList();   
for(int i=0;i < roles.size(); i++)  
{ 
	User role = (User)roles.elementAt(i);  
	System.out.println("role is " + role);
}         

Get User

Get user details based on username.

Required Parameters

userName - Name of the user whose detailes have to be retrieved.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String userName = "Nick";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.getUser(userName, new App42CallBack() {
public void onSuccess(Object response) 
{
	User user = (User)response;
	System.out.println("userName is :" + user.getUserName());  
	System.out.println("emailId is :" + user.getEmail());  
	System.out.println("First Name :"+user.getProfile().getFirstName());
	System.out.println("Last Name :"+user.getProfile().getLastName());
	System.out.println("D.O.B is:"+user.getProfile().getDateOfBirth());
	System.out.println("Sex is:"+user.getProfile().getSex());
	System.out.println("Mobile is:"+user.getProfile().getMobile());       
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});   
String userName = "Nick";  
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.GetUser(userName, new Callback());  
public class Callback : App42Callback  
{  
	public void OnSuccess(Object response)  
	{  
		User user = (User) response;     
		Console.WriteLine("userName is " + user.GetUserName());
		Console.WriteLine("emailId is " + user.GetEmail()); 
		Console.WriteLine("First Name :" +user.GetProfile().GetFirstName());
		Console.WriteLine("Last Name : "+ user.GetProfile().GetLastName());
		Console.WriteLine("D.O.B is : " + user.GetProfile().GetDateOfBirth());
		Console.WriteLine("Sex is : " + user.GetProfile().GetSex());
		Console.WriteLine("Mobile is : " + user.GetProfile().GetMobile());
	} 
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
}  
NSString *userName = @"Nick";
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService getUser:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) {
	if (success)
	{
		User *user = (User*)responseObj;
		NSLog(@"userName is %@" , user.userName);
		NSLog(@"emailId is %@" ,  user.email);
		NSString *jsonResponse = [user toString]; 
	}
	else
	{
		NSLog(@"Exception is %@",[exception reason]);
		NSLog(@"HTTP error Code is %d",[exception httpErrorCode]);
		NSLog(@"App Error Code is %d",[exception appErrorCode]);
		NSLog(@"User Info is %@",[exception userInfo]);
	}
}];
let userName = "Nick"
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")     
let userService = App42API.buildUserService() as? UserService   
userService?.getUser(userName, completionBlock: { (success, response, exception) -> Void in
       	
	if(success)
	{
		let user = response as! User
		NSLog("UserName is : %@", user.userName)
		NSLog("EmailId is : %@", user.email)
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String userName = "Nick";
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
User user = userService.getUser(userName); 
System.out.println("userName is :" + user.getUserName());  
System.out.println("emailId is :" + user.getEmail());  
System.out.println("First Name :"+user.getProfile().getFirstName());
System.out.println("Last Name :"+user.getProfile().getLastName());
System.out.println("D.O.B is:"+user.getProfile().getDateOfBirth());
System.out.println("Sex is:"+user.getProfile().getSex());
System.out.println("Mobile is:"+user.getProfile().getMobile());       
String jsonResponse = user.toString();   
String userName = "Nick";
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.GetUser(userName,new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		User user = (User) response;     
		App42Log.Console("userName is " + user.GetUserName());
		App42Log.Console("emailId is " + user.GetEmail()); 
		App42Log.Console("First Name :" +user.GetProfile().GetFirstName());
		App42Log.Console("Last Name : "+ user.GetProfile().GetLastName());
		App42Log.Console("D.O.B is : " + user.GetProfile().GetDateOfBirth());
		App42Log.Console("Sex is : " + user.GetProfile().GetSex());
		App42Log.Console("Mobile is : " + user.GetProfile().GetMobile());
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var userName = "Nick";  
var result ;  
App42.initialize("API_KEY","SECRET_KEY");
var userService  = new App42User();
userService.getUser(userName,{  
	success: function(object)
	{  
		var userObj = JSON.parse(object);  
		result = userObj.app42.response.users.user;
		console.log("userName is " + result.userName)
		console.log("emailId is " + result.email)
	},  
	error: function(error) {  
	}  
});     
local userName  = "Nick"
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local userService  = App42API:buildUserService()
userService:getUser(userName,App42CallBack)
function App42CallBack:onSuccess(object)
	print("UserName is "..object:getUserName())
	print("Email id is "..object:getEmail())
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* userName = "Nick";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->GetUser(userName, app42callback(Sample_Class::onUserRequestCompleted, this));

void Sample_Class::onUserRequestCompleted( void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            //Fetching Profile Info
            printf("\n FirstName=%s",it->profile.firstName.c_str());
            printf("\n LastName=%s",it->profile.lastName.c_str());
            printf("\n Sex=%s",it->profile.getSex().c_str());
            printf("\n Date of Birth=%s",it->profile.dateOfBirth.c_str());
            printf("\n Line1=%s",it->profile.line1.c_str());
            printf("\n Line2=%s",it->profile.line2.c_str());
            printf("\n City=%s",it->profile.city.c_str());
            printf("\n State=%s",it->profile.state.c_str());
            printf("\n Pincode=%s",it->profile.pincode.c_str());
            printf("\n Country=%s",it->profile.country.c_str());
            printf("\n Mobile=%s",it->profile.mobile.c_str());
            printf("\n HomeLandLine=%s",it->profile.homeLandLine.c_str());
            printf("\n OfficeLandLine=%s",it->profile.officeLandLine.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
String userName = "Nick";
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
User user = userService.GetUser(userName); 
Console.WriteLine("userName is " + user.GetUserName());
Console.WriteLine("emailId is " + user.GetEmail()); 
Console.WriteLine("First Name :" +user.GetProfile().GetFirstName());
Console.WriteLine("Last Name : "+ user.GetProfile().GetLastName());
Console.WriteLine("D.O.B is : " + user.GetProfile().GetDateOfBirth());
Console.WriteLine("Sex is : " + user.GetProfile().GetSex());
Console.WriteLine("Mobile is : " + user.GetProfile().GetMobile());
String jsonResponse = user.ToString();         
$userName = "Nick";
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$user = $userService->getUser($userName); 
print_r("userName is " . $user->getUserName());
print_r("emailId is " . $user->getEmail());
$profile = $user->getProfile();
print_r("firstName is " . $profile->getFirstName());
$jsonResponse = $user->toString(); 
const char* userName = "Nick";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->GetUser(userName, this, app42callfuncND_selector(Sample_Class::onUserRequestCompleted));

void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            //Fetching Profile Info
            printf("\n FirstName=%s",it->profile.firstName.c_str());
            printf("\n LastName=%s",it->profile.lastName.c_str());
            printf("\n Sex=%s",it->profile.getSex().c_str());
            printf("\n Date of Birth=%s",it->profile.dateOfBirth.c_str());
            printf("\n Line1=%s",it->profile.line1.c_str());
            printf("\n Line2=%s",it->profile.line2.c_str());
            printf("\n City=%s",it->profile.city.c_str());
            printf("\n State=%s",it->profile.state.c_str());
            printf("\n Pincode=%s",it->profile.pincode.c_str());
            printf("\n Country=%s",it->profile.country.c_str());
            printf("\n Mobile=%s",it->profile.mobile.c_str());
            printf("\n HomeLandLine=%s",it->profile.homeLandLine.c_str());
            printf("\n OfficeLandLine=%s",it->profile.officeLandLine.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
userName = "Nick";	
api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY")
user_service = api.build_user_service
user = user_service.get_user(userName); 
puts "userName is #{user.userName}";
puts "email is #{user.email}";
puts "firstName #{user.profile.firstName}";
jsonResponse = user.to_s();
var userName:String = "Nick";  
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.getUser(userName, new callback());  
public class callback implements App42CallBack  
{
	public function onSuccess(response:Object):void  
	{  
		var user:User = User (response);
		trace("userName is " + user.getUserName());
		trace("emailId is " + user.getEmail());
	}    
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}  
}  
Coming Soon
String userName = "Nick";
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
User user = userService.getUser(userName); 
System.out.println("userName is " + user.getUserName());
System.out.println("emailId is " + user.getEmail()); 
System.out.println("First Name :"+user.getProfile().getFirstName());
System.out.println("Last Name :"+user.getProfile().getLastName());
System.out.println("D.O.B is:"+user.getProfile().getDateOfBirth());
System.out.println("Sex is:"+user.getProfile().getSex());
System.out.println("Mobile is:"+user.getProfile().getMobile());
String jsonResponse = user.toString();   

Get Roles By User

Get the assigned roles based on username.

Required Parameters

userName - Name of the User for whom roles have to be retrieved.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String userName = "Nick";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.getRolesByUser(userName,new App42CallBack() {
public void onSuccess(Object response) 
{
	User user = (User)response;
	System.out.println("userName is " + user.getUserName());  
	System.out.println("emailId is " + user.getEmail());  
	for(int i = 0; i < user.getRoleList().size();i++)  
	{  
		System.out.println("roleList is " + user.getRoleList().get(i));  
	} 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});
 
String userName = "Nick";  
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.GetRolesByUser(userName, new Callback());  
public class Callback : App42Callback  
{
	public void OnSuccess(Object response)  
	{  
		User user = (User) response;      
		Console.WriteLine("userName is " + user.GetUserName());
		Console.WriteLine("emailId is " + user.GetEmail());
		for(int i = 0; i < user.GetRoleList().Count;i++)
		{
			Console.WriteLine("roleList is " + user.GetRoleList()[i]);
		}
	}
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}    
}  
NSString *userName = @"Nick";
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService getRolesByUser:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) {
	if (success)
	{
		User *user = (User*)responseObj;
		NSLog(@"userName is %@" , user.userName);
		NSLog(@"emailId is %@" ,  user.email);
		NSLog(@"RoleList is %@", user.roleList);
		NSString *jsonResponse = [user toString]; 
	}
	else
	{
		NSLog(@"Exception is %@",[exception reason]);
		NSLog(@"HTTP error Code is %d",[exception httpErrorCode]);
		NSLog(@"App Error Code is %d",[exception appErrorCode]);
		NSLog(@"User Info is %@",[exception userInfo]);
	}
}];
let userName = "Nick"
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")     
let userService = App42API.buildUserService() as? UserService    
userService?.getRolesByUser(userName, completionBlock: { (success, response, exception) -> Void in
       	
	if(success)
	{
		let user = response as! User
		NSLog("UserName is : %@", user.userName)
        let roles = user.roleList as! [String]
        for role in roles{
            NSLog("%@",role)
        }
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String userName = "Nick";
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
User user = userService.getRolesByUser(userName); 
System.out.println("userName is " + user.getUserName());  
System.out.println("emailId is " + user.getEmail());  
for(int i = 0; i < user.getRoleList().size();i++)  
{  
	System.out.println("roleList is " + user.getRoleList().get(i));  
} 
String userName = "Nick";
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.GetRolesByUser(userName, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		User user = (User) response;      
		App42Log.Console("userName is " + user.GetUserName());
		App42Log.Console("emailId is " + user.GetEmail());
		for(int i = 0; i < user.GetRoleList().Count;i++)
		{
			App42Log.Console("roleList is " + user.GetRoleList()[i]);
		}
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var userName = "Nick";
var result;
App42.initialize("API_KEY","SECRET_KEY");
var userService = new App42User();
userService.getRolesByUser(userName, {
	success: function (object) {
		var userObj = JSON.parse(object);
		result = userObj.app42.response.users.user;
		console.log("userName is " + result.userName)
		console.log("emailId is " + result.email)
		var roles = result.role;
		for (var i = 0; i < roles.length; i++ ){
			console.log("Role : " + roles[i])
		}
	},
	error: function (error) {
	}
});
Not Available
const char* userName = "Nick";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->GetRolesByUser(userName, app42callback(Sample_Class::onUserRequestCompleted, this));

void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            //Fetching Profile Info
            printf("\n FirstName=%s",it->profile.firstName.c_str());
            printf("\n LastName=%s",it->profile.lastName.c_str());
            printf("\n Sex=%s",it->profile.getSex().c_str());
            printf("\n Date of Birth=%s",it->profile.dateOfBirth.c_str());
            printf("\n Line1=%s",it->profile.line1.c_str());
            printf("\n Line2=%s",it->profile.line2.c_str());
            printf("\n City=%s",it->profile.city.c_str());
            printf("\n State=%s",it->profile.state.c_str());
            printf("\n Pincode=%s",it->profile.pincode.c_str());
            printf("\n Country=%s",it->profile.country.c_str());
            printf("\n Mobile=%s",it->profile.mobile.c_str());
            printf("\n HomeLandLine=%s",it->profile.homeLandLine.c_str());
            printf("\n OfficeLandLine=%s",it->profile.officeLandLine.c_str());
            //Fetching Roles
            std::vector<string>::iterator iit;
            for(iit=it->roleList.begin(); iit!=it->roleList.end(); ++iit)
            {
                printf("\n%s",iit->c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
String userName = "Nick";
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
User user = userService.GetRolesByUser(userName); 
Console.WriteLine("userName is " + user.GetUserName());
Console.WriteLine("emailId is " + user.GetEmail());
for(int i = 0; i < user.GetRoleList().Count;i++)
{
	Console.WriteLine("roleList is " + user.GetRoleList()[i]);
}
$userName = "Nick";
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$user = $userService->getRolesByUser($userName); 
print_r("userName is " . $user->getUserName());
print_r("emailId is " . $user->getEmail());
$userRoleList = $user->getRoleList();
foreach($userRoleList as $roles)
{
	print_r("Role is " . $roles);
}
$jsonResponse = $user->toString(); 
const char* userName = "Nick";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->GetRolesByUser(userName, this, app42callfuncND_selector(Sample_Class::onUserRequestCompleted));

void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            //Fetching Profile Info
            printf("\n FirstName=%s",it->profile.firstName.c_str());
            printf("\n LastName=%s",it->profile.lastName.c_str());
            printf("\n Sex=%s",it->profile.getSex().c_str());
            printf("\n Date of Birth=%s",it->profile.dateOfBirth.c_str());
            printf("\n Line1=%s",it->profile.line1.c_str());
            printf("\n Line2=%s",it->profile.line2.c_str());
            printf("\n City=%s",it->profile.city.c_str());
            printf("\n State=%s",it->profile.state.c_str());
            printf("\n Pincode=%s",it->profile.pincode.c_str());
            printf("\n Country=%s",it->profile.country.c_str());
            printf("\n Mobile=%s",it->profile.mobile.c_str());
            printf("\n HomeLandLine=%s",it->profile.homeLandLine.c_str());
            printf("\n OfficeLandLine=%s",it->profile.officeLandLine.c_str());
            //Fetching Roles
            std::vector<string>::iterator iit;
            for(iit=it->roleList.begin(); iit!=it->roleList.end(); ++iit)
            {
                printf("\n%s",iit->c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
userName = "Nick";
api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY")
user_service = api.build_user_service
user = user_service.get_roles_by_user(userName); 
puts "userName is #{user.userName}";
puts "email is #{user.email}";  
userRoleList = user.roleList(); 
puts "firstName is #{user.profile.firstName}";  
jsonResponse = user.to_s();  
var userName:String = "Nick";  
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.getRolesByUser(userName, new callback());  
public class callback implements App42CallBack  
{  
	public function onSuccess(response:Object):void  
	{  
		var user:User = User (response);
		trace("userName is " + user.getUserName());
		for(var i:int=0;i<user.getRoleList().length;i++)
		{
			trace("roleList is " + user.getRoleList()[i]);		
		}
	}  
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}  
}  
Coming Soon
String userName = "Nick";
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
User user = userService.getRolesByUser(userName); 
System.out.println("userName is " + user.getUserName());
System.out.println("emailId is " + user.getEmail());       
Vector roles = user.getRoleList();   
for(int i=0;i < roles.size(); i++)  
{ 
	User role = (User)roles.elementAt(i);  
	System.out.println("role is " + role);
} 
String jsonResponse = user.toString();   

Get Users By Role

Get all the Users based on a particular role.

Required Parameters

role - Role based on which Users need to be retrieved.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String role = "Role of the User";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.getUsersByRole(role,new App42CallBack() {				
public void onSuccess(Object response) 
{
	ArrayList<User> user = (ArrayList<User>)response;
	for(int i = 0; i < user.size(); i++)   
	{  
		System.out.println("userName is " + user.get(i).getUserName());  
		System.out.println("emailId is " + user.get(i).getEmail());  
		ArrayList<String> roleList = user.get(i).getRoleList();  
		for(int j = 0; j < roleList.size();j++)   
		{  
			System.out.println("role is " + roleList.get(j));  
		} 
		System.out.println("First Name is " + user.get(i).getProfile().getFirstName());  
		System.out.println("Last Name is " + user.get(i).getProfile().getLastName());  
	}	 
}				
public void onException(Exception ex)
{
	System.out.println("Exception Message"+ex.getMessage());
}
});
String role = "Role of the User";   
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.GetUsersByRole(role, new Callback()); 
public class Callback : App42Callback  
{   
	public void OnSuccess(Object response)  
	{  
		IList<User> user = (IList<User>) response;  
		for(int i = 0; i < user.Count; i++) 
		{
			Console.WriteLine("userName is " + user[i].GetUserName());
			Console.WriteLine("emailId is " + user[i].GetEmail());
			IList<String> roleList = user[i].GetRoleList();
			for(int j = 0; j < roleList.Count;j++) 
			{
				Console.WriteLine("role is " + roleList[j]);
			}
		}     
	} 
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
}  
NSString *role = @"Role of the User";
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService getUsersByRole:role completionBlock:^(BOOL success, id responseObj, App42Exception *exception) {
	if (success)
	{
		NSArray *usersArray = (NSArray*)responseObj;
		NSLog(@"usersArray=%@",usersArray);
		for (User *user in usersArray)
		{
			NSLog(@"User name is %@",user.userName);
			NSLog(@"Email id is %@",user.email);
			NSLog(@"RoleList  list is %@",user.roleList);
			NSLog(@"Response is %@",[user toString]);
		}
	}
	else
	{
		NSLog(@"Exception is %@",[exception reason]);
		NSLog(@"HTTP error Code is %d",[exception httpErrorCode]);
		NSLog(@"App Error Code is %d",[exception appErrorCode]);
		NSLog(@"User Info is %@",[exception userInfo]);
	}
}];
let role = "Role of the User"
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")     
let userService = App42API.buildUserService() as? UserService  
userService?.getUsersByRole(userName, completionBlock: { (success, response, exception) -> Void in
       	
	if(success)
	{
		let user = response as! User
		NSLog("UserName is : %@", user.userName)
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String role = "Role of the User";
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
ArrayList<User> user = userService.getUsersByRole(role);
for(int i = 0; i < user.size(); i++)   
{  
	System.out.println("userName is " + user.get(i).getUserName());  
	System.out.println("emailId is " + user.get(i).getEmail());  
	ArrayList<String> roleList = user.get(i).getRoleList();  
	for(int j = 0; j < roleList.size();j++)   
	{  
		System.out.println("roleList is " + roleList.get(j));  
	} 
	System.out.println("First Name is " + user.get(i).getProfile().getFirstName());  
	System.out.println("Last Name is " + user.get(i).getProfile().getLastName());  
}	 
String role = "Role of the User";
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.GetUsersByRole(role,new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		IList<User> user = (IList<User>) response;  
		for(int i = 0; i < user.Count; i++) 
		{
			App42Log.Console("userName is " + user[i].GetUserName());
			App42Log.Console("emailId is " + user[i].GetEmail());
			IList<String> roleList = user[i].GetRoleList();
			for(int j = 0; j < roleList.Count;j++) 
			{
				App42Log.Console("Role is " + roleList[j]);
			}
		}     
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var role = "Role of the User";
var result;
App42.initialize("API_KEY", "SECRET_KEY");
var userService = new App42User();
userService.getUsersByRole(role, {
	success: function (object) {
		var userObj = JSON.parse(object);
		result = userObj.app42.response.users.user;
		if (result instanceof Array) {
			for (var i = 0; i < result.length; i++) {
				console.log("userName is " + result[i].userName)
				console.log("emailId is " + result[i].email)
			}
		} else {
			console.log("userName is " + result.userName)
			console.log("emailId is " + result.email)
		}
	},
	error: function (error) {
	}
});
Not Available
const char* role = "Role of the User";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->GetUsersByRole(role, app42callback(Sample_Class::onUserRequestCompleted, this));
void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d ",userResponse->getCode());
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {
        printf("\nTotalRecords=%d",userResponse->getTotalRecords());
        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            //Fetching Roles
            std::vector<string>::iterator iit;
            for(iit=it->roleList.begin(); iit!=it->roleList.end(); ++iit)
            {
                printf("\n%s",iit->c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
String role = "Role of the User";
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
IList<User> user = userService.GetUsersByRole(role); 
for(int i = 0; i < user.Count; i++) 
{
	Console.WriteLine("UserName is " + user[i].GetUserName());
	Console.WriteLine("EmailId is " + user[i].GetEmail());
	IList<String> roleList = user[i].GetRoleList();
	for(int j = 0; j < roleList.Count;j++) 
	{
		Console.WriteLine("Role is " + roleList[j]);
	}
}     
$role = "Role of the User";
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$userResponse = $userService->getUsersByRole($role); 
foreach($userResponse as $user )
{
	print_r("userName is " . $user->getUserName());
	print_r("emailId is " .  $user->getEmail());
	print_r("Account Locked is " . $user->isAccountLocked());
	$profile = $user->getProfile();
	print_r("firstName is " . $profile->getFirstName());
}
$jsonResponse = $userResponse[0]->toString(); 
const char* role = "Role of the User";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->GetUsersByRole(role, this, app42callfuncND_selector(Sample_Class::onUserRequestCompleted));
void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d ",userResponse->getCode());
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {
        printf("\nTotalRecords=%d",userResponse->getTotalRecords());
        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            //Fetching Roles
            std::vector<string>::iterator iit;
            for(iit=it->roleList.begin(); iit!=it->roleList.end(); ++iit)
            {
                printf("\n%s",iit->c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
role = "Role of the User";
api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY")
user_service = api.build_user_service
userList = userService.get_users_by_role(role); 
puts "userName is #{user.userName}";
puts "email is #{user.email}";
puts "firstName #{user.profile.firstName}";
userRoleList = user.roleList(); 
jsonResponse = user.to_s();  
var role:String = "Role of the User";   
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.getUsersByRole(role, new callback() ); 
public class callback implements App42CallBack  
{   
	public function onSuccess(response:Object):void  
	{  
		var user:User = User (response);
		trace("userName is " + user.getUserName());
		for(var i:int=0;i<user.getRoleList().length;i++)
		{
			trace("roleList is " + user.getRoleList()[i]);		
		}
	}   
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	} 
}  
Coming Soon
String role = "Role of the User";
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
Vector userList = userService.getUsersByRole(role); 
for(int i=0;i < userList.size();i++)  
{ 
	User user = (User)userList.elementAt(i);  
	System.out.println("userName is " + user.getUserName());
	System.out.println("emailId is " + user.getEmail());
	Vector userRoleList  = user.getRoleList();
	for(int j =0;j< userRoleList.size();j++)
	{
		String role = (String) userRoleList.elementAt(j);
		System.out.println("role is " + role);
	}
}         

Get All Users

Gets All users details.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.getAllUsers(new App42CallBack() {
public void onSuccess(Object response) 
{
	ArrayList<User> user = (ArrayList<User>)response;
	for(int i = 0; i < user.size(); i++)   
	{  
		System.out.println("userName is " + user.get(i).getUserName());  
		System.out.println("emailId is " + user.get(i).getEmail());  
	}  		
}
public void onException(Exception ex)
{
	System.out.println("Exception Message"+ex.getMessage());
}
});
 
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.GetAllUsers(new Callback()); 
public class Callback : App42Callback  
{ 
	public void OnSuccess(Object response)  
	{  
		IList<User> user = (IList<User>) response;  
		for(int i = 0; i < user.Count; i++) 
		{
			Console.WriteLine("userName is " + user[i].GetUserName());
			Console.WriteLine("emailId is " + user[i].GetEmail());
		}     
	}  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
}  
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService getAllUsers:^(BOOL success, id responseObj, App42Exception *exception)
{
	if (success)
	{
		NSArray *usersArray = (NSArray*)responseObj;
		NSLog(@"usersArray=%@",usersArray);
		for (User *user in usersArray)
		{
			NSLog(@"User name is %@",user.userName);
			NSLog(@"Email is %@",user.email);
			NSLog(@"Response is %@",[user toString]);
		}
	}
	else
	{
		NSLog(@"Exception is %@",[exception reason]);
		NSLog(@"HTTP error Code is %d",[exception httpErrorCode]);
		NSLog(@"App Error Code is %d",[exception appErrorCode]);
		NSLog(@"User Info is %@",[exception userInfo]);
	}
}];
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")     
let userService = App42API.buildUserService() as? UserService     
userService?.getAllUsers({ (success, response, exception) -> Void in     
	if(success)
	{
		var userList  = response as! NSArray
		for user in userList {
			NSLog("UserName is : %@", user.userName)
			NSLog("EmailId is : %@", user.email)
		}
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
ArrayList<User> user = userService.getAllUsers(); 
for(int i = 0; i < user.size(); i++)   
{  
	System.out.println("userName is " + user.get(i).getUserName());  
	System.out.println("emailId is " + user.get(i).getEmail());  
}  	
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.GetAllUsers(new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		IList<User> user = (IList<User>) response;  
		for(int i = 0; i < user.Count; i++) 
		{
			App42Log.Console("userName is " + user[i].GetUserName());
			App42Log.Console("emailId is " + user[i].GetEmail());
		}     
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var result ;  
App42.initialize("API_KEY","SECRET_KEY");
var userService  = new App42User();
userService.getAllUsers({  
success: function(object)
 {  
	var userObj = JSON.parse(object);
	result = userObj.app42.response.users.user;
	if (result instanceof Array) {
		for(var i = 0;i<result.length;i++)
		{
			console.log("UserName : " + result[i].userName)
			console.log("EmailId : " + result[i].email)
		}
	} else {
		console.log("UserName : " + result.userName)
		console.log("EmailId : " + result.email)
	}
},  
error: function(error) {  
}  
});     
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local userService  = App42API:buildUserService()
userService:getAllUsers(App42CallBack)
function App42CallBack:onSuccess(object)
	if table.getn(object) >1 then 
		for i=1,table.getn(object) do
			print("UserName is "..object[i]:getUserName())
			print("Email id is "..object[i]:getEmail())
		end
	else
		print("UserName is "..object:getUserName())
		print("Email id is "..object:getEmail())
	end
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->GetAllUsers(app42callback(Sample_Class::onUserRequestCompleted, this));

void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            //Fetching Profile Info
            printf("\n FirstName=%s",it->profile.firstName.c_str());
            printf("\n LastName=%s",it->profile.lastName.c_str());
            printf("\n Sex=%s",it->profile.getSex().c_str());
            printf("\n Date of Birth=%s",it->profile.dateOfBirth.c_str());
            printf("\n Line1=%s",it->profile.line1.c_str());
            printf("\n Line2=%s",it->profile.line2.c_str());
            printf("\n City=%s",it->profile.city.c_str());
            printf("\n State=%s",it->profile.state.c_str());
            printf("\n Pincode=%s",it->profile.pincode.c_str());
            printf("\n Country=%s",it->profile.country.c_str());
            printf("\n Mobile=%s",it->profile.mobile.c_str());
            printf("\n HomeLandLine=%s",it->profile.homeLandLine.c_str());
            printf("\n OfficeLandLine=%s",it->profile.officeLandLine.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
IList<User> user = userService.GetAllUsers(); 
for(int i = 0; i < user.Count; i++) 
{
	Console.WriteLine("userName is " + user[i].GetUserName());
	Console.WriteLine("emailId is " + user[i].GetEmail());
}             
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$userResponse = $userService->getAllUsers(); 
foreach($userResponse as $user )
{
	print_r("userName is " . $user->getUserName());
	print_r("emailId is " .  $user->getEmail());
	print_r("Account Locked is " . $user->isAccountLocked());
	$profile = $user->getProfile();
	print_r("firstName is " . $profile->getFirstName());
}
$jsonResponse = $userResponse[0]->toString(); 
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->GetAllUsers(this,app42callfuncND_selector(Sample_Class::onUserRequestCompleted));

void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            //Fetching Profile Info
            printf("\n FirstName=%s",it->profile.firstName.c_str());
            printf("\n LastName=%s",it->profile.lastName.c_str());
            printf("\n Sex=%s",it->profile.getSex().c_str());
            printf("\n Date of Birth=%s",it->profile.dateOfBirth.c_str());
            printf("\n Line1=%s",it->profile.line1.c_str());
            printf("\n Line2=%s",it->profile.line2.c_str());
            printf("\n City=%s",it->profile.city.c_str());
            printf("\n State=%s",it->profile.state.c_str());
            printf("\n Pincode=%s",it->profile.pincode.c_str());
            printf("\n Country=%s",it->profile.country.c_str());
            printf("\n Mobile=%s",it->profile.mobile.c_str());
            printf("\n HomeLandLine=%s",it->profile.homeLandLine.c_str());
            printf("\n OfficeLandLine=%s",it->profile.officeLandLine.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY")
user_service = api.build_user_service
user_list = user_service.get_all_users(); 
for user in user_list do
puts "userName is #{user.userName}";
puts "email is #{user.email}";
end
jsonResponse = user_list.to_s();
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.getAllUsers(new callback());  
public class callback implements App42CallBack  
{ 
	public function onSuccess(response:Object):void  
	{  
		var array:Array = res as Array;
		for(var i:int = 0;i < array.length;i++){
			var user:User = User(array[i])
			trace("userName is : " + user.getUserName());
			trace("emailId is : " +  user.getEmail());
		}
	}   
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}  
}  
Coming Soon
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
Vector userList = userService.getAllUsers(); 
for(int i=0;i < userList.size();i++)  
{ 
	User user = (User)userList.elementAt(i);  
	System.out.println("userName is " + user.getUserName());
	System.out.println("emailId is " + user.getEmail());
}         

Get All Users Count

Get the count of all the users.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.getAllUsersCount(new App42CallBack() {
public void onSuccess(Object response) 
{
	App42Response app42response = (App42Response)response;      
	System.out.println("Total Records : " + app42response.getTotalRecords()) ;
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
}); 
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.GetAllUsersCount(new Callback());  
public class Callback : App42Callback  
{ 
	public void OnSuccess(Object response)  
	{  
		App42Response app42response = (App42Response) response; 
        Console.WriteLine("Total Records : " + app42response.GetTotalRecords()) ;		
		String jsonResponse = app42response.ToString();  
	}  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
}  
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService getAllUsersCount:^(BOOL success, id responseObj, App42Exception *exception)
{
	if (success)
	{
		App42Response *response = (App42Response*)responseObj;
		NSLog(@"Response is %@",response.strResponse);
		NSLog(@"UsersCount=%d",response.totalRecords);

	}
	else
	{
		NSLog(@"Exception is %@",[exception reason]);
		NSLog(@"HTTP error Code is %d",[exception httpErrorCode]);
		NSLog(@"App Error Code is %d",[exception appErrorCode]);
		NSLog(@"User Info is %@",[exception userInfo]);
	}
}];                     
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")     
let userService = App42API.buildUserService() as? UserService    
userService?.getAllUsersCount({ (success, response, exception) -> Void in
	if(success)
	{
		let app42Response = response as! App42Response
		NSLog("Response success is : %@", app42Response.isResponseSuccess)
		NSLog("Response String is %@", app42Response.strResponse)
		NSLog("Total Records is %d", app42Response.totalRecords)
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
App42Response app42response = userService.getAllUsersCount(); 
System.out.println("Total Records : " + app42response.getTotalRecords()) ;
boolean  success = app42response.isResponseSuccess();
String jsonResponse = app42response.toString(); 
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.GetAllUsersCount(new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		App42Response app42response = (App42Response) response; 
		App42Log.Console("TotalRecords is : " + app42response.GetTotalRecords());
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
Not Available
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local userService  = App42API:buildUserService()
userService:getAllUsersCount(App42CallBack)
function App42CallBack:onSuccess(object)
	print("Total record is "..object:getTotalRecords())
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->GetAllUsersCount(app42callback(Sample_Class::onUserRequestCompleted, this));

void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {
        printf("\nTotalRecords=%d",userResponse->getTotalRecords());
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
App42Response app42response = userService.GetAllUsersCount(); 
Boolean  success = app42response.IsResponseSuccess(); 
Console.WriteLine("Total Records : " + app42response.GetTotalRecords()) ;	
String jsonResponse = app42response.ToString(); 
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$response = $userService->getAllUsersCount(); 
print_r("Total Records is " . $response->getTotalRecords());
$success = $response->isResponseSuccess();
$jsonResponse = $response->toString();
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->GetAllUsersCount(this,app42callfuncND_selector(Sample_Class::onUserRequestCompleted));

void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {
        printf("\nTotalRecords=%d",userResponse->getTotalRecords());
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY")
user_service = api.build_user_service
response = user_service.get_all_users_count(); 
success = response.is_response_success();  
total_records = response.totalRecords();  
jsonResponse = response.to_s(); 
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.getAllUsersCount(new callback());  
public class callback implements App42CallBack  
{  
	public function onSuccess(response:Object):void  
	{  
		var app42Response:App42Response = App42Response(response); 	
		trace("TotalRecords is : " + app42Response.getTotalRecords());
	}  
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}  
}  
Coming Soon 
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
App42Response app42response = userService.getAllUsersCount(); 
System.out.println("Total Records : " + app42response.getTotalRecords()) ;
boolean  success = app42response.isResponseSuccess();
String jsonResponse = app42response.toString(); 

Get All Users Paging

Get All users by Paging.

Required Parameters

max - Maximum number of records to be fetched. offset - From where the records are to be fetched.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
int max = 1;
int offset = 0 ;
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.getAllUsers(max, offset,new App42CallBack() {
public void onSuccess(Object response) 
{
	ArrayList<User> user = (ArrayList<User>)response;
	for(int i = 0; i < user.size(); i++)   
	{  
		System.out.println("userName is " + user.get(i).getUserName());  
		System.out.println("emailId is " + user.get(i).getEmail());  
		System.out.println("First Name is " + user.get(i).getProfile().getFirstName());  
		System.out.println("Last Name is " + user.get(i).getProfile().getLastName());  
	}  	
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});
 
int max = 1;
int offset = 0 ;
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.GetAllUsers(max,offset,new Callback()); 
public class Callback : App42Callback  
{  
	public void OnSuccess(Object response)  
	{  
		IList<User> user = (IList<User>) response;     
		for(int i = 0; i < user.Count; i++) 
		{
			Console.WriteLine("userName is " + user[i].GetUserName());
			Console.WriteLine("emailId is " + user[i].GetEmail());
		}      
	}  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	} 
}  
int max = 1;
int offset = 0 ;
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService getAllUsers:max offset:offset completionBlock:^(BOOL success, id responseObj, App42Exception *exception)
{
	if (success)
	{
		NSArray *usersArray = (NSArray*)responseObj;
		NSLog(@"usersArray=%@",usersArray);
		for (User *user in usersArray)
		{
			NSLog(@"User name is %@",user.userName);
			NSLog(@"Email is %@",user.email);
			NSLog(@"Response is %@",[user toString]);
		}
	}
	else
	{
		NSLog(@"Exception is %@",[exception reason]);
		NSLog(@"HTTP error Code is %d",[exception httpErrorCode]);
		NSLog(@"App Error Code is %d",[exception appErrorCode]);
		NSLog(@"User Info is %@",[exception userInfo]);
	}
}];
let max:Int32 = 10
let offset:Int32 = 0
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")     
let userService = App42API.buildUserService() as? UserService 
userService?.getAllUsers(max , offset: offset,{ (success, response, exception) -> Void in     
	if(success)
	{
		let userList  = response as! NSArray
		for user in userList {
			NSLog("UserName is : %@", user.userName)
			NSLog("EmailId is : %@", user.email)
		}
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
int max = 1;
int offset = 0 ;
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
ArrayList<User> user = userService.getAllUsers(max,offset); 
for(int i = 0; i < user.size(); i++)   
{  
	System.out.println("userName is " + user.get(i).getUserName());  
	System.out.println("emailId is " + user.get(i).getEmail());  
	System.out.println("First Name is " + user.get(i).getProfile().getFirstName());  
	System.out.println("Last Name is " + user.get(i).getProfile().getLastName());  
} 
int max = 1;
int offset = 0 ;
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.GetAllUsers(max,offset,new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		IList<User> user = (IList<User>) response;     
		for(int i = 0; i < user.Count; i++) 
		{
			App42Log.Console("userName is " + user[i].GetUserName());
			App42Log.Console("emailId is " + user[i].GetEmail());
		}      
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
Not Available
local max = 5
local offset= 0
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local userService  = App42API:buildUserService()
userService:getAllUsersByPaging(max,offset,App42CallBack)
function App42CallBack:onSuccess(object)
	if table.getn(object) > 1 then
		for i=1,table.getn(object) do
			print("UserName is "..object[i]:getUserName())
			print("Email id is "..object[i]:getEmail())
		end
	else
		print("UserName is "..object:getUserName())
		print("Email id is "..object:getEmail())
	end
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
int max = 1;
int offset = 0;
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->GetAllUsers(max,offset,app42callback(Sample_Class::onUserRequestCompleted, this));
void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            //Fetching Profile Info
            printf("\n FirstName=%s",it->profile.firstName.c_str());
            printf("\n LastName=%s",it->profile.lastName.c_str());
            printf("\n Sex=%s",it->profile.getSex().c_str());
            printf("\n Date of Birth=%s",it->profile.dateOfBirth.c_str());
            printf("\n Line1=%s",it->profile.line1.c_str());
            printf("\n Line2=%s",it->profile.line2.c_str());
            printf("\n City=%s",it->profile.city.c_str());
            printf("\n State=%s",it->profile.state.c_str());
            printf("\n Pincode=%s",it->profile.pincode.c_str());
            printf("\n Country=%s",it->profile.country.c_str());
            printf("\n Mobile=%s",it->profile.mobile.c_str());
            printf("\n HomeLandLine=%s",it->profile.homeLandLine.c_str());
            printf("\n OfficeLandLine=%s",it->profile.officeLandLine.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
int max = 1;
int offset = 0 ;
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
IList<User> user = userService.GetAllUsers(max,offset); 
for(int i = 0; i < user.Count; i++) 
{
	Console.WriteLine("userName is " + user[i].GetUserName());
	Console.WriteLine("emailId is " + user[i].GetEmail());
}             
$max = 1;
$offset = 0 ;
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$userResponse = $userService->getAllUsers(max,offset);  
foreach($userResponse as $user )
{
	print_r("userName is " . $user->getUserName());
	print_r("emailId is " .  $user->getEmail());
	print_r("Account Locked is " . $user->isAccountLocked());
	$profile = $user->getProfile();
	print_r("firstName is " . $profile->getFirstName());
}
$jsonResponse = $userResponse[0]->toString(); 
int max = 1;
int offset = 0;
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->GetAllUsers(max,offset,this,app42callfuncND_selector(Sample_Class::onUserRequestCompleted));
void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            //Fetching Profile Info
            printf("\n FirstName=%s",it->profile.firstName.c_str());
            printf("\n LastName=%s",it->profile.lastName.c_str());
            printf("\n Sex=%s",it->profile.getSex().c_str());
            printf("\n Date of Birth=%s",it->profile.dateOfBirth.c_str());
            printf("\n Line1=%s",it->profile.line1.c_str());
            printf("\n Line2=%s",it->profile.line2.c_str());
            printf("\n City=%s",it->profile.city.c_str());
            printf("\n State=%s",it->profile.state.c_str());
            printf("\n Pincode=%s",it->profile.pincode.c_str());
            printf("\n Country=%s",it->profile.country.c_str());
            printf("\n Mobile=%s",it->profile.mobile.c_str());
            printf("\n HomeLandLine=%s",it->profile.homeLandLine.c_str());
            printf("\n OfficeLandLine=%s",it->profile.officeLandLine.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
max = 1;
offset = 0 ;
user_list = Array.new();
api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY")
user_service = api.build_user_service
user_list = user_service.get_all_users_by_paging(max, offset); 
for user in user_list do
	puts "userName is #{user.userName}";
	puts "email is #{user.email}";
end
jsonResponse = user_list.to_s(); 
var max:int = 1;
var offset:int = 0;
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.getAllUsersByPaging(max,offset,new callback());  
public class callback implements App42CallBack  
{  
	public function onSuccess(response:Object):void  
	{  
		var array:Array = res as Array;
		for(var i:int = 0;i < array.length;i++){
			var user:User = User(array[i])
			trace("userName is : " + user.getUserName());
			trace("emailId is : " +  user.getEmail());
		}
	}  
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}  
}  
Coming Soon
Integer max = new Integer(1);
Integer offset = new Integer(0);  
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
Vector userList = userService.getAllUsers(max,offset); 
for(int i=0;i < userList.size();i++)  
{ 
	User uset = (User)userList.elementAt(i);  
	System.out.println("userName is " + uset.getUserName());
	System.out.println("emailId is " + uset.getEmail());
}         

Get User By Email ID

Get user details based on Email ID.

Required Parameters

emailId - Email ID of the user whose detail is to be retrieved.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String emailId = "nick@shephertz.co.in";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.getUserByEmailId(emailId,new App42CallBack() {
public void onSuccess(Object response) 
{
	User user = (User)response;
	System.out.println("userName is " + user.getUserName());  
	System.out.println("emailId is " + user.getEmail());  
	System.out.println("First Name is " + user.getProfile().getFirstName());  
	System.out.println("Last Name is " + user.getProfile().getLastName());  
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});   
String emailId = "nick@shephertz.co.in";  
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.GetUserByEmailId(emailId, new Callback());  
public class Callback : App42Callback  
{
	public void OnSuccess(Object response)  
	{  
		User user = (User) response;     
		String jsonResponse = user.ToString();  
	}   
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
}  
NSString *emailId = @"nick@shephertz.co.in";
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService getUserByEmailId:emailId completionBlock:^(BOOL success, id responseObj, App42Exception *exception) {
	if (success)
	{
		User *user = (User*)responseObj;
		NSLog(@"User name is %@",user.userName);
		NSLog(@"Email is %@",user.email);
		NSLog(@"Response is %@",[user toString]);
	}
	else
	{
		NSLog(@"Exception is %@",[exception reason]);
		NSLog(@"HTTP error Code is %d",[exception httpErrorCode]);
		NSLog(@"App Error Code is %d",[exception appErrorCode]);
		NSLog(@"User Info is %@",[exception userInfo]);
	}
}];
let emailId = "nick@shephertz.com"
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")     
let userService = App42API.buildUserService() as? UserService     
userService?.getUserByEmailId(emailId, completionBlock: { (success, response, exception) -> Void in
	
	if(success)
	{
		let user = response as! User
		NSLog("UserNAme is : %@", user.userName)
		NSLog("EmailId is : %@", user.email)
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String emailId = "nick@shephertz.co.in";
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
User user = userService.getUserByEmailId(emailId); 
System.out.println("userName is " + user.getUserName());  
System.out.println("emailId is " + user.getEmail());  
System.out.println("First Name is " + user.getProfile().getFirstName());  
System.out.println("Last Name is " + user.getProfile().getLastName());  
String jsonResponse = user.toString();   
App42Log.SetDebug(true);		//Print output in your editor console
String emailId = "nick@shephertz.co.in";
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.GetUserByEmailId(emailId, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		User user = (User) response;     
		App42Log.Console("userName is " + user.GetUserName());
		App42Log.Console("emailId is " + user.GetEmail());
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var emailId = "nick@shephertz.co.in";  
var result ;  
App42.initialize("API_KEY","SECRET_KEY");
var userService  = new App42User();
userService.getUserByEmailId(emailId,{  
success: function(object)
	{  
		var userObj = JSON.parse(object);  
		result = userObj.app42.response.users.user;
		console.log("userName is " + result.userName)
		console.log("emailId is " + result.email)
	},  
	error: function(error) {  
	}  
});     
local emailId = "nick@shephertz.co.in"
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local userService  = App42API:buildUserService()
userService:getUserByEmailId(emailId,App42CallBack)
function App42CallBack:onSuccess(object)
	print("UserName is "..object:getUserName())
	print("Email id is "..object:getEmail())
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* emailId = "nick@shephertz.co.in";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->GetUserByEmailId(emailId, app42callback(Sample_Class::onUserRequestCompleted, this));

void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            //Fetching Profile Info
            printf("\n FirstName=%s",it->profile.firstName.c_str());
            printf("\n LastName=%s",it->profile.lastName.c_str());
            printf("\n Sex=%s",it->profile.getSex().c_str());
            printf("\n Date of Birth=%s",it->profile.dateOfBirth.c_str());
            printf("\n Line1=%s",it->profile.line1.c_str());
            printf("\n Line2=%s",it->profile.line2.c_str());
            printf("\n City=%s",it->profile.city.c_str());
            printf("\n State=%s",it->profile.state.c_str());
            printf("\n Pincode=%s",it->profile.pincode.c_str());
            printf("\n Country=%s",it->profile.country.c_str());
            printf("\n Mobile=%s",it->profile.mobile.c_str());
            printf("\n HomeLandLine=%s",it->profile.homeLandLine.c_str());
            printf("\n OfficeLandLine=%s",it->profile.officeLandLine.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
String emailId = "nick@shephertz.co.in";
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
User user = userService.GetUserByEmailId(emailId); 
Console.WriteLine("userName is " + user.GetUserName());
Console.WriteLine("emailId is " + user.GetEmail());
String jsonResponse = user.ToString();         
$emailId = "nick@shephertz.co.in";
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$user = $userService->getUserByEmailId($emailId); 
print_r("userName is " . $user->getUserName());
print_r("emailId is " . $user->getEmail());
$profile = $user->getProfile();
print_r("firstName is " . $profile->getFirstName());
$jsonResponse = $user->toString(); 
const char* emailId = "nick@shephertz.co.in";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->GetUserByEmailId(emailId, this, app42callfuncND_selector(Sample_Class::onUserRequestCompleted));

void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            //Fetching Profile Info
            printf("\n FirstName=%s",it->profile.firstName.c_str());
            printf("\n LastName=%s",it->profile.lastName.c_str());
            printf("\n Sex=%s",it->profile.getSex().c_str());
            printf("\n Date of Birth=%s",it->profile.dateOfBirth.c_str());
            printf("\n Line1=%s",it->profile.line1.c_str());
            printf("\n Line2=%s",it->profile.line2.c_str());
            printf("\n City=%s",it->profile.city.c_str());
            printf("\n State=%s",it->profile.state.c_str());
            printf("\n Pincode=%s",it->profile.pincode.c_str());
            printf("\n Country=%s",it->profile.country.c_str());
            printf("\n Mobile=%s",it->profile.mobile.c_str());
            printf("\n HomeLandLine=%s",it->profile.homeLandLine.c_str());
            printf("\n OfficeLandLine=%s",it->profile.officeLandLine.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
emailId = "nick@shephertz.com";	
api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY")
user_service = api.build_user_service
user = user_service.get_user_by_email_id(emailId); 
puts "userName is #{user.userName}";
puts "email is #{user.email}";
jsonResponse = user.to_s(); 
var emailId:String = "nick@shephertz.com";
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.getUserByEmailId(emailId,new callback()); 
public class callback implements App42CallBack  
{  
	public function onSuccess(response:Object):void  
	{  
		var user:User = User(response); 
		trace("userName is " + user.getUserName());
		trace("emailId is " + user.getEmail());
	}    
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	} 
}  
Coming Soon
String emailId = "nick@shephertz.co.in";
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
User user = userService.getUserByEmailId(emailId); 
System.out.println("userName is " + user.getUserName());
System.out.println("emailId is " + user.getEmail()); 
System.out.println("First Name is " + user.getProfile().getFirstName());  
System.out.println("Last Name is " + user.getProfile().getLastName());  
String jsonResponse = user.toString();   

Lock User

Lock the user based on the username. Your app can use this feature to lock a user because of reasons specific to their use case. For example, if payment is not received and the app wants the user to be inactive.

Required Parameters

userName - Username that has to be locked.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String userName = "Nick";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.lockUser(userName, new App42CallBack() {
public void onSuccess(Object response)
 {
	User user = (User)response;
	System.out.println("userName is " + user.getUserName());  
	System.out.println("accountLocked is " + user.isAccountLocked());  
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});  
String userName = "Nick";  
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.LockUser(userName, new Callback());  
public class Callback : App42Callback  
{ 
	public void OnSuccess(Object response)  
	{  
		User user = (User) response;     
		Console.WriteLine("userName is " + user.GetUserName());
		Console.WriteLine("accountLocked is " + user.IsAccountLocked()); 
	}  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
}  
NSString *userName = @"Nick";
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService lockUser:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) {
	if (success)
	{
		User *user = (User*)responseObj;
		NSLog(@"UserName is %@",user.userName);
		NSLog(@"isAccountLocked is %d",user.isAccountLocked);
		NSLog(@"Email is %@",user.email);
		NSLog(@"Response is %@",[user toString]);
	}
	else
	{
		NSLog(@"Exception is %@",[exception reason]);
		NSLog(@"HTTP error Code is %d",[exception httpErrorCode]);
		NSLog(@"App Error Code is %d",[exception appErrorCode]);
		NSLog(@"User Info is %@",[exception userInfo]);
	}
}];
let userName = "Nick"
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")     
let userService = App42API.buildUserService() as? UserService    
userService?.lockUser(userName, completionBlock: { (success, response, exception) -> Void in
	
	if(success)
	{
		let user = response as! User
		NSLog("UserName is : %@", user.userName)
        NSLog("isAccountLocked = %d",user.isAccountLocked)
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String userName = "Nick";
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
User user = userService.lockUser(userName); 
System.out.println("userName is " + user.getUserName());  
System.out.println("accountLocked is " + user.isAccountLocked());  
String userName = "Nick";
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.LockUser(userName, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		User user = (User) response;     
		App42Log.Console("userName is " + user.GetUserName());
		App42Log.Console("accountLocked is " + user.IsAccountLocked()); 
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
Not Available     
local userName = "Nick"
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local userService  = App42API:buildUserService()
userService:lockUser(userName,App42CallBack)
function App42CallBack:onSuccess(object)
	print("UserName is "..object:getUserName())
	print(object:getAccountLocked())
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* userName = "Nick";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->LockUser(userName,app42callback(Sample_Class::onUserRequestCompleted, this));

void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n isAccountLocked=%d",it->isAccountLocked);
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
String userName = "Nick";
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
User user = userService.LockUser(userName); 
Console.WriteLine("userName is " + user.GetUserName());
Console.WriteLine("accountLocked is " + user.IsAccountLocked());
$userName = "Nick";
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$user = $userService->lockUser($userName); 
print_r("userName is " . $user->getUserName());
print_r("accountLocked is " . $user->isAccountLocked());
$jsonResponse = $user->toString(); 
const char* userName = "Nick";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->LockUser(userName,this,app42callfuncND_selector(Sample_Class::onUserRequestCompleted));

void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n isAccountLocked=%d",it->isAccountLocked);
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
userName = "Nick";
api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY")
user_service = api.build_user_service
user = user_service.lock_user(userName); 
userName = user.userName();
jsonResponse = user.to_s(); 
var userName:String = "Nick";
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.lockUser(userName,new callback()); 
public class callback implements App42CallBack  
{  
	public function onSuccess(response:Object):void  
	{  
		var user:User = User(response);
		trace("userName is " + user.getUserName());
		trace("accountLocked is " + user.isAccountLocked());
	}   
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}
}  
Coming Soon
String userName = "Nick";
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
User user = userService.lockUser(userName); 
System.out.println("userName is " + user.getUserName());
System.out.println("accountLocked is " + user.isAccountLocked());

Unlock User

Unlock the previously locked user based on the username. Your app can use this feature to lock a user because of reasons specific to their use case. For example, if payment is received and the app wants the user to be active.

Required Parameters

userName - Username that you want to unlock.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String userName = "Nick";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.unlockUser(userName, new App42CallBack() {
public void onSuccess(Object response) 
{
	User user = (User)response;
	System.out.println("userName is " + user.getUserName());  
	System.out.println("accountLocked is " + user.isAccountLocked());  
}
public void onException(Exception ex)
{
	System.out.println("Exception Message"+ex.getMessage());
}
});
String userName = "Nick";  
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.UnlockUser(userName, new Callback());  
public class Callback : App42Callback  
{  
	public void OnSuccess(Object response)  
	{  
		User user = (User) response;     
		Console.WriteLine("userName is " + user.GetUserName());
		Console.WriteLine("accountLocked is " + user.IsAccountLocked());
	}  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	} 
}  
NSString *userName = @"Nick";
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService unlockUser:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) {
	if (success)
	{
		User *user = (User*)responseObj;
		NSLog(@"UserName is %@",user.userName);
		NSLog(@"isAccountLocked is %d",user.isAccountLocked);
		NSLog(@"Email is %@",user.email);
		NSLog(@"Response is %@",[user toString]);
	}
	else
	{
		NSLog(@"Exception is %@",[exception reason]);
		NSLog(@"HTTP error Code is %d",[exception httpErrorCode]);
		NSLog(@"App Error Code is %d",[exception appErrorCode]);
		NSLog(@"User Info is %@",[exception userInfo]);
	}
}];
let userName = "Nick"
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")     
let userService = App42API.buildUserService() as? UserService   
userService?.unlockUser(userName, completionBlock: { (success, response, exception) -> Void in
	
	if(success)
	{
		let user = response as! User
		NSLog("UserNAme is : %@", user.userName)
        NSLog("isAccountLocked = %d",user.isAccountLocked)
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String userName = "Nick";
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
User user = userService.unlockUser(userName); 
System.out.println("userName is " + user.getUserName());  
System.out.println("accountLocked is " + user.isAccountLocked());  
String userName = "Nick";
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.UnlockUser(userName, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		User user = (User) response;     
		App42Log.Console("userName is " + user.GetUserName());
		App42Log.Console("accountLocked is " + user.IsAccountLocked());
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
Not Available     
local userName = "Nick"
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local userService  = App42API:buildUserService()
userService:unlockUser(userName,App42CallBack)
function App42CallBack:onSuccess(object)
	print("UserName is "..object:getUserName())
	print(object:getAccountLocked())
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* userName = "Nick";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->UnlockUser(userName,app42callback(Sample_Class::onUserRequestCompleted, this));

void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n isAccountLocked=%d",it->isAccountLocked);
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
String userName = "Nick";
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
User user = userService.UnlockUser(userName); 
Console.WriteLine("userName is " + user.GetUserName());
Console.WriteLine("accountLocked is " + user.IsAccountLocked());
$userName = "Nick";
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$user = $userService->unlockUser($userName); 
print_r("userName is " . $user->getUserName());
print_r("Account Locked is " . $user->isAccountLocked());
$jsonResponse = $user->toString();  
const char* userName = "Nick";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->UnlockUser(userName,this,app42callfuncND_selector(Sample_Class::onUserRequestCompleted));

void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n isAccountLocked=%d",it->isAccountLocked);
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
userName = "Nick";
api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY")
user_service = api.build_user_service
user = user_service.unlock_user(userName); 
userName = user.userName();
jsonResponse = user.to_s(); 
var userName:String = "Nick";
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.unlockUser(userName,new callback()); 
public class callback implements App42CallBack  
{   
	public function onSuccess(response:Object):void  
	{  
		var user:User = User(response);
		trace("userName is " + user.getUserName());
		trace("accountLocked is " + user.isAccountLocked());
	}  
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}  
}  
Coming Soon
String userName = "Nick";
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
User user = userService.unlockUser(userName); 
System.out.println("userName is " + user.getUserName());
System.out.println("accountLocked is " + user.isAccountLocked());

Get Locked Users

Gets All the locked users details.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.getLockedUsers(new App42CallBack() {
public void onSuccess(Object response) 
{
	ArrayList<User> user = (ArrayList<User>)response
	for(int i = 0; i < user.size(); i++)   
	{  
		System.out.println("userName is " + user.get(i).getUserName());  
		System.out.println("accountLocked is " + user.get(i).isAccountLocked());  
		System.out.println("emailId is " + user.get(i).getEmail());  
		System.out.println("First Name is " + user.get(i).getProfile().getFirstName());  
		System.out.println("Last Name is " + user.get(i).getProfile().getLastName()); 
	}  
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.GetLockedUsers(new Callback()); 
public class Callback : App42Callback  
{  
	public void OnSuccess(Object response)  
	{  
		IList<User> user = (IList<User>) response;     
		for(int i = 0; i < user.Count; i++) 
		{
			Console.WriteLine("userName is " + user[i].GetUserName());
			Console.WriteLine("accountLocked is " + user.IsAccountLocked());
		}      
	}  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
}  
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService getLockedUsers:^(BOOL success, id responseObj, App42Exception *exception)
{
	if (success)
	{
		NSArray *usersArray = (NSArray*)responseObj;
		NSLog(@"usersArray=%@",usersArray);
		for (User *user in usersArray)
		{
			NSLog(@"UserName=%@",user.userName);
			NSLog(@"Email=%@",user.email);
			NSLog(@"Response=%@",[user toString]);
		}
	}
	else
	{
		NSLog(@"Exception = %@",[exception reason]);
		NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
		NSLog(@"App Error Code = %d",[exception appErrorCode]);
		NSLog(@"User Info = %@",[exception userInfo]);
	}
}];
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")     
let userService = App42API.buildUserService() as? UserService     
userService?.getLockedUsers({ (success, response, exception) -> Void in
	if(success)
	{
		let userList  = response as! NSArray
		for user in userList {
			NSLog("UserName is : %@", user.userName)
		}
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
ArrayList<User> user = userService.getLockedUsers(); 
for(int i = 0; i < user.size(); i++)   
{  
	System.out.println("userName is " + user.get(i).getUserName());  
	System.out.println("accountLocked is " + user.get(i).isAccountLocked());  
	System.out.println("emailId is " + user.get(i).getEmail());  
	System.out.println("First Name is " + user.get(i).getProfile().getFirstName());  
	System.out.println("Last Name is " + user.get(i).getProfile().getLastName()); 
}  
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.GetLockedUsers(new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		IList<User> user = (IList<User>) response;     
		for(int i = 0; i < user.Count; i++) 
		{
			App42Log.Console("userName is " + user[i].GetUserName());
			App42Log.Console("accountLocked is " + user[i].IsAccountLocked());
		}      
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
Not Available
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local userService  = App42API:buildUserService()
userService:getLockedUsers(App42CallBack)
function App42CallBack:onSuccess(object)
	for i=1,table.getn(object) do
		print("UserName is "..object[i]:getUserName())
		print(object[i]:getAccountLocked())
	end
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->GetLockedUsers(app42callback(Sample_Class::onUserRequestCompleted, this));

void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            printf("\n isAccountLocked=%d",it->isAccountLocked);
            //Fetching Profile Info
            printf("\n FirstName=%s",it->profile.firstName.c_str());
            printf("\n LastName=%s",it->profile.lastName.c_str());
            printf("\n Sex=%s",it->profile.getSex().c_str());
            printf("\n Date of Birth=%s",it->profile.dateOfBirth.c_str());
            printf("\n Line1=%s",it->profile.line1.c_str());
            printf("\n Line2=%s",it->profile.line2.c_str());
            printf("\n City=%s",it->profile.city.c_str());
            printf("\n State=%s",it->profile.state.c_str());
            printf("\n Pincode=%s",it->profile.pincode.c_str());
            printf("\n Country=%s",it->profile.country.c_str());
            printf("\n Mobile=%s",it->profile.mobile.c_str());
            printf("\n HomeLandLine=%s",it->profile.homeLandLine.c_str());
            printf("\n OfficeLandLine=%s",it->profile.officeLandLine.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
IList<User> user = userService.GetLockedUsers();    
for(int i = 0; i < user.Count; i++) 
{
	Console.WriteLine("userName is " + user[i].GetUserName());
	Console.WriteLine("accountLocked is " + user[i].IsAccountLocked());
}      
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$userResponse = $userService->getLockedUsers(); 
foreach($userResponse as $user )
{
	print_r("userName is " . $user->getUserName());
	print_r("emailId is " .  $user->getEmail());
	print_r("Account Locked is " . $user->isAccountLocked());
	$profile = $user->getProfile();
	print_r("firstName is " . $profile->getFirstName());
}
$jsonResponse = $userResponse[0]->toString();
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->GetLockedUsers(this,app42callfuncND_selector(Sample_Class::onUserRequestCompleted));

void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            printf("\n isAccountLocked=%d",it->isAccountLocked);
            //Fetching Profile Info
            printf("\n FirstName=%s",it->profile.firstName.c_str());
            printf("\n LastName=%s",it->profile.lastName.c_str());
            printf("\n Sex=%s",it->profile.getSex().c_str());
            printf("\n Date of Birth=%s",it->profile.dateOfBirth.c_str());
            printf("\n Line1=%s",it->profile.line1.c_str());
            printf("\n Line2=%s",it->profile.line2.c_str());
            printf("\n City=%s",it->profile.city.c_str());
            printf("\n State=%s",it->profile.state.c_str());
            printf("\n Pincode=%s",it->profile.pincode.c_str());
            printf("\n Country=%s",it->profile.country.c_str());
            printf("\n Mobile=%s",it->profile.mobile.c_str());
            printf("\n HomeLandLine=%s",it->profile.homeLandLine.c_str());
            printf("\n OfficeLandLine=%s",it->profile.officeLandLine.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
user_list = Array.new();
api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY")
user_service = api.build_user_service
user_list = user_service.get_locked_users(); 
for user in user_list do
  puts "userName is #{user.userName}";
  puts "email is #{user.email}";
end
jsonResponse = user_list.to_s(); 
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.getLockedUsers(new callback());  
public class callback implements App42CallBack  
{  
	public function onSuccess(response:Object):void  
	{  
		var array:Array = res as Array;
		for(var i:int = 0;i < array.length;i++){
			var user:User = User(array[i])
			trace("userName is : " + user.getUserName());
			trace("emailId is : " +  user.getEmail());
		}
	}  
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}  
}  
Coming Soon
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
Vector userList = userService.getLockedUsers(); 
for(int i=0;i < userList.size();i++)  
{ 
	User uset = (User)userList.elementAt(i);  
	System.out.println("userName is " + uset.getUserName());
	System.out.println("accountLocked is " + uset.isAccountLocked());
}           

Get Locked Users Count

Gets the count of all the locked users.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.getLockedUsersCount(new App42CallBack() {
public void onSuccess(Object response) 
{
	App42Response app42response = (App42Response)response;      
	System.out.println("Total Records : " + app42response.getTotalRecords());
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
}); 
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.GetLockedUsersCount(new Callback()); 
public class Callback : App42Callback  
{ 
	public void OnSuccess(Object response)  
	{  
		App42Response app42response = (App42Response) response;     
		Console.WriteLine("Total Records : " + app42response.GetTotalRecords());     
		String jsonResponse = app42response.ToString();  
	}   
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
}  
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService getLockedUsersCount:^(BOOL success, id responseObj, App42Exception *exception)
{
	if (success)
	{
		App42Response *response = (App42Response*)responseObj;
		NSLog(@"Response=%@",response.strResponse);
		NSLog(@"UsersCount is %d",response.totalRecords);
	}
	else
	{
		NSLog(@"Exception = %@",[exception reason]);
		NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
		NSLog(@"App Error Code = %d",[exception appErrorCode]);
		NSLog(@"User Info = %@",[exception userInfo]);
	}
}];                         
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")     
let userService = App42API.buildUserService() as? UserService    
userService?.getLockedUsersCount({ (success, response, exception) -> Void in
            
	if(success)
	{
		var app42Response = response as! App42Response
		NSLog("Response String is : %@", app42Response.strResponse)
		NSLog("Total Records is  : %d", app42Response.totalRecords)
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
App42Response app42response = userService.getLockedUsersCount(); 
System.out.println("Total Records : " + app42response.getTotalRecords());
boolean  success = app42response.isResponseSuccess();
String jsonResponse = app42response.toString(); 
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.GetLockedUsersCount(new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		App42Response app42response = (App42Response) response;     
		App42Log.Console("TotalRecords is : " + app42response.GetTotalRecords());  
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
Not Available
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local userService  = App42API:buildUserService()
userService:getLockedUsersCount(App42CallBack)
function App42CallBack:onSuccess(object)
	print("Total Record is "..object:getTotalRecords())
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->GetLockedUsersCount(app42callback(Sample_Class::onUserRequestCompleted, this));
void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {
        printf("\nTotalRecords=%d",userResponse->getTotalRecords());
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
App42Response response = userService.GetLockedUsersCount();   
Console.WriteLine("Total Records : " + response.GetTotalRecords());      
Boolean  success = response.IsResponseSuccess();
String jsonResponse = response.ToString(); 
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$response = $userService->getLockedUsersCount(); 
print_r("Total Records is " . $response->getTotalRecords());
$success = $response->isResponseSuccess();
$jsonResponse = $response->toString(); 
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->GetLockedUsersCount(this,app42callfuncND_selector(Sample_Class::onUserRequestCompleted));
void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {
        printf("\nTotalRecords=%d",userResponse->getTotalRecords());
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY")
user_service = api.build_user_service
response = user_service.get_locked_users_count(); 
success = response.is_response_success();  
total_records = response.totalRecords();  
jsonResponse = response.to_s(); 
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.getLockedUsersCount(new callback());  
public class callback implements App42CallBack  
{  
	public function onSuccess(response:Object):void  
	{  
		var app42Response:App42Response = App42Response(response);
		trace("Totalrecords is : " + app42Response.getTotalRecords());
	}  
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}  
}  
Coming Soon 
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
App42Response response = userService.getLockedUsersCount();
System.out.println("Total Records : " + response.getTotalRecords()); 
boolean  success = response.isResponseSuccess();
String jsonResponse = response.toString(); 

Get Locked Users Paging

Get all the locked users details by paging.

max - Maximum number of records to be fetched. offset - From where the records are to be fetched.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
int max = 1;
int offset = 0 ;
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.getLockedUsers(max,offset,new App42CallBack() {		
public void onSuccess(Object response) 
{
	ArrayList<User> user = (ArrayList<User>)response;
	for(int i = 0; i < user.size(); i++)   
	{  
		System.out.println("userName is " + user.get(i).getUserName());  
		System.out.println("accountLocked is " + user.get(i).isAccountLocked());  
	} 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});
int max = 1;
int offset = 0 ;
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.GetLockedUsers(max,offset,new Callback());  
public class Callback : App42Callback  
{ 
	public void OnSuccess(Object response)  
	{  
		IList<User> user = (IList<User>) response;     
		for(int i = 0; i < user.Count; i++) 
		{
			Console.WriteLine("userName is " + user[i].GetUserName());
			Console.WriteLine("accountLocked is " + user[i].IsAccountLocked());
		}      
	}  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
}  
int max = 1;
int offset = 0 ;
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService getLockedUsers:max offset:offset completionBlock:^(BOOL success, id responseObj, App42Exception *exception)
{
	if (success)
	{
		NSArray *usersArray = (NSArray*)responseObj;
		NSLog(@"usersArray=%@",usersArray);
		for (User *user in usersArray)
		{
			NSLog(@"UserName=%@",user.userName);
			NSLog(@"Email=%@",user.email);
			NSLog(@"Response=%@",[user toString]);
		}
	}
	else
	{
		NSLog(@"Exception = %@",[exception reason]);
		NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
		NSLog(@"App Error Code = %d",[exception appErrorCode]);
		NSLog(@"User Info = %@",[exception userInfo]);
	}
}];
let max:Int32 = 10
let offset:Int32 = 0
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")     
let userService = App42API.buildUserService() as? UserService     
userService?.getLockedUsers(max, offset: offset , completionBlock:{ (success, response, exception) -> Void in
	if(success)
	{
		let userList  = response as! NSArray
		for user in userList {
			NSLog("UserName is : %@", user.userName)
		}
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
int max = 1;
int offset = 0 ;
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
ArrayList<User> user = userService.getLockedUsers(max,offset);
for(int i = 0; i < user.size(); i++)   
{  
	System.out.println("userName is " + user.get(i).getUserName());  
	System.out.println("accountLocked is " + user.get(i).isAccountLocked()); 
} 
int max = 1;
int offset = 0 ;
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.GetLockedUsers(max,offset, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		IList<User> user = (IList<User>) response;     
		for(int i = 0; i < user.Count; i++) 
		{
			App42Log.Console("userName is " + user[i].GetUserName());
			App42Log.Console("accountLocked is " + user[i].IsAccountLocked());
		}      
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
Not Available
local max = 5
local offset = 0
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local userService  = App42API:buildUserService()
userService:getLockedUsersWithPaging(max,offset,App42CallBack)
function App42CallBack:onSuccess(object)
	for i=1,table.getn(object) do
		print("UserName is "..object[i]:getUserName())
		print(object[i]:getAccountLocked())
	end
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
int max = 1;
int offset = 0;
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->GetLockedUsers(max,offset,app42callback(Sample_Class::onUserRequestCompleted, this));

void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            printf("\n isAccountLocked=%d",it->isAccountLocked);
            //Fetching Profile Info
            printf("\n FirstName=%s",it->profile.firstName.c_str());
            printf("\n LastName=%s",it->profile.lastName.c_str());
            printf("\n Sex=%s",it->profile.getSex().c_str());
            printf("\n Date of Birth=%s",it->profile.dateOfBirth.c_str());
            printf("\n Line1=%s",it->profile.line1.c_str());
            printf("\n Line2=%s",it->profile.line2.c_str());
            printf("\n City=%s",it->profile.city.c_str());
            printf("\n State=%s",it->profile.state.c_str());
            printf("\n Pincode=%s",it->profile.pincode.c_str());
            printf("\n Country=%s",it->profile.country.c_str());
            printf("\n Mobile=%s",it->profile.mobile.c_str());
            printf("\n HomeLandLine=%s",it->profile.homeLandLine.c_str());
            printf("\n OfficeLandLine=%s",it->profile.officeLandLine.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
int max = 1;
int offset = 0 ;
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
IList<User> user = userService.GetLockedUsers(max,offset);    
for(int i = 0; i < user.Count; i++) 
{
	Console.WriteLine("userName is " + user[i].GetUserName());
	Console.WriteLine("accountLocked is " + user[i].IsAccountLocked());
}      
$max = 1;
$offset = 0 ;
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$userResponse = $userService->getLockedUsers(max,offset);    
foreach($userResponse as $user )
{
	print_r("userName is " . $user->getUserName());
	print_r("emailId is " .  $user->getEmail());
	print_r("Account Locked is " . $user->isAccountLocked());
	$profile = $user->getProfile();
	print_r("firstName is " . $profile->getFirstName());
}
$jsonResponse = $userResponse[0]->toString(); 
int max = 1;
int offset = 0;
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->GetLockedUsers(max,offset,this,app42callfuncND_selector(Sample_Class::onUserRequestCompleted));

void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            printf("\n isAccountLocked=%d",it->isAccountLocked);
            //Fetching Profile Info
            printf("\n FirstName=%s",it->profile.firstName.c_str());
            printf("\n LastName=%s",it->profile.lastName.c_str());
            printf("\n Sex=%s",it->profile.getSex().c_str());
            printf("\n Date of Birth=%s",it->profile.dateOfBirth.c_str());
            printf("\n Line1=%s",it->profile.line1.c_str());
            printf("\n Line2=%s",it->profile.line2.c_str());
            printf("\n City=%s",it->profile.city.c_str());
            printf("\n State=%s",it->profile.state.c_str());
            printf("\n Pincode=%s",it->profile.pincode.c_str());
            printf("\n Country=%s",it->profile.country.c_str());
            printf("\n Mobile=%s",it->profile.mobile.c_str());
            printf("\n HomeLandLine=%s",it->profile.homeLandLine.c_str());
            printf("\n OfficeLandLine=%s",it->profile.officeLandLine.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
max = 1;
offset = 0;	
user_list = Array.new();
api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY")
user_service = api.build_user_service
user_list = user_service.get_locked_users_by_paging(max, offset); 
for user in user_list do
  puts "userName is #{user.userName}";
  puts "email is #{user.email}";
  puts "firstName #{user.profile.firstName}";
end
jsonResponse = user_list.to_s(); 
var max:int = 1;
var offset:int = 0;
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.getLockedUsersWithPaging(max,offset,new callback());  
public class callback implements App42CallBack  
{  
	public function onSuccess(response:Object):void  
	{  
		var array:Array = res as Array;
		for(var i:int = 0;i < array.length;i++){
			var user:User = User(array[i])
			trace("userName is : " + user.getUserName());
			trace("emailId is : " +  user.getEmail());
		}
	}  
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}  
}  
Coming Soon
Integer max = new Integer(1);
Integer offset = new Integer(0);  
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
Vector userList = userService.getLockedUsers(max,offset); 
for(int i=0;i < userList.size();i++)  
{ 
	User user = (User)userList.elementAt(i);  
	System.out.println("userName is " + user.getUserName());
	System.out.println("accountLocked is " + user.isAccountLocked());
}           

Get User By Profile Data

Get the list of users based on profile data.

Required Parameters

profileData - Profile Data key/value for which Users need to be retrieved.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
User.Profile profileData = new User().new Profile();
profileData.setFirstName("Nick");
profileData.setLastName("Gill");
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.getUsersByProfileData(profileData,new App42CallBack() {
public void onSuccess(Object response) 
{
	ArrayList<User> user = (ArrayList<User>)response;
	for(int i = 0; i < user.size(); i++)   
	{ 
		System.out.println("userName is " + user.get(i).getUserName());  
		System.out.println("emailId is " + user.get(i).getEmail());  
		System.out.println("First Name is " + user.get(i).getProfile().getFirstName());  
		System.out.println("Last Name is " + user.get(i).getProfile().getLastName()); 
	}
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});   
Coming Soon
Profile *profileObj = [[Profile alloc]init];
profileObj.firstName = @"Nick";
profileObj.lastName = @"Gill";
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService getUsersByProfileData:profileObj completionBlock:^(BOOL success, id responseObj, App42Exception *exception) {
	if (success)
	{
		User *user = (User*)responseObj;
		NSLog(@"UserName=%@",user.userName);
		NSLog(@"Email=%@",user.email);
		NSLog(@"RollList=%@",user.roleList);
		NSLog(@"Response=%@",[user toString]);
	}
	else
	{
		NSLog(@"Exception = %@",[exception reason]);
		NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
		NSLog(@"App Error Code = %d",[exception appErrorCode]);
		NSLog(@"User Info = %@",[exception userInfo]);
	}
}];
let profile:Profile = Profile();
profile.firstName = "Nick"
userService?.getUsersByProfileData(profile, completionBlock: { (success, response, exception) -> Void in

    if(success)
    {
        let list = response as! NSArray
        for user in list {
            NSLog("%@", user.userName)
        }
    }
    else
    {
        NSLog("%@", exception.reason!)
        NSLog("%d", exception.appErrorCode)
        NSLog("%d", exception.httpErrorCode)
        NSLog("%@", exception.userInfo!)
    }
})
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
User.Profile profileData = new User().new Profile();
profileData.setFirstName("Nick");
profileData.setLastName("Gill");
ArrayList<User> user = userService.getUsersByProfileData(profileData); 
for(int i = 0; i < user.size(); i++)   
{ 
	System.out.println("userName is " + user.get(i).getUserName());  
	System.out.println("emailId is " + user.get(i).getEmail());  
	System.out.println("First Name is " + user.get(i).getProfile().getFirstName());  
	System.out.println("Last Name is " + user.get(i).getProfile().getLastName()); 
}
String jsonResponse = user.get(0).toString();    
User.Profile profileData = new User.Profile();
profileData.SetFirstName("Nick");  
profileData.SetLastName("Gill");  
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.GetUsersByProfileData(profileData, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		IList<User> user = (IList<User>) response;     
		for(int i = 0; i < user.Count; i++) 
		{
			App42Log.Console("userName is " + user[i].GetUserName());
			App42Log.Console("emailId is " + user[i].GetEmail());
		}      
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
Not Available
Not Available
App42UserProfile userProfile;
userProfile.firstName = "Nick";
userProfile.lastName = "Gill";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->GetUsersByProfileData(&userProfile, app42callback(Sample_Class::onUserRequestCompleted, this));
void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            printf("\n isAccountLocked=%d",it->isAccountLocked);
            //Fetching Profile Info
            printf("\n FirstName=%s",it->profile.firstName.c_str());
            printf("\n LastName=%s",it->profile.lastName.c_str());
            printf("\n Sex=%s",it->profile.getSex().c_str());
            printf("\n Date of Birth=%s",it->profile.dateOfBirth.c_str());
            printf("\n Line1=%s",it->profile.line1.c_str());
            printf("\n Line2=%s",it->profile.line2.c_str());
            printf("\n City=%s",it->profile.city.c_str());
            printf("\n State=%s",it->profile.state.c_str());
            printf("\n Pincode=%s",it->profile.pincode.c_str());
            printf("\n Country=%s",it->profile.country.c_str());
            printf("\n Mobile=%s",it->profile.mobile.c_str());
            printf("\n HomeLandLine=%s",it->profile.homeLandLine.c_str());
            printf("\n OfficeLandLine=%s",it->profile.officeLandLine.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
String userName = "Nick";						
String pwd = "********";
String emailId = "nick@shephertz.co.in";
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
User user = userService.CreateUser(userName, pwd, emailId);			
User.Profile profileData = new User.Profile(user);
profileData.SetFirstName("Nick");
profileData.SetLastName("Gill");
IList<User> user = userService.GetUsersByProfileData(profileData); 
Console.WriteLine("userName is " + user[0].GetUserName());
Console.WriteLine("emailId is " + user[0].GetEmail());
String jsonResponse = user[0].ToString();         
$userName = "Nick";						
$pwd = "********";
$emailId = "nick@shephertz.co.in";
$createUser = $userService->createUser($userName, $pwd, $emailId);					
$profileData = new Profile($createUser);
$profileData->setFirstName("Nick");
$profileData->setLastName("Gill");
$userService->createOrUpdateProfile($createUser);
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$userResonse = $userService->getUsersByProfileData($profileData); 
foreach($userResonse as $user )
{
	print_r("userName is " . $user->getUserName());
	print_r("emailId is " .  $user->getEmail());
	print_r("Account Locked is " . $user->isAccountLocked());
	$profile = $user->getProfile();
	print_r("firstName is " . $profile->getFirstName());
}
$jsonResponse = $userResonse[0]->toString(); 
App42UserProfile userProfile;
userProfile.firstName = "Nick";
userProfile.lastName = "Gill";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->GetUsersByProfileData(&userProfile, this, app42callfuncND_selector(Sample_Class::onUserRequestCompleted));
void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            printf("\n isAccountLocked=%d",it->isAccountLocked);
            //Fetching Profile Info
            printf("\n FirstName=%s",it->profile.firstName.c_str());
            printf("\n LastName=%s",it->profile.lastName.c_str());
            printf("\n Sex=%s",it->profile.getSex().c_str());
            printf("\n Date of Birth=%s",it->profile.dateOfBirth.c_str());
            printf("\n Line1=%s",it->profile.line1.c_str());
            printf("\n Line2=%s",it->profile.line2.c_str());
            printf("\n City=%s",it->profile.city.c_str());
            printf("\n State=%s",it->profile.state.c_str());
            printf("\n Pincode=%s",it->profile.pincode.c_str());
            printf("\n Country=%s",it->profile.country.c_str());
            printf("\n Mobile=%s",it->profile.mobile.c_str());
            printf("\n HomeLandLine=%s",it->profile.homeLandLine.c_str());
            printf("\n OfficeLandLine=%s",it->profile.officeLandLine.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
userName = "Nick";						
pwd = "********";
emailId = "nick@shephertz.com";
profileData = App42::User::User::Profile.new();
profileData.firstName = "Nick";
profileData.lastName = "Gill";
api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY")
user_service = api.build_user_service
user_list = user_service.get_user_by_profile_data(profileData); 
for user in user_list do
  puts "UserName is #{user.userName}";
  puts "EmailId is #{user.email}";
end
jsonResponse = user_list.to_s(); 
Coming Soon
Coming Soon
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
User.Profile profileData = new User().new Profile();
profileData.setFirstName("Nick");
profileData.setLastName("Gill");
Vector user = userService.getUsersByProfileData(profileData); 
System.out.println("userName is " + ((User)user.elementAt(0)).getUserName());
System.out.println("emailId is " + ((User)user.elementAt(0)).getEmail());
String jsonResponse = ((User)user.elementAt(0)).toString();    

Reset User Password

Reset User password and send email with password inside.

Required Parameters

userName - Username for whom password has to be reset.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String userName = "Nick";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.resetUserPassword(userName,new App42CallBack() {
public void onSuccess(Object response) 
{
	App42Response app42response = (App42Response)response;      
	System.out.println("response is " + app42response) ;  
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});
String userName = "Nick"; 
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.ResetUserPassword(userName, new Callback());
public class Callback : App42Callback  
{ 	
	public void OnSuccess(Object response)  
	{  
		App42Response app42response = (App42Response) response;     
		String jsonResponse = app42response.ToString();  
	}  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
}  
NSString *userName = @"Nick"; 
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService resetUserPassword:userNa1me completionBlock:^(BOOL success, id responseObj, App42Exception *exception) {
	if (success)
	{
		App42Response *response = (App42Response*)responseObj;
		NSLog(@"Response is %@",response.strResponse);
	}
	else
	{
		NSLog(@"Exception = %@",[exception reason]);
		NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
		NSLog(@"App Error Code = %d",[exception appErrorCode]);
		NSLog(@"User Info = %@",[exception userInfo]);
	}
}];                          
let userName = "Nick"; 
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")     
let userService = App42API.buildUserService() as? UserService     
userService?.resetUserPassword(userName , completionBlock: { (success, response, exception) -> Void in
	
	if(success)
	{
		let app42Response = response as! App42Response
		NSLog("Response success is : %@", app42Response.isResponseSuccess)
		NSLog("Response String is %@", app42Response.strResponse)
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String userName = "Nick";
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
App42Response app42response = userService.resetUserPassword(userName); 
System.out.println("response is " + app42response) ;  
boolean  success = app42response.isResponseSuccess();
String jsonResponse = app42response.toString(); 
String userName = "Nick";
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.ResetUserPassword(userName,new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		var app42Response:App42Response = App42Response(response);
		App42Log.Console("app42Response is : " + app42Response);
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var userName = "Nick"; 
var result ;  
App42.initialize("API_KEY","SECRET_KEY");
var userService  = new App42User();
userService.resetUserPassword(userName,{  
success: function(object) 
	{  
		var userObj = JSON.parse(object);  
		result = userObj.app42.response.users.user;
		console.log("userName is " + result.userName)
	},  
	error: function(error) {
	}  
});   
local userName  = "Nick"
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local userService  = App42API:buildUserService()
userService:resetUserPassword(userName,App42CallBack)
function App42CallBack:onSuccess(object)
	print(object:getResponseSuccess())
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* userName = "Nick";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
user->ResetUserPassword(userName, app42callback(Sample_Class::onUserRequestCompleted, this));

void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
String userName = "Nick";
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
App42Response response = userService.ResetUserPassword(userName); 
Boolean  success = response.IsResponseSuccess();
String jsonResponse = response.ToString(); 
$userName = "Nick";
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$response = $userService->resetUserPassword($userName); 
print_r("Response is : ".$response->toString());
$success = $response->isResponseSuccess();
$jsonResponse = $response->toString(); 
const char* userName = "Nick";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
user->ResetUserPassword(userName, this, app42callfuncND_selector(Sample_Class::onUserRequestCompleted));

void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
Coming Soon
var userName:String = "Nick";
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.resetAppUserPassword(userName,new callback());  
public class callback implements App42CallBack  
{  
	public function onSuccess(response:Object):void  
	{  
		var app42Response:App42Response = App42Response(response); 
		trace("response is : "+ app42Response); 
	} 
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}   
} 
Coming Soon 
String userName = "Nick";
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
App42Response response = userService.resetUserPassword(userName); 
boolean  success = response.isResponseSuccess();
String jsonResponse = response.toString(); 

Revoke Role

Revoke the specified role from the user.

Required Parameters

userName - Username whose role has to be revoked. role - Role that has to be revoked.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String userName = "Nick";
String role   = "Admin";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.revokeRole(userName, role,new App42CallBack() {	
public void onSuccess(Object response) 
{
	App42Response app42response = (App42Response)response;      
	System.out.println("response is " + app42response) ;  
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});
String userName = "Nick"; 
String role   = "Admin";
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.RevokeRole(userName,role, new Callback()); 
public class Callback : App42Callback  
{  
	public void OnSuccess(Object response)  
	{  
		App42Response app42response = (App42Response) response;     
		String jsonResponse = app42response.ToString();  
	}  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
}  
NSString *userName = @"Nick"; 
NSString *role = @"Admin"; 
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService revokeRole:userName role:role completionBlock:^(BOOL success, id responseObj, App42Exception *exception) {
	if (success)
	{
		App42Response *response = (App42Response*)responseObj;
		NSLog(@"Response is %@",response.strResponse);
	}
	else
	{
		NSLog(@"Exception = %@",[exception reason]);
		NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
		NSLog(@"App Error Code = %d",[exception appErrorCode]);
		NSLog(@"User Info = %@",[exception userInfo]);
	}
}];           
let userName = "Nick";
let role = "Admin" 
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")     
let userService = App42API.buildUserService() as? UserService    
userService?.revokeRole(userName, role:role, completionBlock: { (success, response, exception) -> Void in
	
	if(success)
	{
		let app42Response = response as! App42Response
		NSLog("Response success is : %@", app42Response.isResponseSuccess)
		NSLog("Response String is %@", app42Response.strResponse)
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String userName = "Nick";
String role   = "Admin";
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
App42Response app42response = userService.revokeRole(userName, role); 
System.out.println("response is " + app42response) ;  
boolean  success = app42response.isResponseSuccess();
String jsonResponse = app42response.toString(); 
String userName = "Nick";
String role   = "Admin";
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.RevokeRole(userName, role,new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		App42Response app42response = (App42Response) response;     
		String jsonResponse = app42response.ToString();  
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var userName = "Nick";
var role = "Admin";
var result;
App42.initialize("API_KEY", "SECRET_KEY");
var userService = new App42User();
userService.revokeRole(userName, role, {
	success: function (object) {
		var userObj = JSON.parse(object);
		result = userObj.app42.response.users.user;
		console.log("userName is " + result.userName)
		console.log("role is " + result.role)
	},
	error: function (error) {
	}
});
Not Available 
const char* userName = "Nick";
const char* role = "Admin";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->RevokeRole(userName, role, app42callback(Sample_Class::onUserRequestCompleted, this));
void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d ",userResponse->getCode());
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {
        printf("\nTotalRecords=%d",userResponse->getTotalRecords());
        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            //Fetching Roles
            std::vector<string>::iterator iit;
            for(iit=it->roleList.begin(); iit!=it->roleList.end(); ++iit)
            {
                printf("\n%s",iit->c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
String userName = "Nick";
String role   = "Admin";
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
App42Response response = userService.RevokeRole(userName, role); 
Boolean  success = response.IsResponseSuccess();
String jsonResponse = response.ToString(); 
$userName = "Nick";
$role   = "Admin";
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$response = $userService->revokeRole($userName, $role); 
print_r("Response is :  ".$response->toString());
$success = $response->isResponseSuccess();
$jsonResponse = $response->toString(); 
const char* userName = "Nick";
const char* role = "Admin";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->RevokeRole(userName, role, this, app42callfuncND_selector(Sample_Class::onUserRequestCompleted));
void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d ",userResponse->getCode());
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {
        printf("\nTotalRecords=%d",userResponse->getTotalRecords());
        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            //Fetching Roles
            std::vector<string>::iterator iit;
            for(iit=it->roleList.begin(); iit!=it->roleList.end(); ++iit)
            {
                printf("\n%s",iit->c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
userName = "Nick";
role = "admin";	
api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY")
user_service = api.build_user_service
response = user_service.revoke_role(userName,role); 
success = response.is_response_success();
jsonResponse = response.to_s();
var userName:String = "Nick";
var role:String  = "Admin";
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.revokeRole(userName,role,new callback());  
public class callback implements App42CallBack  
{ 
	public function onSuccess(response:Object):void  
	{  
		var app42Response:App42Response = App42Response(response); 
		trace("response is : "+ app42Response); 
	}   
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}  
}  
Coming Soon 
String userName = "Nick";
String role   = "Admin";
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
App42Response response = userService.revokeRole(userName, role); 
boolean  success = response.isResponseSuccess();
String jsonResponse = response.toString(); 

Revoke All Roles

Revokes all the roles from the user.

Required Parameters

userName - Name of the user from whom Roles have to be revoked.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String userName = "Nick";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.revokeAllRoles(userName, new App42CallBack() {				
public void onSuccess(Object response) 
{
	App42Response app42response = (App42Response)response;      
	System.out.println("response is " + app42response) ;  
}
public void onException(Exception ex)
{
	System.out.println("Exception Message"+ex.getMessage());
}
});
String userName = "Nick"; 
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.RevokeAllRoles(userName, new Callback());  
public class Callback : App42Callback  
{ 
	public void OnSuccess(Object response)  
	{  
		App42Response app42response = (App42Response) response;     
		String jsonResponse = app42response.ToString();  
	}  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
}  
NSString *userName = @"Nick"; 
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService revokeAllRoles:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) {
	if (success)
	{
		App42Response *response = (App42Response*)responseObj;
		NSLog(@"Response=%@",response.strResponse);
	}
	else
	{
		NSLog(@"Exception = %@",[exception reason]);
		NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
		NSLog(@"App Error Code = %d",[exception appErrorCode]);
		NSLog(@"User Info = %@",[exception userInfo]);
	}
}];                                   
let userName = "Nick";
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")     
let userService = App42API.buildUserService() as? UserService    
userService?.revokeAllRoles(userName, completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let app42Response = response as! App42Response
		NSLog("Response success is : %@", app42Response.isResponseSuccess)
		NSLog("Response String is %@", app42Response.strResponse)
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String userName = "Nick";
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
App42Response app42response = userService.revokeAllRoles(userName); 
System.out.println("response is " + app42response) ; 
boolean  success = app42response.isResponseSuccess();
String jsonResponse = app42response.toString(); 
String userName = "Nick";
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.RevokeAllRoles(userName,new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		App42Response app42response = (App42Response) response;     
		String jsonResponse = app42response.ToString(); 
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var userName = "Nick";
var result;
App42.initialize("API_KEY", "SECRET_KEY");
var userService = new App42User();
userService.revokeAllRoles(userName, {
	success: function (object) {
		var userObj = JSON.parse(object);
		result = userObj.app42.response.users.user;
		console.log("userName is " + result.userName)
		console.log("roles : " + result.role)
	},
	error: function (error) {
	}
});
Not Available 
const char* userName = "Nick";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->RevokeAllRoles(userName, app42callback(Sample_Class::onUserRequestCompleted, this));
void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d ",userResponse->getCode());
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {
        printf("\nTotalRecords=%d",userResponse->getTotalRecords());
        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            //Fetching Roles
            std::vector<string>::iterator iit;
            for(iit=it->roleList.begin(); iit!=it->roleList.end(); ++iit)
            {
                printf("\n%s",iit->c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
String userName = "Nick";
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
App42Response response = userService.RevokeAllRoles(userName); 
Boolean  success = response.IsResponseSuccess();
String jsonResponse = response.ToString(); 
$userName = "Nick";
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$response = $userService->revokeAllRoles($userName); 
print_r("Response is :  ".$response->toString());
$success = $response->isResponseSuccess();
$jsonResponse = $response->toString(); 
const char* userName = "Nick";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->RevokeAllRoles(userName, this, app42callfuncND_selector(Sample_Class::onUserRequestCompleted));
void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d ",userResponse->getCode());
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {
        printf("\nTotalRecords=%d",userResponse->getTotalRecords());
        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            //Fetching Roles
            std::vector<string>::iterator iit;
            for(iit=it->roleList.begin(); iit!=it->roleList.end(); ++iit)
            {
                printf("\n%s",iit->c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
userName = "Nick";
api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY")
user_service = api.build_user_service
response = user_service.revoke_all_roles(userName); 
success = response.is_response_success();
jsonResponse = response.to_s(); 
var userName:String = "Nick";
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.revokeAllRoles(userName,new callback());  
public class callback implements App42CallBack  
{  
	public function onSuccess(response:Object):void  
	{  
		var app42Response:App42Response = App42Response(response); 
		trace("response is : "+ app42Response); 
	}  
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}  
}  
Coming Soon 
String userName = "Nick";
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
App42Response response = userService.revokeAllRoles(userName); 
boolean  success = response.isResponseSuccess();
String jsonResponse = response.toString(); 

Update Email

Updates the User based on username. Note: Only email can be updated. Username cannot be updated.

Required Parameters

userName - Username whose email ID has to updated. emailId - New email ID for the user to change.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String userName = "Nick";
String emailId = "nick@shephertz.com";   
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.updateEmail(userName, emailId,new App42CallBack() {
public void onSuccess(Object response) 
{
	User user = (User)response;
	System.out.println("userName is " + user.getUserName());  
	System.out.println("Emailid is:"+user.getEmail());
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});   
String userName = "Nick"; 
String emailId = "nick@shephertz.com";
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.UpdateEmail(userName,emailId, new Callback());  
public class Callback : App42Callback  
{  
	public void OnSuccess(Object response)  
	{  
		User user = (User) response;     
		Console.WriteLine("userName is " + user.GetUserName());
		Console.WriteLine("emailId is " + user.GetEmail());
	}  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
}  
NSString *userName = @"Nick";
NSString *emailId = @"nick@shephertz.com";
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService updateEmail:userName emailAddress:emailId completionBlock:^(BOOL success, id responseObj, App42Exception *exception)
{
	if (success)
	{
		User *user = (User*)responseObj;
		NSLog(@"Response is %@",user.strResponse);
		NSLog(@"User Name is %@",user.userName);
		NSLog(@"Email is %@",user.email);
	}
	else
	{
		NSLog(@"Exception = %@",[exception reason]);
		NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
		NSLog(@"App Error Code = %d",[exception appErrorCode]);
		NSLog(@"User Info = %@",[exception userInfo]);
	}
}]; 
let userName = "Nick"
let emailId = "nick@shephertz.co.in"
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")     
let userService = App42API.buildUserService() as? UserService     
userService?.updateEmail(userName, emailAddress:emailId, { (success, response, exception) -> Void in
	if(success)
	{
		let user = response as! User
		NSLog("userName is %@", user.userName)
		NSLog("Email id is %@", user.email)
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	})
}
String userName = "Nick";
String emailId = "nick@shephertz.com";
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
User user = userService.updateEmail(userName, emailId); 
System.out.println("userName is " + user.getUserName());  
System.out.println("Emailid is:"+user.getEmail());
String jsonResponse = user.toString();    
String userName = "Nick";
String emailId = "nick@shephertz.com";
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.UpdateEmail(userName, emailId,new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		User user = (User) response;     
		App42Log.Console("userName is " + user.GetUserName());
		App42Log.Console("emailId is " + user.GetEmail());
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
Not Available
local userName  = "Nick"
local emailId = "nick@shephertz.com"
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local userService  = App42API:buildUserService()
userService:updateEmail(userName, emailId,App42CallBack)
function App42CallBack:onSuccess(object)
	print("UserName is "..object:getUserName())
	print("Email id is "..object:getEmail())
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* userName = "Nick";
const char* emailId = "nick@shephertz.com";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->UpdateEmail(userName,emailId, app42callback(Sample_Class::onUserRequestCompleted, this));

void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
String userName = "Nick";
String emailId = "nick@shephertz.com";
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
User user = userService.UpdateEmail(userName, emailId); 
Console.WriteLine("userName is " + user.GetUserName());
String jsonResponse = user.ToString();         
$userName = "Nick";
$emailId = "nick@shephertz.com"'
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$user = $userService->updateEmail($userName, $emailId); 
print_r("userName is : " . $user->getUserName());
print_r("Email Id is :" . $user->getEmail());
$jsonResponse = $user->toString(); 
const char* userName = "Nick";
const char* emailId = "nick@shephertz.com";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->UpdateEmail(userName,emailId, this, app42callfuncND_selector(Sample_Class::onUserRequestCompleted));

void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
userName = "Nick";	
email_id = "nick@shephertz.com";	
api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY")
user_service = api.build_user_service
user = user_service.update_email(userName, email_id); 
puts "userName is #{user.userName}";
puts "email is #{user.email}";
jsonResponse = user.to_s(); 
var userName:String = "Nick";
var emailId:String  = "nick@shephertz.com";
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.updateEmail(userName,emailId,new callback()); 
public class callback implements App42CallBack  
{  
	public function onSuccess(response:Object):void  
	{  
		var user:User = User(response);     
		trace("userName is " + user.getUserName());
		trace("emailId is " + user.getEmail()); 
	}   
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);
	}  
}  
Coming Soon 
String userName = "Nick";
String emailId = "nick@shephertz.com";
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
User user = userService.updateEmail(userName, emailId); 
System.out.println("userName is " + user.getUserName());
String jsonResponse = user.toString();    

Delete User

Delete a particular user based on username. Note: From this method, you can only soft delete the user. If you want to delete the user permanently, you can do so in two ways 1. Delete from AppHQ console management. 2. Set the “deletePermanent” flag true in otherMetaHeaders. See <Delete User Permanent> .

Required Parameters

userName - Username that you want to delete.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String userName = "Nick";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.deleteUser(userName,new App42CallBack() {		
public void onSuccess(Object response) 
{
	App42Response app42response = (App42Response)response;      
	System.out.println("response is " + app42response) ;  
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message " + ex.getMessage());
}
}); 
String userName = "Nick"; 
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.DeleteUser(userName, new Callback());  
public class Callback : App42Callback  
{ 
	public void OnSuccess(Object response)  
	{  
		App42Response app42response = (App42Response) response;     
		String jsonResponse = app42response.ToString();  
	}  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
}  
NSString *userName = @"Nick"; 
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService deleteUser:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) {
if (success)
{
	App42Response *response = (App42Response*)responseObj;
	NSLog(@"Response is %@",response.strResponse);
}
else
{
	NSLog(@"Exception = %@",[exception reason]);
	NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
	NSLog(@"App Error Code = %d",[exception appErrorCode]);
	NSLog(@"User Info = %@",[exception userInfo]);
}
}];                             
let userName = "Nick";
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")     
let userService = App42API.buildUserService() as? UserService     
userService?.deleteUser(userName, completionBlock: { (success, response, exception) -> Void in
	
	if(success)
	{
		let app42Response = response as! App42Response
		NSLog("Response success is : %@", app42Response.isResponseSuccess)
		NSLog("Response String is %@", app42Response.strResponse)
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String userName = "Nick";
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
App42Response app42response = userService.deleteUser(userName);
System.out.println("response is " + app42response) ;   
boolean  success = app42response.isResponseSuccess();
String jsonResponse = app42response.toString(); 
String userName = "Nick";
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.DeleteUser(userName,new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		App42Response app42response = (App42Response) response;    
		App42Log.Console("response is " + app42response) 
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var userName = "Nick"; 
var result ;  
App42.initialize("API_KEY","SECRET_KEY");
var userService  = new App42User();
userService.deleteUser(userName,{  
	success: function(object) 
	{  
		var userObj = JSON.parse(object);  
		result = userObj.app42.response.users.user;
		console.log("userName is " + result.userName)
	},  
	error: function(error) {  
	}  
});   
local userName  = "Nick"
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local userService  = App42API:buildUserService()
userService:deleteUser(userName,App42CallBack)
function App42CallBack:onSuccess(object)
	print(object:getResponseSuccess())
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* userName = "Nick";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->DeleteUser(userName, app42callback(Sample_Class::onUserRequestCompleted, this));

void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
String userName = "Nick";
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
App42Response response = userService.DeleteUser(userName); 
Boolean  success = response.IsResponseSuccess();
String jsonResponse = response.ToString(); 
$userName = "Nick";
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$response = $userService->deleteUser($userName); 
print_r("Response is :  ".$response->toString());
$success = $response->isResponseSuccess();
$jsonResponse = $response->toString(); 
const char* userName = "Nick";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->DeleteUser(userName, this, app42callfuncND_selector(Sample_Class::onUserRequestCompleted));

void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
userName = "Nick";
api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY")
user_service = api.build_user_service
response = user_service.delete_user(userName); 
success = response.is_response_success();
jsonResponse = response.to_s(); 
var userName:String = "Nick";
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.deleteUser(userName,new callback()); 
public class callback implements App42CallBack  
{  
	public function onSuccess(response:Object):void  
	{  
		var app42response :App42Response is  App42Response(response);    
		trace("response is " + app42response) 
	}   
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}  
}  
Coming Soon 
String userName = "Nick";
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
App42Response response = userService.deleteUser(userName); 
boolean  success = response.isResponseSuccess();
String jsonResponse = response.toString(); 

Logout

Invalidate the session of user based on session ID.

Required Parameters

sessionId - SessionID of the user who you want to logout.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String sessionId = "<Enter_the_session_id>";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.logout(sessionId,new App42CallBack() {
public void onSuccess(Object response)
{
	App42Response app42response = (App42Response)response;      
	System.out.println("response is " + app42response) ;  
}
public void onException(Exception ex)
{
	System.out.println("Exception Message " + ex.getMessage());
}
});
String sessionId = "<Enter_the_session_id>"; 
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.Logout(sessionId, new Callback());  
public class Callback : App42Callback  
{	
	public void OnSuccess(Object response)  
	{  
		App42Response app42response = (App42Response) response;     
		String jsonResponse = app42response.ToString();  
	}   
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  

}  
NSString *sessionId = @"<Enter_the_session_id>";
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService logout:sessionId completionBlock:^(BOOL success, id responseObj, App42Exception *exception) {
	if (success)
	{
		App42Response *response = (App42Response*)responseObj;
		NSLog(@"Response=%@",response.strResponse);
	}
	else
	{
		NSLog(@"Exception = %@",[exception reason]);
		NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
		NSLog(@"App Error Code = %d",[exception appErrorCode]);
		NSLog(@"User Info = %@",[exception userInfo]);
	}
}];
let userName = "Nick";
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")     
let userService = App42API.buildUserService() as? UserService     
userService?.logout(userName, completionBlock: { (success, response, exception) -> Void in
	
	if(success)
	{
		let app42Response = response as! App42Response
		NSLog("Response success is : %@", app42Response.isResponseSuccess)
		NSLog("Response String is %@", app42Response.strResponse)
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String sessionId = "<Enter_the_session_id>";
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
App42Response app42response = userService.logout(sessionId); 
System.out.println("response is " + app42response) ; 
boolean  success = app42response.isResponseSuccess();
String jsonResponse = app42response.toString(); 
String sessionId = "<Enter_the_session_id>";
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.logout(sessionId,new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		App42Response app42response = (App42Response) response;     
		String jsonResponse = app42response.ToString();  
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var sessionId = "<Enter_the_session_id>"; 
var result ;  
App42.initialize("API_KEY","SECRET_KEY");
var userService  = new App42User();
userService.logout(sessionId,{  
	success: function(object) 
	{  
		var userObj = JSON.parse(object);  
		result = userObj.app42.response.users.user;
		console.log("userName is " + result.userName)
	},  
	error: function(error) {  
	}  
});   
local sessionId = "<Enter_the_session_id>"
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local userService  = App42API:buildUserService()
userService:logout(sessionId,App42CallBack)
function App42CallBack:onSuccess(object)
	print(object:getResponseSuccess())
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* sessionId = "78724aea-3c8d-43a0-98d9-84df215ba510";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->Logout(sessionId, app42callback(Sample_Class::onUserRequestCompleted, this));
void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    { }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
String sessionId = "<Enter_the_session_id>";
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
App42Response response = userService.Logout(sessionId); 
Boolean  success = response.IsResponseSuccess();
String jsonResponse = response.ToString(); 
$sessionId = "<Enter_the_session_id>";
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$response = $userService->logout($sessionId); 
print_r("Response is :  ".$response->toString());
$success = $response->isResponseSuccess();
$jsonResponse = $response->toString();
const char* sessionId = "78724aea-3c8d-43a0-98d9-84df215ba510";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->Logout(sessionId, this, app42callfuncND_selector(Sample_Class::onUserRequestCompleted));
void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    { }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
Coming Soon
var sessionId:String = "<Enter_the_session_id>";
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.logout(sessionId,new callback()); 
public class callback implements App42CallBack  
{  
	public function onSuccess(response:Object):void  
	{  
		var app42response :App42Response is  App42Response(response);    
		trace("response is " + app42response) 
	}   
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}  
}  
Coming Soon 
String sessionId = "<Enter_the_session_id>";
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
App42Response response = userService.logout(sessionId); 
boolean  success = response.isResponseSuccess();
String jsonResponse = response.toString(); 

Delete User Permanent

Delete a particular user based on username. Note: This will delete your user permanently.

Required Parameters

userName - Username that you want to delete.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String userName = "Nick";
HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
otherMetaHeaders.put("deletePermanent", "true");
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.setOtherMetaHeaders(otherMetaHeaders);
userService.deleteUser(userName,new App42CallBack() {		
public void onSuccess(Object response) 
{
	App42Response app42response = (App42Response)response;      
	System.out.println("response is " + app42response) ;  
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message " + ex.getMessage());
}
}); 
String userName = "Nick"; 
Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>();
otherMetaHeaders.Add("deletePermanent", "true");
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.SetOtherMetaHeaders(otherMetaHeaders);
userService.DeleteUser(userName, new Callback());  
public class Callback : App42Callback  
{ 
	public void OnSuccess(Object response)  
	{  
		App42Response app42response = (App42Response) response;     
		String jsonResponse = app42response.ToString();  
	}  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
} 
NSString *userName = @"Nick"; 
NSMutableDictionary *otherMetaHeaders = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"true",@"deletePermanent", nil];
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService setOtherMetaHeaders:otherMetaHeaders];
[userService deleteUser:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) {
if (success)
{
	App42Response *response = (App42Response*)responseObj;
	NSLog(@"Response is %@",response.strResponse);
}
else
{
	NSLog(@"Exception = %@",[exception reason]);
	NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
	NSLog(@"App Error Code = %d",[exception appErrorCode]);
	NSLog(@"User Info = %@",[exception userInfo]);
}
}];                                               
let userName = "Nick";
let otherMeta = NSMutableDictionary()
otherMeta.setObject("true", forKey:"deletePermanent")
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")     
let userService = App42API.buildUserService() as? UserService     
userService?.otherMetaHeaders = otherMeta
userService?.deleteUser(userName, completionBlock: { (success, response, exception) -> Void in
	
	if(success)
	{
		let app42Response = response as! App42Response
		NSLog("isResponseSuccess : %@", app42Response.isResponseSuccess)
		NSLog("Response String is %@", app42Response.strResponse)
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String userName = "Nick";
HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
otherMetaHeaders.put("deletePermanent", "true");
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.setOtherMetaHeaders(otherMetaHeaders);
App42Response app42response = userService.deleteUser(userName);
System.out.println("response is " + app42response) ;   
boolean  success = app42response.isResponseSuccess();
String jsonResponse = app42response.toString(); 
String userName = "Nick";
App42Log.SetDebug(true);		//Print output in your editor console
Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>();
otherMetaHeaders.Add("deletePermanent", "true");
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.SetOtherMetaHeaders(otherMetaHeaders);
userService.DeleteUser(userName,new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		App42Response app42response = (App42Response) response;    
		App42Log.Console("response is " + app42response) 
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var userName = "Nick"; 
var result ;  
var otherMetaHeaders = {"deletePermanent":"true"};                               
App42.initialize("API_KEY","SECRET_KEY");
var userService  = new App42User();
userService.setOtherMetaHeaders(otherMetaHeaders);
userService.deleteUser(userName,{  
	success: function(object) 
	{  
		var userObj = JSON.parse(object);  
		result = userObj.app42.response.users.user;
		console.log("userName is " + result.userName)
	},  
	error: function(error) {  
	}  
});   
local userName  = "Nick"
local App42CallBack = {}
local otherMetaHeaders = {};
otherMetaHeaders.deletePermanent= "true";
App42API:initialize("API_KEY","SECRET_KEY")
local userService  = App42API:buildUserService()
userService:setOtherMetaHeaders(otherMetaHeaders);
userService:deleteUser(userName,App42CallBack)
function App42CallBack:onSuccess(object)
	print(object:getResponseSuccess())
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* userName = "Nick";
map<string,string>otherMetaHeaders;
otherMetaHeaders["deletePermanent"] = "true";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->setOtherMetaHeaders(otherMetaHeaders);
userService->DeleteUser(userName, app42callback(Sample_Class::onUserRequestCompleted, this));
void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
String userName = "Nick";
Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>();
otherMetaHeaders.Add("deletePermanent", "true");
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
userService.SetOtherMetaHeaders(otherMetaHeaders);
App42Response response = userService.DeleteUser(userName); 
Boolean  success = response.IsResponseSuccess();
String jsonResponse = response.ToString();
$userName = "Nick";
$pwd   = "*******";
$otherMetaHeaders = array();
$otherMetaHeaders['deletePermanent'] ="true";
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$userService->setOtherMetaHeaders($otherMetaHeaders);
$response = $userService->deleteUser($userName); 
print_r("Response is :  ".$response->toString());
$success = $response->isResponseSuccess();
$jsonResponse = $response->toString(); 
const char* userName = "Nick";
map<string,string>otherMetaHeaders;
otherMetaHeaders["deletePermanent"] = "true";
userService->setOtherMetaHeaders(otherMetaHeaders);
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->DeleteUser(userName, this, app42callfuncND_selector(Sample_Class::onUserRequestCompleted));
void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
Coming Soon
var userName:String = "Nick";
var otherMetaHeaders:Dictionary = new Dictionary();
otherMetaHeaders["deletePermanent"] = "true";
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.setOtherMetaHeaders(otherMetaHeaders);
userService.deleteUser(userName,new callback()); 
public class callback implements App42CallBack  
{  
	public function onSuccess(response:Object):void  
	{  
		var app42response :App42Response is  App42Response(response);    
		trace("response is " + app42response) 
	}   
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}  
}  
Coming Soon 
String userName = "Nick";
HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
otherMetaHeaders.put("deletePermanent", "true");
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.setOtherMetaHeaders(otherMetaHeaders);
App42Response response = userService.deleteUser(userName); 
boolean  success = response.isResponseSuccess();
String jsonResponse = response.toString(); 

Authenticate With Email

Authenticate user based on Email ID and password.

Required Parameters

emailId - Email ID of the user. pwd - Password that was entered when the user created their profile.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String emailId = "nick@shephertz.co.in";   
String pwd = "********";  
HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
otherMetaHeaders.put("emailAuth", "true");
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.setOtherMetaHeaders(otherMetaHeaders); 
userService.authenticate(emailId , pwd, new App42CallBack() {
public void onSuccess(Object response)
{
	User user = (User)response;
	System.out.println("userName is " + user.getUserName());  
	System.out.println("sessionId is " + user.getSessionId());  
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message : "+ex.getMessage());
}
});
String emailId = "nick@shephertz.co.in";   
String pwd  = "*****";
Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>();
otherMetaHeaders.Add("emailAuth", "true");
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.SetOtherMetaHeaders(otherMetaHeaders);
userService.Authenticate(emailId,pwd, new Callback()); 
public class Callback : App42Callback  
{  
	public void OnSuccess(Object response)  
	{  
		User user = (User) response;     
		Console.WriteLine("userName is : " + user.GetUserName());
		Console.WriteLine("sessionId is : " + user.GetSessionId());
	} 
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  	
}  
NSString *emailId = @"nick@shephertz.co.in";
NSString *pwd = @"********";
NSMutableDictionary *otherMetaHeaders = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"true",@"emailAuth", nil];
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService setOtherMetaHeaders:otherMetaHeaders];
[userService authenticateUser:userName password:pwd completionBlock:^(BOOL success, id responseObj, App42Exception *exception)
{
	if (success)
	{
		User *user = (User*)responseObj;
		NSLog(@"userName is %@" , user.userName);
		NSLog(@"sessionId is %@" ,  user.sessionId);
	}
	else
	{
		NSLog(@"Exception is %@",[exception reason]);
		NSLog(@"HTTP error Code is %d",[exception httpErrorCode]);
		NSLog(@"App Error Code is %d",[exception appErrorCode]);
		NSLog(@"User Info is %@",[exception userInfo]);
	}
}];
let emailId = "nick@shephertz.co.in";
let pwd = "******"
let otherMeta = NSMutableDictionary()
otherMeta.setObject("true", forKey:"emailAuth")
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")     
let userService = App42API.buildUserService() as? UserService    
userService?.otherMetaHeaders = otherMeta
userService?.authenticateUser(emailId, password:pwd, completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let user = response as! User
		NSLog("%@", user.userName)
		NSLog("%@", user.sessionId)
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String emailId = "nick@shephertz.co.in"; 
String pwd = "********";   
HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
otherMetaHeaders.put("emailAuth", "true");
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.setOtherMetaHeaders(otherMetaHeaders); 
User user = userService.authenticate(emailId, pwd); 
System.out.println("userName is " + user.getUserName());  
System.out.println("sessionId is " + user.getSessionId());  
String emailId = "nick@shephertz.co.in"; 
String pwd = "********";
App42Log.SetDebug(true);		//Print output in your editor console
Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>();
otherMetaHeaders.Add("emailAuth", "true");
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.SetOtherMetaHeaders(otherMetaHeaders);
userService.Authenticate(emailId, pwd,new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		User user = (User) response;     
		App42Log.Console("userName is " + user.GetUserName());
		App42Log.Console("sessionId is " + user.GetSessionId());
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var emailId = "nick@shephertz.co.in"; 
var pwd = "*********";  
var result ;  
var otherMetaHeaders = {"emailAuth":"true"};                               
App42.initialize("API_KEY","SECRET_KEY");
var userService  = new App42User();
userService.setOtherMetaHeaders(otherMetaHeaders); 
userService.authenticate(emailId, pwd,{  
	success: function(object) 
	{  
		var userObj = JSON.parse(object);  
		result = userObj.app42.response.users.user;
		console.log("userName is " + result.userName)
		console.log("sessionId is " + result.sessionId)
	},  
	error: function(error) {
	}  
}); 
local emailId = "nick@shephertz.co.in"; 
local pwd = "********"
local App42CallBack = {}
local otherMetaHeaders = {};
otherMetaHeaders.emailAuth= "true";
App42API:initialize("API_KEY","SECRET_KEY")
local userService  = App42API:buildUserService()
userService:setOtherMetaHeaders(otherMetaHeaders);
userService:authenticate(emailId,pwd,App42CallBack)
function App42CallBack:onSuccess(object)
	print("userName is "..object:getUserName())
	print("session id is "..object:getSessionId())
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* pwd = "*******";
const char* emailId = "nick@shephertz.com";  
map<string,string>otherMetaHeaders;
otherMetaHeaders["emailAuth"] = "true";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->setOtherMetaHeaders(otherMetaHeaders);  
userService->Authenticate(emailId, pwd, app42callback(Sample_Class::onUserRequestCompleted, this));

void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            printf("\n SessionId=%s",it->sessionId.c_str());
            printf("\n isAccountLocked=%d",it->isAccountLocked);
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
String emailId = "nick@shephertz.co.in"; 
String pwd = "********";
Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>();
otherMetaHeaders.Add("emailAuth", "true");
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
userService.SetOtherMetaHeaders(otherMetaHeaders);
User user = userService.Authenticate(emailId, pwd); 
Console.WriteLine("userName is " + user.GetUserName());
Console.WriteLine("sessionId is " + user.GetSessionId());
String jsonResponse = user.ToString();         
$emailId = "nick@shephertz.co.in"; 
$pwd = "********";
$otherMetaHeaders = array();
$otherMetaHeaders['emailAuth'] ="true";
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$userService->setOtherMetaHeaders($otherMetaHeaders);
$user = $userService->authenticate($emailId, $pwd); 
print_r("userName is " . $user->getUserName());
print_r("sessionId is " . $user->getSessionId());
$jsonResponse = $user->toString(); 
const char* pwd = "*******";
const char* emailId = "nick@shephertz.com";  
map<string,string>otherMetaHeaders;
otherMetaHeaders["emailAuth"] = "true";
userService->setOtherMetaHeaders(otherMetaHeaders);  
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->Authenticate(emailId, pwd, this, app42callfuncND_selector(Sample_Class::onUserRequestCompleted));

void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            printf("\n SessionId=%s",it->sessionId.c_str());
            printf("\n isAccountLocked=%d",it->isAccountLocked);
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
Coming Soon
var emailId:String = "nick@shephertz.co.in";   
var pwd:String  = "*****";
var otherMetaHeaders:Dictionary = new Dictionary();
otherMetaHeaders["emailAuth"] = "true";
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.setOtherMetaHeaders(otherMetaHeaders);
userService.authenticate(emailId,pwd, new callback());  
public class callback implements App42CallBack  
{  
	public function onSuccess(response:Object):void  
	{  
		var user:User = User(response);
		trace("userName is " + user.getUserName());
		trace("sessionId is " + user.getSessionId());
	}  
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}  
}
Coming Soon 
String emailId = "nick@shephertz.co.in"; 
String pwd = "********";   
HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
otherMetaHeaders.put("emailAuth", "true");
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.setOtherMetaHeaders(otherMetaHeaders); 
User user = userService.authenticate(emailId, pwd); 
System.out.println("userName is " + user.getUserName());
System.out.println("sessionId is " + user.getSessionId());

Saving Additional Data along with User

Save additional data of user while creating a new user. One can fetch this saved information back by getting user. See <Fetch Additional data of User> .

Required Parameters

collectionName - Name of collection under which JSON doc needs to be saved. jsonDoc - Target JSON document to be saved.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String userName = "Nick";
String pwd = "********";
String emailId = "nick@shephertz.co.in";
String dbName = "<Your_DataBase_Name>"; 
String collectionName = "<Your_Collection_Name>"; 
JSONObject jsonDoc = new JSONObject();
jsonDoc.put("name","John");
jsonDoc.put("age",20); 
App42API.setDbName(dbName);  
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.addJSONObject( collectionName, jsonDoc);
userService.createUser( userName, pwd, emailId, new App42CallBack() {
public void onSuccess(Object response) 
{
	User user = (User)response;
	System.out.println("userName is " + user.getUserName());
	System.out.println("emailId is " + user.getEmail());
	for(int i=0;i<user.getJsonDocList().size();i++)
	{
		System.out.println("updated at = "+ user.getJsonDocList().get(i).getUpdatedAt());
		System.out.println("created at = "+ user.getJsonDocList().get(i).getCreatedAt());
		System.out.println("doc id is = "+ user.getJsonDocList().get(i).getDocId());
		System.out.println("json doc  is = "+ user.getJsonDocList().get(i).getJsonDoc());	
	}
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});   
String userName = "Nick";   
String pwd  = "********";
String emailId = "nick@shephertz.co.in";
String dbName = "<Your_DataBase_Name>"; 
String collectionName = "<Your_Collection_Name>"; 
JObject jsonDoc = new JObject();
jsonDoc.Add("name","John");
jsonDoc.Add("age",20);
App42API.SetDbName(dbName);  
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.AddJSONObject(collectionName, jsonDoc);
userService.CreateUser(userName,pwd,emailId, new Callback());  
public class Callback : App42Callback  
{  	
	public void OnSuccess(Object response)  
	{  
		User user = (User) response;
		Console.WriteLine("userName is " + user.GetUserName());
		Console.WriteLine("emailId is " + user.GetEmail());   
		for(int i=0; i<user.GetJsonDocList().Count; i++)
		{
			Console.WriteLine("updated at = "+ user.GetJsonDocList()[i].GetUpdatedAt());
			Console.WriteLine("created at = "+ user.GetJsonDocList()[i].GetCreatedAt());
			Console.WriteLine("doc id is = "+ user.GetJsonDocList()[i].GetDocId());
			Console.WriteLine("json doc  is = "+ user.GetJsonDocList()[i].GetJsonDoc());	
		}			
		String jsonResponse = user.ToString();  
	}  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
}
NSString *userName = @"Nick";
NSString *password = @"*******";
NSString *email = @"nick@shephertz.co.in";
NSString *dbName = @"<Your_DataBase_Name>";
NSString *collectionName = @"<Your_Collection_Name>";
NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:@"John",@"name",@"20",@"age", nil];
[App42API setDbName:dbName];
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService addUserInfo:userInfo  collectionName:collectionName completionBlock:^(BOOL success, id responseObj, App42Exception *exception)
{
	NSLog(@"Exception = %@",[exception reason]);
}];
[userService createUser:userName password:password emailAddress:email completionBlock:^(BOOL success, id responseObj, App42Exception *exception)
{
	if (success)
	{
		User *user = (User*)responseObj;
		NSLog(@"Response=%@",user.strResponse);
		NSLog(@"User Name=%@",user.userName);
		NSLog(@"Email = %@",user.email);
		NSLog(@"SessionId = %@",user.sessionId);
		for (JSONDocument *doc in user.jsonDocArray)
		{
			NSLog(@"CreatedAt=%@",doc.createdAt);
			NSLog(@"UpdatedAt=%@",doc.updatedAt);
			NSLog(@"DocId=%@",doc.docId);
			NSLog(@"Doc=%@",doc.jsonDoc);
		}
	}
	else
	{
		NSLog(@"Exception = %@",[exception reason]);
		NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
		NSLog(@"App Error Code = %d",[exception appErrorCode]);
		NSLog(@"User Info = %@",[exception userInfo]);
	}
}];
let userName = "Nick";   
let pwd  = "*****";
let emailId = "nick@shephertz.co.in";
let dbName = "<Your_DataBase_Name>";
let collectionName = "<Your_Collection_Name>"; 
App42API.setDbName(dbName);
let userInfo = NSDictionary(object:"John",forKey:"name")
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")     
let userService = App42API.buildUserService() as? UserService   
userService?.addUserInfo(userInfo as [NSObject : AnyObject],collectionName:collectionName,  completionBlock: { (success, response, exception) -> Void in
})

userService?.createUser(userName, password: password, emailAddress:emailAddress, completionBlock: { (success, response, exception) -> Void in
    if(success)
    {
        let user = response as! User
        NSLog("%@", user.userName)
        NSLog("%@", user.email)
        NSLog("%@", user.sessionId)
    }
    else
    {
        NSLog("%@", exception.reason!)
        NSLog("%d", exception.appErrorCode)
        NSLog("%d", exception.httpErrorCode)
        NSLog("%@", exception.userInfo!)
    }
})
String userName = "Nick";
String pwd = "********";
String emailId = "nick@shephertz.co.in";
String dbName = "<Your_DataBase_Name>"; 
String collectionName = "<Your_Collection_Name>"; 
JSONObject jsonDoc = new JSONObject();
jsonDoc.put("name","John");
jsonDoc.put("age",20); 
App42API.setDbName(dbName);  
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.addJSONObject( collectionName, jsonDoc);    
User user = userService.createUser(userName, pwd, emailId); 
System.out.println("userName is " + user.getUserName());
System.out.println("emailId is " + user.getEmail());
for(int i=0;i<user.getJsonDocList().size();i++)
{
	System.out.println("updated at = "+ user.getJsonDocList().get(i).getUpdatedAt());
	System.out.println("created at = "+ user.getJsonDocList().get(i).getCreatedAt());
	System.out.println("doc id is = "+ user.getJsonDocList().get(i).getDocId());
	System.out.println("json doc  is = "+ user.getJsonDocList().get(i).getJsonDoc());	
}
String jsonResponse = user.toString();  
String userName = "Nick";
String pwd = "********";
String emailId = "nick@shephertz.co.in";
String dbName = "<Your_DataBase_Name>"; 
String collectionName = "<Your_Collection_Name>"; 
Dictionary<string, object> jsonDoc = new Dictionary<string, object> ();
jsonDoc.Add("name","John");
jsonDoc.Add("age",20);
App42API.SetDbName(dbName);  
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.AddJSONObject(collectionName, jsonDoc);    
App42Log.SetDebug(true);		//Print output in your editor console
userService.CreateUser(userName, pwd, emailId, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		User user = (User) response;
		App42Log.Console("userName is " + user.GetUserName());
		App42Log.Console("emailId is " + user.GetEmail());
		for(int i=0; i<user.GetJsonDocList().Count; i++)
		{
			App42Log.Console("updated at = "+ user.GetJsonDocList()[i].GetUpdatedAt());
			App42Log.Console("created at = "+ user.GetJsonDocList()[i].GetCreatedAt());
			App42Log.Console("doc id is = "+ user.GetJsonDocList()[i].GetDocId());
			App42Log.Console("json doc  is = "+ user.GetJsonDocList()[i].GetJsonDoc());	
		}		
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var userName = "Nick";  
var pwd = "*********";  
var emailId = "nick@shephertz.co.in";  
var result ;
var dbName = "<Your_DataBase_Name>";
var collectionName = "<Your_Collection_Name>";
var jsonDoc = new Object();
jsonDoc.name = "Nick";
jsonDoc.type = "30";
App42.setDbName(dbName);            
App42.initialize("API_KEY","SECRET_KEY");
var userService  = new App42User();
userService.addJSONObject(collectionName,jsonDoc);
userService.createUser(userName, pwd, emailId,{  
	success: function(object) 
	{  
		var userObj = JSON.parse(object);  
		result = userObj.app42.response.users.user;
		console.log("userName is " + result.userName)
		console.log("emailId is " + result.email)		
		console.log("Created At : "+result.jsonDoc._$createdAt)
		console.log("Updated At : "+result.jsonDoc._$updatedAt);
		console.log("Doc Id is : "+result.jsonDoc._id.$oid);
		console.log("Owner is : "+result.jsonDoc._$owner.owner);		
	},  
	error: function(error) {  
	}  
}); 
local userName  = "Nick"
local pwd = "********"
local emailId = "nick@shephertz.co.in"
local dbName = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>" 
local jsonDoc = {}
jsonDoc.name =  "John"
jsonDoc.age = 20
local App42CallBack = {}
App42API:setDbName(dbName);
App42API:initialize("API_KEY","SECRET_KEY")
local userService  = App42API:buildUserService()
userService:addJSONObject( collectionName, jsonDoc);
userService:createUser(userName,pwd,emailId,App42CallBack)
function App42CallBack:onSuccess(object)
	print("userName is "..object:getUserName())
	print("emailId is "..object:getEmail())
	print("getDocId is "..object:getJsonDocList():getDocId())
	print("getCreatedAt  is "..object:getJsonDocList():getCreatedAt());  
	print("getUpdatedAt is "..object:getJsonDocList():getUpdatedAt());  
	print("Doclist Name is "..JSON:encode(object:getJsonDocList():getJsonDoc()));
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* userName = "Nick";
const char* pwd = "*******";
const char* emailId = "nick@shephertz.co.in";
App42Object* app42Object = new App42Object();
app42Object->setObject("name", "John");
app42Object->setObject("age", "20");
const char* dbName = "<Enter_the_dbName>";
const char* collectionName = "<Your_Collection_Name>";
App42API::setDbName(dbName);
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->AddUserInfo(object, collectionName);
userService->CreateUser(userName, pwd, emailId,app42callback(Sample_Class::onUserRequestCompleted, this));
void TestUserService::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d",userResponse->getCode());
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());

            std::vector<JSONDocument>::iterator jsonDoc;
            for(jsonDoc=it->jsonDocArray.begin(); jsonDoc!=it->jsonDocArray.end(); ++jsonDoc)
            {
                printf("\n CreatedAt=%s",jsonDoc->getCreatedAt().c_str());
                printf("\n DocId=%s",jsonDoc->getDocId().c_str());
                printf("\n Event=%s",jsonDoc->getEvent().c_str());
                printf("\n Owner=%s",jsonDoc->getOwner().c_str());
                printf("\n UpdatedAt=%s",jsonDoc->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",jsonDoc->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
String userName = "Nick";
String pwd = "********";
String emailId = "nick@shephertz.co.in";
String dbName = "<Your_DataBase_Name>"; 
String collectionName = "<Your_Collection_Name>"; 
Dictionary<string, object> jsonDoc = new Dictionary<string, object> ();
jsonDoc.Add("name","John");
jsonDoc.Add("age",20);
App42API.SetDbName(dbName);  
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
userService.AddJSONObject(collectionName, jsonDoc);    
User user = userService.CreateUser(userName, pwd, emailId); 
Console.WriteLine("userName is " + user.GetUserName());
Console.WriteLine("emailId is " + user.GetEmail());
for(int i=0; i<user.GetJsonDocList().Count; i++)
{
	Console.WriteLine("updated at = "+ user.GetJsonDocList()[i].GetUpdatedAt());
	Console.WriteLine("created at = "+ user.GetJsonDocList()[i].GetCreatedAt());
	Console.WriteLine("doc id is = "+ user.GetJsonDocList()[i].GetDocId());
	Console.WriteLine("json doc  is = "+ user.GetJsonDocList()[i].GetJsonDoc());	
}			
String jsonResponse = user.ToString();       
$userName = "Nick";
$pwd = "********";
$emailId = "nick@shephertz.co.in";
$dbName = "<Your_DataBase_Name>";
$collectionName = "<Your_Collection_Name>"; 
App42API::setDbName($dbName);
$jsonDoc = new JSONObject();
$jsonDoc->put("name", "John");      
$jsonDoc->put("age", 20);      
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$userService->addJSONObject( $collectionName, $jsonDoc);
$user = $userService->createUser($userName, $pwd, $emailId); 
print_r("userName is " . $user->getUserName());
print_r("emailId is " . $user->getEmail());
$jsonDocList = $user->getJsonDocList();
foreach( $jsonDocList as $jsonDoc )
{
	print_r("docId is : " . $jsonDoc->getDocId().PHP_EOL);
	print_r("jsonDocs is : " . $jsonDoc->getJsonDoc().PHP_EOL);
	print_r("updated at is : " . $jsonDoc->getUpdatedAt().PHP_EOL);
	print_r("created At is : " . $jsonDoc->getCreatedAt().PHP_EOL);
	print_r("Owner is : " . $jsonDoc->getOwner().PHP_EOL);
}
$jsonResponse = $user->toString(); 
const char* userName = "Nick";
const char* pwd = "*******";
const char* emailId = "nick@shephertz.co.in";
App42Object* app42Object = new App42Object();
app42Object->setObject("name", "John");
app42Object->setObject("age", "20");
const char* dbName = "<Enter_the_dbName>";
const char* collectionName = "<Your_Collection_Name>";
App42API::setDbName(dbName);
userService->AddUserInfo(object, collectionName);
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->CreateUser(userName, pwd, emailId,this,app42callfuncND_selector(TestUserService::onUserRequestCompleted));
void TestUserService::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d",userResponse->getCode());
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());

            std::vector<JSONDocument>::iterator jsonDoc;
            for(jsonDoc=it->jsonDocArray.begin(); jsonDoc!=it->jsonDocArray.end(); ++jsonDoc)
            {
                printf("\n CreatedAt=%s",jsonDoc->getCreatedAt().c_str());
                printf("\n DocId=%s",jsonDoc->getDocId().c_str());
                printf("\n Event=%s",jsonDoc->getEvent().c_str());
                printf("\n Owner=%s",jsonDoc->getOwner().c_str());
                printf("\n UpdatedAt=%s",jsonDoc->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",jsonDoc->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
Coming Soon
var userName:String = "Nick";   
var pwd:String  = "*****";
var emailId:String = "nick@shephertz.co.in";
var dbName:String = "<Your_DataBase_Name>";
var collectionName:String = "<Your_Collection_Name>"; 
var jsonDoc:Object = new Object;
jsonDoc.name = "John";
jsonDoc.age = 30;
App42API.setDbName(dbName);
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.addJSONObject( collectionName, jsonDoc);
userService.createUser(userName,pwd,emailId, new callback());  
public class callback implements App42CallBack  
{  
	public function onSuccess(response:Object):void  
	{  
		var user:User = User(response); 
		var jsonDoc:JSONDocument = new JSONDocument(); 
		trace("userName is " + user.getUserName());
		trace("emailId is " + user.getEmail());
		var jsonDocsList:Array = user.getJsonDocList();
		for(var t:int=0; t < jsonDocsList.length;t++)
		{
			jsonDoc = JSONDocument(jsonDocsList[t]);
			trace("Doc ID is in get user : : "+ jsonDoc.getDocId());
			trace("CreatedAt is : " + jsonDoc.getCreatedAt());
			trace("UpdatedAt is :  " + jsonDoc.getUpdatedAt());
			trace("JsonDoc is :  " + jsonDoc.getJsonDoc());		
		}
	}  
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}  
}  
Coming Soon 
String userName = "Nick";
String pwd = "********";
String emailId = "nick@shephertz.co.in";
String dbName = "<Your_DataBase_Name>"; 
String collectionName = "<Your_Collection_Name>"; 
JSONObject jsonDoc = new JSONObject();
jsonDoc.put("name","John");
jsonDoc.put("age",20); 
App42API.setDbName(dbName);  
userService.addJSONObject( collectionName, jsonDoc);    
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
User user = userService.createUser(userName, pwd, emailId); 
System.out.println("userName is " + user.getUserName());
System.out.println("emailId is " + user.getEmail());
for(int i=0;i<user.getJsonDocList().size();i++)
{
	User.JSONDocument jsonDocument = (User.JSONDocument)user.getJsonDocList().elementAt(i);
	System.out.println("updated at = "+ jsonDocument.getUpdatedAt());
	System.out.println("created at = "+ jsonDocument.getCreatedAt());
	System.out.println("doc id is = "+ jsonDocument.getDocId());
	System.out.println("json doc  is = "+ jsonDocument.getJsonDoc());	
}
String jsonResponse = user.toString(); 

Fetch Additional data of User

Fetches additional data of user in JSON format. One can pass query object while fetching desired records of user. Null value of query object will return all records of user in given collection.

Required Parameters

userName - Name of the user whose data is to be retrieved.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String userName = "Nick"; 
String key1 = "name";   
String value1 = "John";
Query query = QueryBuilder.build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to John
App42API.setDbName("<Enter_the_dbName>");
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.setQuery("<Your_Collection_Name>", query);
userService.getUser(userName, new App42CallBack() {
public void onSuccess(Object response) 
{
	User user = (User)response;
	System.out.println("userName is " + user.getUserName());
	System.out.println("emailId is " + user.getEmail());
	for(int i=0;i<user.getJsonDocList().size();i++)
	{
		System.out.println("updated at = "+ user.getJsonDocList().get(i).getUpdatedAt());
		System.out.println("created at = "+ user.getJsonDocList().get(i).getCreatedAt());
		System.out.println("doc id is = "+ user.getJsonDocList().get(i).getDocId());
		System.out.println("json doc  is = "+ user.getJsonDocList().get(i).getJsonDoc());	
	}
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
}); 
String userName = "Nick"; 
String key1 = "name";   
String value1 = "John";
Query query = QueryBuilder.Build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to John
App42API.SetDbName("<Enter_the_dbName>");
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.SetQuery("<Your_Collection_Name>", query);  
userService.GetUser(userName, new Callback());  
public class Callback : App42Callback  
{  	
	public void OnSuccess(Object response)  
	{  
		User user = (User) response;
		Console.WriteLine("userName is " + user.GetUserName());
		Console.WriteLine("emailId is " + user.GetEmail());   
		for(int i=0; i<user.GetJsonDocList().Count; i++)
		{
			Console.WriteLine("updated at = "+ user.GetJsonDocList()[i].GetUpdatedAt());
			Console.WriteLine("created at = "+ user.GetJsonDocList()[i].GetCreatedAt());
			Console.WriteLine("doc id is = "+ user.GetJsonDocList()[i].GetDocId());
			Console.WriteLine("json doc  is = "+ user.GetJsonDocList()[i].GetJsonDoc());	
		}			
		String jsonResponse = user.ToString();  
	}  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
}
NSString *userName = @"Nick";
NSString *key = @"name";
NSString *value = @"John";

NSString *dbName = @"<Your_DataBase_Name>";
NSString *collectionName = @"<Your_Collection_Name>";

Query *query = [QueryBuilder buildQueryWithKey:key value:value andOperator:APP42_OP_EQUALS];

[App42API setDbName:dbName];
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService setQuery:collectionName metaInfoQuery:query];
[userService getUser:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) {
	if (success)
	{
		User *user = (User*)responseObj;
		NSLog(@"UserName=%@",user.userName);
		NSLog(@"Email=%@",user.email);
		for (JSONDocument *doc in user.jsonDocArray)
		{
			NSLog(@"CreatedAt=%@",doc.createdAt);
			NSLog(@"UpdatedAt=%@",doc.updatedAt);
			NSLog(@"DocId=%@",doc.docId);
			NSLog(@"Doc=%@",doc.jsonDoc);
		}
	}
	else
	{
		NSLog(@"Exception = %@",[exception reason]);
		NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
		NSLog(@"App Error Code = %d",[exception appErrorCode]);
		NSLog(@"User Info = %@",[exception userInfo]);
	}
}];
let userName = "Nick";
let dbName = "<Enter_the_dbName>";
let collectionName = "<Your_Collection_Name>";
App42API.setDbName(dbName);
let key = "name"
let value = "Nick"
let query = QueryBuilder.buildQueryWithKey(key, value:value,andOperator:APP42_OP_EQUALS);
userService?.setQuery(collectionName, metaInfoQuery: query)
userService?.getUser(userName, completionBlock: { (success, response, exception) -> Void in

    if(success)
    {
        let user = response as! User
        NSLog("%@", user.userName)
        NSLog("%@", user.email)
    }
    else
    {
        NSLog("%@", exception.reason!)
        NSLog("%d", exception.appErrorCode)
        NSLog("%d", exception.httpErrorCode)
        NSLog("%@", exception.userInfo!)
    }
})
String userName = "Nick";  
String key1 = "name";   
String value1 = "John";
Query query = QueryBuilder.build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to John
App42API.setDbName("<Enter_the_dbName>");
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.setQuery("<Your_Collection_Name>", query); 
User user = userService.getUser(userName); 
User user = userService.createUser(userName, pwd, emailId); 
System.out.println("userName is " + user.getUserName());
System.out.println("emailId is " + user.getEmail());
for(int i=0;i<user.getJsonDocList().size();i++)
{
	System.out.println("updated at = "+ user.getJsonDocList().get(i).getUpdatedAt());
	System.out.println("created at = "+ user.getJsonDocList().get(i).getCreatedAt());
	System.out.println("doc id is = "+ user.getJsonDocList().get(i).getDocId());
	System.out.println("json doc  is = "+ user.getJsonDocList().get(i).getJsonDoc());	
}
String userName = "Nick";   
String key1 = "name";   
String value1 = "John";
Query query = QueryBuilder.Build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to John
App42API.SetDbName("<Enter_the_dbName>");
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.SetQuery("<Your_Collection_Name>", query);   
App42Log.SetDebug(true);		//Print output in your editor console
userService.GetUser(userName,new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		User user = (User) response;
		App42Log.Console("userName is " + user.GetUserName());
		App42Log.Console("emailId is " + user.GetEmail());
		for(int i=0; i<user.GetJsonDocList().Count; i++)
		{
			App42Log.Console("updated at = "+ user.GetJsonDocList()[i].GetUpdatedAt());
			App42Log.Console("created at = "+ user.GetJsonDocList()[i].GetCreatedAt());
			App42Log.Console("doc id is = "+ user.GetJsonDocList()[i].GetDocId());
			App42Log.Console("json doc  is = "+ user.GetJsonDocList()[i].GetJsonDoc());	
		}		
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var userName = "Nick";   
var key1 = "name";
var value1 = "John";
var dbName = "<Enter_the_dbName>";
var collectionName = "<Your_Collection_Name>";
var result;
App42.initialize("API_KEY","SECRET_KEY");
var queryBuilder = new QueryBuilder();
var query = queryBuilder.build(key1, value1, Operator.EQUALS);           
App42.setDbName(dbName);
var userService = new App42User();
userService.setQuery(collectionName, query);
userService.getUser(userName, {
	success: function (object) {
			var userObj = JSON.parse(object);
			result = userObj.app42.response.users.user;
			console.log("UserName : " + result.userName);
			console.log("Email : " + result.email);
			var jsonDoc = result.jsonDoc;
			console.log("Meta Info : " , jsonDoc);
	},
	error: function (error1) {
		console.log(error1)
	}
}); 
local userName  = "Nick"
local key1 = "name"   
local value1 = "John"
local query = queryBuilder:build(key1, value1, Operator.EQUALS)  
App42API:setDbName("<Enter_the_dbName>");
App42API:initialize("API_KEY","SECRET_KEY")
local userService  = App42API:buildUserService()
userService:setQuery("<Your_Collection_Name>",query);
local App42CallBack = {}
userService:getUser(userName,App42CallBack)
function App42CallBack:onSuccess(object)
	print("userName is "..object:getUserName())
	print("emailId is "..object:getEmail())
	print("getDocId is "..object:getJsonDocList():getDocId())
	print("getCreatedAt  is "..object:getJsonDocList():getCreatedAt());  
	print("getUpdatedAt is "..object:getJsonDocList():getUpdatedAt());  
	print("Doclist Name is "..JSON:encode(object:getJsonDocList():getJsonDoc()));
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* userName = "Nick";
const char* key = "name";
const char* value = "John";
Query* query = QueryBuilder::BuildQuery(key, value, APP42_OP_EQUALS);
const char* dbName = "<Enter_the_dbName>";
const char* collectionName = "<Your_Collection_Name>";
App42API::setDbName(dbName);
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->setQuery(collectionName, query);
userService->GetUser(userName, app42callback(Sample_Class::onUserRequestCompleted, this));
void TestUserService::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d",userResponse->getCode());
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());

            std::vector<JSONDocument>::iterator jsonDoc;
            for(jsonDoc=it->jsonDocArray.begin(); jsonDoc!=it->jsonDocArray.end(); ++jsonDoc)
            {
                printf("\n CreatedAt=%s",jsonDoc->getCreatedAt().c_str());
                printf("\n DocId=%s",jsonDoc->getDocId().c_str());
                printf("\n Event=%s",jsonDoc->getEvent().c_str());
                printf("\n Owner=%s",jsonDoc->getOwner().c_str());
                printf("\n UpdatedAt=%s",jsonDoc->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",jsonDoc->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
String userName = "Nick"; 
String key1 = "name";   
String value1 = "John";
Query query = QueryBuilder.Build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to John
App42API.SetDbName("<Enter_the_dbName>");
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
userService.SetQuery("<Your_Collection_Name>", query);   
User user = userService.GetUser(userName); 
Console.WriteLine("userName is " + user.GetUserName());
Console.WriteLine("emailId is " + user.GetEmail());
for(int i=0; i<user.GetJsonDocList().Count; i++)
{
	Console.WriteLine("updated at = "+ user.GetJsonDocList()[i].GetUpdatedAt());
	Console.WriteLine("created at = "+ user.GetJsonDocList()[i].GetCreatedAt());
	Console.WriteLine("doc id is = "+ user.GetJsonDocList()[i].GetDocId());
	Console.WriteLine("json doc  is = "+ user.GetJsonDocList()[i].GetJsonDoc());	
}			
String jsonResponse = user.ToString(); 
$userName = "Nick"; 
$key1 = "name";   
$value1 = "John";
$queryBuilder = new QueryBuilder();
App42API::setDbName("<Enter_the_dbName>");
$query = $queryBuilder->build($key1, $value1, Operator::EQUALS);  // Build query q1 for key1 equal to name and value1 equal to John
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$userService->setQuery("<Your_Collection_Name>", $query);
$user = $userService->getUser($userName); 
print_r("userName is " . $user->getUserName());
print_r("emailId is " . $user->getEmail());
$jsonDocList = $user->getJsonDocList();
foreach( $jsonDocList as $jsonDoc )
{
	print_r("docId is : " . $jsonDoc->getDocId().PHP_EOL);
	print_r("jsonDocs is : " . $jsonDoc->getJsonDoc().PHP_EOL);
	print_r("updated at is : " . $jsonDoc->getUpdatedAt().PHP_EOL);
	print_r("created At is : " . $jsonDoc->getCreatedAt().PHP_EOL);
	print_r("Owner is : " . $jsonDoc->getOwner().PHP_EOL);
}
$jsonResponse = $user->toString(); 
const char* userName = "Nick";
const char* key = "name";
const char* value = "John";
Query* query = QueryBuilder::BuildQuery(key, value, APP42_OP_EQUALS);
const char* dbName = "<Enter_the_dbName>";
const char* collectionName = "<Your_Collection_Name>";
App42API::setDbName(dbName);
userService->setQuery(collectionName, query);
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->GetUser(userName, this, app42callfuncND_selector(TestUserService::onUserRequestCompleted));
void TestUserService::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d",userResponse->getCode());
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());

            std::vector<JSONDocument>::iterator jsonDoc;
            for(jsonDoc=it->jsonDocArray.begin(); jsonDoc!=it->jsonDocArray.end(); ++jsonDoc)
            {
                printf("\n CreatedAt=%s",jsonDoc->getCreatedAt().c_str());
                printf("\n DocId=%s",jsonDoc->getDocId().c_str());
                printf("\n Event=%s",jsonDoc->getEvent().c_str());
                printf("\n Owner=%s",jsonDoc->getOwner().c_str());
                printf("\n UpdatedAt=%s",jsonDoc->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",jsonDoc->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
Coming Soon 
var userName:String = "Nick";  
var key1:String = "name";
var value1:String = "John";
App42API.setDbName("<Enter_the_dbName>");
var query:Query = QueryBuilder.build(key1, value1, Operator.EQUALS);
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.setQuery( "<Your_Collection_Name>", query);
userService.getUser(userName, new callback()); 
public class callback implements App42CallBack  
{  
	public function onSuccess(response:Object):void  
	{  
		var user:User = User(response); 
		var jsonDoc:JSONDocument = new JSONDocument(); 
		trace("userName is " + user.getUserName());
		trace("emailId is " + user.getEmail());
		var jsonDocsList:Array = user.getJsonDocList();
		for(var t:int=0; t < jsonDocsList.length;t++)
		{
			jsonDoc = JSONDocument(jsonDocsList[t]);
			trace("Doc ID is in get user : : "+ jsonDoc.getDocId());
			trace("CreatedAt is : " + jsonDoc.getCreatedAt());
			trace("UpdatedAt is :  " + jsonDoc.getUpdatedAt());
			trace("JsonDoc is :  " + jsonDoc.getJsonDoc());		
		}
	}  
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}  
}  
Not Available
String userName = "Nick";  
String key1 = "name";   
String value1 = "John";
Query query = QueryBuilder.build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to John
App42API.setDbName("<Enter_the_dbName>");
userService.setQuery("<Your_Collection_Name>", query);  
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
User user = userService.getUser(userName); 
System.out.println("userName is " + user.getUserName());
System.out.println("emailId is " + user.getEmail());
for(int i=0;i<user.getJsonDocList().size();i++)
{
	User.JSONDocument jsonDocument = (User.JSONDocument)user.getJsonDocList().elementAt(i);
	System.out.println("updated at = "+ jsonDocument.getUpdatedAt());
	System.out.println("created at = "+ jsonDocument.getCreatedAt());
	System.out.println("doc id is = "+ jsonDocument.getDocId());
	System.out.println("json doc  is = "+ jsonDocument.getJsonDoc());	
}
String jsonResponse = user.toString();   

Create User With Profile

This function allows you to create a user session for the specified User and add their profile. Note: Username and Email ID should be unique for the App.

Required Parameters

userName - Name of the user whose user session is to be created. pwd - Password of the user. emailId - Email ID of the user. profile - Add all the values that you want to retain in user profile object.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String userName = "Nick";					
String pwd = "********";
String emailId = "nick@shephertz.co.in";
Profile profile = new User().new Profile();
Date date = new Date(); 			 
profile.setFirstName("Nick");
profile.setLastName("Gill");
profile.setSex(UserGender.MALE);
profile.setDateOfBirth(date);
profile.setCity("Houston");
profile.setState("Texas");
profile.setPincode("74193");
profile.setCountry("USA");
profile.setMobile("+1-1111-111-111");
profile.setHomeLandLine("+1-2222-222-222");
profile.setOfficeLandLine("+1-33333-333-333");
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.createUserWithProfile(userName, pwd ,emailId, profile,new App42CallBack() {
public void onSuccess(Object response) 
{
	User user = (User)response;
	System.out.println("userName is " + user.getUserName());
	System.out.println("firstName is " + user.getProfile().getFirstName()); 
	System.out.println("city is " + user.getProfile().getCity()); 
	System.out.println("country is " + user.getProfile().getCountry()); 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});
Coming Soon
NSString *userName = @"Nick";
NSString *pwd = @"********";
NSString *emailId = @"nick@shephertz.co.in";
Profile *profile = [[Profile alloc]init];	
profile.firstName = @"Nick";
profile.lastName = @"Gill";
profile.sex = MALE;
NSDate *date = [NSDate date]; 	 		
profile.dateOfBirth = date;
profile.city = @"Houston";
profile.state = @"Texas";
profile.pincode = @"74193";
profile.country = @"USA";
profile.mobile = @"+1-1111-111-111";
profile.homeLandLine = @"+1-2222-222-222";
profile.officeLandLine = @"+1-33333-333-333";	
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService createUserWithProfile:userName password:pwd emailAddress:emailId profile:profile completionBlock:^(BOOL success, id responseObj, App42Exception *exception)
{
	if (success)
	{
		User *user = (User*)responseObj;
		NSLog(@"userName is %@" , user.userName);
		NSLog(@"emailId is %@" ,  user.email);
		NSString *jsonResponse = [user toString];
	}
	else
	{
		NSLog(@"Exception is %@",[exception reason]);
		NSLog(@"HTTP error Code is %d",[exception httpErrorCode]);
		NSLog(@"App Error Code is %d",[exception appErrorCode]);
		NSLog(@"User Info is %@",[exception userInfo]);
	}
}];	
let userName = "Nick"
let password = "*****"
let emailId = "nick@shephertz.co.in"
let profile = Profile()
profile.firstName = "Nick"
profile.lastName = "Gill"
profile.sex = MALE
profile.dateOfBirth = NSDate(timeIntervalSinceNow: 0)
profile.city = "Houston"
profile.state = "Texas"
profile.pincode = "74193"
profile.country = "USA"
profile.mobile = "+1-1111-111-111"
profile.homeLandLine = "+1-2222-222-222"
profile.officeLandLine = "+1-33333-333-333"
userService?.createUserWithProfile(userName, password: password, emailAddress: emailAddress, profile: profile, completionBlock: { (success, response, exception) -> Void in

    if(success)
    {
        let updatedUser = response as! User
        NSLog("User Name = %@", updatedUser.userName)
        NSLog("First Name = %@", updatedUser.profile.firstName)
        NSLog("Sex = %@", updatedUser.profile.sex)
        NSLog("Date Of Birth = %@", updatedUser.profile.dateOfBirth)
        NSLog("City = %@", updatedUser.profile.city)
        NSLog("state = %@", updatedUser.profile.state)
    }
    else
    {
        NSLog("%@", exception.reason!)
        NSLog("%d", exception.appErrorCode)
        NSLog("%d", exception.httpErrorCode)
        NSLog("%@", exception.userInfo!)
    }
})
String userName = "Nick";					
String pwd = "********";
String emailId = "nick@shephertz.co.in";
Profile profile = new User().new Profile();
Date date = new Date(); 			 
profile.setFirstName("Nick");
profile.setLastName("Gill");
profile.setSex(UserGender.MALE);
profile.setDateOfBirth(date);
profile.setCity("Houston");
profile.setState("Texas");
profile.setPincode("74193");
profile.setCountry("USA");
profile.setMobile("+1-1111-111-111");
profile.setHomeLandLine("+1-2222-222-222");
profile.setOfficeLandLine("+1-33333-333-333");
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
User user = userService.createUserWithProfile(userName, pwd,emailId, profile);
System.out.println("userName is " + user.getUserName());
System.out.println("firstName is " + user.getProfile().getFirstName()); 
System.out.println("city is " + user.getProfile().getCity()); 
System.out.println("country is " + user.getProfile().getCountry()); 
String userName = "Nick";  
String pwd = "********";
String emailId = "nick@shephertz.co.in"; 
User.Profile profile = new User.Profile();
DateTime date = DateTime.Now;                
profile.SetFirstName("Nick");  
profile.SetLastName("Gill");  
profile.SetSex(UserGender.MALE);  
profile.SetDateOfBirth(date);  
profile.SetCity("Houston");  
profile.SetState("Texas");  
profile.SetPincode("74193");
profile.SetCountry("USA");  
profile.SetMobile("+1-1111-111-111");  
profile.SetHomeLandLine("+1-2222-222-222");  
profile.SetOfficeLandLine("+1-33333-333-333");  
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
App42Log.SetDebug(true);		//Print output in your editor console
userService.CreateUserWithProfile(userName, pwd, emailId, profile, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		User user = (User) response;
		App42Log.Console("userName is " + user.GetUserName());
		App42Log.Console("emailId is " + user.GetEmail());
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var userService  = new App42User();
var userName = "Nick";
var pwd = "******";
var emailId = "nick@shephertz.co.in";
var result;
userService.setFirstName("Nick");
userService.setLastName("Gill");
userService.setSex("M");
userService.setDateOfBirth(new Date());
userService.setCity("Houston");
userService.setState("Texas");
userService.setCountry("USA");
userService.setMobile("+1-1111-111-111");
userService.setHomeLandLine("+1-2222-222-222");
userService.setOfficeLandLine("+1-33333-333-333");
userService.createUserWithProfile(userName, pwd, emailId, {
	success: function(object) {
		var userObj = JSON.parse(object);
		result = userObj.app42.response.users.user;
		console.log("userName is " + result.userName)
		console.log("emailId is " + result.email)
		console.log("profile is " , result.profile)
	},
	error: function(error) {

	}
});
Coming Soon
const char* userName = "Nick";
const char* password = "*********";
const char* email = "nick@shephertz.co.in";
App42UserProfile userProfile;
userProfile.firstName = "Nick";
userProfile.lastName = "Gill";
userProfile.setSex(App42UserProfile::MALE);
userProfile.dateOfBirth = "";
userProfile.city = "Houston";
userProfile.state = "Texas";
userProfile.pincode = "74193";
userProfile.country = "USA";
userProfile.mobile = "+1-1111-111-111";
userProfile.homeLandLine = "+1-2222-222-222";
userProfile.officeLandLine = "+1-33333-333-333";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->CreateUserWithProfile(userName, password, email, &userProfile, app42callback(Sample_Class::onUserRequestCompleted, this));
void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d ",userResponse->getCode());
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            printf("\n SessionId=%s",it->sessionId.c_str());
            printf("\n isAccountLocked=%d",it->isAccountLocked);
            printf("\n CreatedOn=%s",it->createdOn.c_str());
            printf("\n Password=%s",it->password.c_str());
            //Fetching Profile Info
            printf("\n FirstName=%s",it->profile.firstName.c_str());
            printf("\n LastName=%s",it->profile.lastName.c_str());
            printf("\n Sex=%s",it->profile.getSex().c_str());
            printf("\n Date of Birth=%s",it->profile.dateOfBirth.c_str());
            printf("\n Line1=%s",it->profile.line1.c_str());
            printf("\n Line2=%s",it->profile.line2.c_str());
            printf("\n City=%s",it->profile.city.c_str());
            printf("\n State=%s",it->profile.state.c_str());
            printf("\n Pincode=%s",it->profile.pincode.c_str());
            printf("\n Country=%s",it->profile.country.c_str());
            printf("\n Mobile=%s",it->profile.mobile.c_str());
            printf("\n HomeLandLine=%s",it->profile.homeLandLine.c_str());
            printf("\n OfficeLandLine=%s",it->profile.officeLandLine.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
Coming Soon
$userName = "Nick";
$pwd = "********";
$emailId = "nick@shephertz.co.in";
$user = new User();
$profile = new Profile($user);
$date = date(DATE_ATOM, mktime());
$date1 = strtotime($date);
$currentDate= date('Y-m-j', $date1); 
$profile->setCountry("USA");
$profile->setCity("Houston");
$profile->setDateOfBirth($currentDate);
$profile->setFirstName("Nick");
$profile->setLastName("Gill");
$profile->setHomeLandLine("+1-1800-877-453");
$profile->setOfficeLandLine("+1-1800-111-999");
$profile->setMobile("+1-1111-111-111");
$profile->setSex(UserGender::MALE);
$profile->setState("Texas");
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$user = $userService->createUserWithProfile($userName, $pwd, $emailId, $profile);
print_r("userName is " . $user->getUserName());
print_r("emailId is " . $user->getEmail());
$profileObj = $user->getProfile();
print_r("firstName is" . $profileObj->getFirstName());
print_r("City is" . $profileObj->getCity());
print_r("Country is" . $profileObj->getCountry());
const char* userName = "Nick";
const char* password = "*********";
const char* email = "nick@shephertz.co.in";
App42UserProfile userProfile;
userProfile.firstName = "Nick";
userProfile.lastName = "Gill";
userProfile.setSex(App42UserProfile::MALE);
userProfile.dateOfBirth = "";
userProfile.city = "Houston";
userProfile.state = "Texas";
userProfile.pincode = "74193";
userProfile.country = "USA";
userProfile.mobile = "+1-1111-111-111";
userProfile.homeLandLine = "+1-2222-222-222";
userProfile.officeLandLine = "+1-33333-333-333";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->CreateUserWithProfile(userName, password, email, &userProfile, this, app42callfuncND_selector(Sample_Class::onUserRequestCompleted));
void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d ",userResponse->getCode());
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            printf("\n SessionId=%s",it->sessionId.c_str());
            printf("\n isAccountLocked=%d",it->isAccountLocked);
            printf("\n CreatedOn=%s",it->createdOn.c_str());
            printf("\n Password=%s",it->password.c_str());
            //Fetching Profile Info
            printf("\n FirstName=%s",it->profile.firstName.c_str());
            printf("\n LastName=%s",it->profile.lastName.c_str());
            printf("\n Sex=%s",it->profile.getSex().c_str());
            printf("\n Date of Birth=%s",it->profile.dateOfBirth.c_str());
            printf("\n Line1=%s",it->profile.line1.c_str());
            printf("\n Line2=%s",it->profile.line2.c_str());
            printf("\n City=%s",it->profile.city.c_str());
            printf("\n State=%s",it->profile.state.c_str());
            printf("\n Pincode=%s",it->profile.pincode.c_str());
            printf("\n Country=%s",it->profile.country.c_str());
            printf("\n Mobile=%s",it->profile.mobile.c_str());
            printf("\n HomeLandLine=%s",it->profile.homeLandLine.c_str());
            printf("\n OfficeLandLine=%s",it->profile.officeLandLine.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
Coming Soon 
var userName:String = "Nick"; 
var pwd:String  = "*****";
var emailId:String = "nick@shephertz.co.in";
var date:Date = new Date(); 
var profile:Profile  =new Profile();
profile.setFirstName("Nick");
profile.setLastName("Gill");
profile.setSex(UserGender.MALE);
profile.setDateOfBirth(date);
profile.setCity("Houston");
profile.setState("Texas");
profile.setPincode("74193");
profile.setCountry("USA");
profile.setMobile("+1-1111-111-111");
profile.setHomeLandLine("+1-2222-222-222");
profile.setOfficeLandLine("+1-33333-333-333");
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.createUserWithProfile(userName,pwd,emailId,profile,new callback());
public class callback implements App42CallBack  {  
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message"+ excption.getMessage());  
	}  
	public function onSuccess(response:Object):void  
	{  
			var user:User = User(response);
			trace("User Name :"+user.getUserName());		
			trace("Email Id:"+user.getEmail());
			trace("First Name is :"+user.getProfile().getFirstName());
			trace("City is :"+user.getProfile().getCity());
			trace("Country is :"+user.getProfile().getCountry());
	}  
}
Not Available
Coming Soon

Get Users By Group

This function allows you to find the list of user data.

Required Parameters

userList - List of user for whom you want to find the data.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
ArrayList<String> userList = new ArrayList<String>();
userList.add("Username");
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.getUsersByGroup(userList,new App42CallBack() {
public void onSuccess(Object response) 
{
	ArrayList<User> user = (ArrayList<User>)response;
	for(int i = 0; i < user.size(); i++)   
	{  
		System.out.println("userName is " + user.get(i).getUserName());  
		System.out.println("emailId is " + user.get(i).getEmail());  
		System.out.println("First Name is " + user.get(i).getProfile().getFirstName());  
		System.out.println("Last Name is " + user.get(i).getProfile().getLastName());  
	}  	
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});
Coming Soon
 
NSArray *userList = [NSArray arrayWithObjects:@"Nick",@"John", nil];
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService getUsersByGroup:userList completionBlock:^(BOOL success, id responseObj, App42Exception *exception) {
	if (success)
	{
		NSArray *usersArray = (NSArray*)responseObj;
		NSLog(@"usersArray=%@",usersArray);
		for (User *user in usersArray)
		{
			NSLog(@"UserName=%@",user.userName);
			NSLog(@"Email=%@",user.email);
			NSLog(@"Response=%@",[user toString]);
		}
	}
	else
	{
		NSLog(@"Exception = %@",[exception reason]);
		NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
		NSLog(@"App Error Code = %d",[exception appErrorCode]);
		NSLog(@"User Info = %@",[exception userInfo]);
	}
}];
let userList = ["John","Nick"]
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")
let userService = App42API.buildUserService() as? UserService
userService?.getUsersByGroup(userList, completionBlock: { (success, response, exception) -> Void in

    if(success)
    {
        let userList  = response as! NSArray
        for user in userList {
        NSLog("UserName is : %@", user.userName)
        NSLog("EmailId is : %@", user.email)
    }
    }
    else
    {
        NSLog("%@", exception.reason!)
        NSLog("%d", exception.appErrorCode)
        NSLog("%d", exception.httpErrorCode)
        NSLog("%@", exception.userInfo!)
    }
})
ArrayList<String> userList = new ArrayList<String>();
userList.add("Username");
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
ArrayList<User> user = userService.getUsersByGroup(userList);
for(int i = 0; i < user.size(); i++)   
{  
	System.out.println("userName is " + user.get(i).getUserName());  
	System.out.println("emailId is " + user.get(i).getEmail());  
	System.out.println("First Name is " + user.get(i).getProfile().getFirstName());  
	System.out.println("Last Name is " + user.get(i).getProfile().getLastName());  
} 
IList<String> users = new List<String>();
users.Add("Username1");
users.Add("Username2");
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.GetUsersByGroup(users, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		IList<User> user = (IList<User>) response;     
		for(int i = 0; i < user.Count; i++) 
		{
			App42Log.Console("userName is " + user[i].GetUserName());
			App42Log.Console("emailId is " + user[i].GetEmail());
		}      
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
Coming Soon    
Coming Soon
vector<string>users;
users.push_back("John");
users.push_back("Nick");
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->GetUsersByGroup(users, this, app42callback(Sample_Class::onUserRequestCompleted, this));
void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d ",userResponse->getCode());
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            printf("\n SessionId=%s",it->sessionId.c_str());
            printf("\n isAccountLocked=%d",it->isAccountLocked);
            printf("\n CreatedOn=%s",it->createdOn.c_str());
            printf("\n Password=%s",it->password.c_str());
            //Fetching Profile Info
            printf("\n FirstName=%s",it->profile.firstName.c_str());
            printf("\n LastName=%s",it->profile.lastName.c_str());
            printf("\n Sex=%s",it->profile.getSex().c_str());
            printf("\n Date of Birth=%s",it->profile.dateOfBirth.c_str());
            printf("\n Line1=%s",it->profile.line1.c_str());
            printf("\n Line2=%s",it->profile.line2.c_str());
            printf("\n City=%s",it->profile.city.c_str());
            printf("\n State=%s",it->profile.state.c_str());
            printf("\n Pincode=%s",it->profile.pincode.c_str());
            printf("\n Country=%s",it->profile.country.c_str());
            printf("\n Mobile=%s",it->profile.mobile.c_str());
            printf("\n HomeLandLine=%s",it->profile.homeLandLine.c_str());
            printf("\n OfficeLandLine=%s",it->profile.officeLandLine.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
Coming Soon
$userList = array();
array_push($userList, "Username");
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$userResponse = $userService->getUsersByGroup($userList);
foreach($userResponse as $user )
{
	print_r("userName is " . $user->getUserName());
	print_r("emailId is " .  $user->getEmail());
	$profile = $user->getProfile();
	print_r("firstName is " . $profile->getFirstName());
}
vector<string>users;
users.push_back("John");
users.push_back("Nick");
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->GetUsersByGroup(users, this, app42callfuncND_selector(Sample_Class::onUserRequestCompleted));
void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d ",userResponse->getCode());
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            printf("\n SessionId=%s",it->sessionId.c_str());
            printf("\n isAccountLocked=%d",it->isAccountLocked);
            printf("\n CreatedOn=%s",it->createdOn.c_str());
            printf("\n Password=%s",it->password.c_str());
            //Fetching Profile Info
            printf("\n FirstName=%s",it->profile.firstName.c_str());
            printf("\n LastName=%s",it->profile.lastName.c_str());
            printf("\n Sex=%s",it->profile.getSex().c_str());
            printf("\n Date of Birth=%s",it->profile.dateOfBirth.c_str());
            printf("\n Line1=%s",it->profile.line1.c_str());
            printf("\n Line2=%s",it->profile.line2.c_str());
            printf("\n City=%s",it->profile.city.c_str());
            printf("\n State=%s",it->profile.state.c_str());
            printf("\n Pincode=%s",it->profile.pincode.c_str());
            printf("\n Country=%s",it->profile.country.c_str());
            printf("\n Mobile=%s",it->profile.mobile.c_str());
            printf("\n HomeLandLine=%s",it->profile.homeLandLine.c_str());
            printf("\n OfficeLandLine=%s",it->profile.officeLandLine.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
Coming Soon 
var userList:Array = new Array();
userList.push("Username");
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.getUsersByGroup(userList,new callback());
public class callback implements App42CallBack  {  
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message"+ excption.getMessage());  
	}  
	public function onSuccess(response:Object):void  
	{  
		for(var i:int = 0;i < response.length;i++){
			var user:User = User(response[i])
		trace("User Name :"+user.getUserName());		
		trace("Email Id:"+user.getEmail());
		trace("First Name is :"+user.getProfile().getFirstName());
		trace("City is :"+user.getProfile().getCity());
		trace("Country is :"+user.getProfile().getCountry());
		}
	}  
}
Not Available
Coming Soon

Reset User Password With Custom Name

Set your custom name while resetting the user password in email template. Note This method works only if you created email template from AppHQ Console.

Required Parameters

userName - Username for whom password has to be reset.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String userName = "Nick";
HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
otherMetaHeaders.put("customName", "John");
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.setOtherMetaHeaders(otherMetaHeaders);
userService.resetUserPassword(userName,new App42CallBack() {
public void onSuccess(Object response) 
{
	App42Response app42response = (App42Response)response;      
	System.out.println("response is " + app42response) ;  
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});
String userName = "Nick"; 
Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>();
otherMetaHeaders.Add("customName", "John");
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.SetOtherMetaHeaders(otherMetaHeaders);
userService.ResetUserPassword(userName, new Callback());
public class Callback : App42Callback  
{ 	
	public void OnSuccess(Object response)  
	{  
		App42Response app42response = (App42Response) response;     
		String jsonResponse = app42response.ToString();  
	}  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
}  
NSString *userName = @"Nick"; 
NSMutableDictionary *otherMetaHeaders = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"John",@"customName", nil];
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService setOtherMetaHeaders:otherMetaHeaders];
[userService resetUserPassword:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) {
	if (success)
	{
		App42Response *response = (App42Response*)responseObj;
		NSLog(@"Response is %@",response.strResponse);
	}
	else
	{
		NSLog(@"Exception = %@",[exception reason]);
		NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
		NSLog(@"App Error Code = %d",[exception appErrorCode]);
		NSLog(@"User Info = %@",[exception userInfo]);
	}
}];                  
let userName = "Nick";
let otherMeta = NSMutableDictionary()
otherMeta.setObject("John", forKey:"customName")
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")
let userService = App42API.buildUserService() as? UserService
userService?.otherMetaHeaders = otherMeta
userService?.resetUserPassword(userName , completionBlock: { (success, response, exception) -> Void in

    if(success)
    {
        let app42Response = response as! App42Response
        NSLog("Response success is : %@", app42Response.isResponseSuccess)
        NSLog("Response String is %@", app42Response.strResponse)
    }
    else
    {
        NSLog("%@", exception.reason!)
        NSLog("%d", exception.appErrorCode)
        NSLog("%d", exception.httpErrorCode)
        NSLog("%@", exception.userInfo!)
    }
})
String userName = "Nick";
HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
otherMetaHeaders.put("customName", "John");
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.setOtherMetaHeaders(otherMetaHeaders);
App42Response app42response = userService.resetUserPassword(userName); 
System.out.println("response is " + app42response) ;  
boolean  success = app42response.isResponseSuccess();
String jsonResponse = app42response.toString(); 
String userName = "Nick";
App42Log.SetDebug(true);		//Print output in your editor console
Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>();
otherMetaHeaders.Add("customName", "John");
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.SetOtherMetaHeaders(otherMetaHeaders);
userService.ResetUserPassword(userName,new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		var app42Response:App42Response = App42Response(response);
		App42Log.Console("app42Response is : " + app42Response);
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var userName = "Nick"; 
var result ;  
var otherMetaHeaders = {"customName":"John"};                               
App42.initialize("API_KEY","SECRET_KEY");
var userService  = new App42User();
userService.setOtherMetaHeaders(otherMetaHeaders); 
userService.resetUserPassword(userName,{  
success: function(object) 
	{  
		var userObj = JSON.parse(object);  
		result = userObj.app42.response.users.user;
		console.log("userName is " + result.userName)
	},  
	error: function(error) {
	}  
});   
local userName  = "Nick"
local App42CallBack = {}
local otherMetaHeaders = {};
otherMetaHeaders.customName= "John";
App42API:initialize("API_KEY","SECRET_KEY")
local userService  = App42API:buildUserService()
userService:setOtherMetaHeaders(otherMetaHeaders);
userService:resetUserPassword(userName,App42CallBack)
function App42CallBack:onSuccess(object)
	print(object:getResponseSuccess())
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* userName = "Nick";
map<string,string>otherMetaHeaders;
otherMetaHeaders["customName"] = "John";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->setOtherMetaHeaders(otherMetaHeaders);  
userService->ResetUserPassword(userName, app42callback(Sample_Class::onUserRequestCompleted, this));

void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
String userName = "Nick";
Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>();
otherMetaHeaders.Add("customName", "John");
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
userService.SetOtherMetaHeaders(otherMetaHeaders);
App42Response response = userService.ResetUserPassword(userName); 
Boolean  success = response.IsResponseSuccess();
String jsonResponse = response.ToString(); 
$userName = "Nick";
$otherMetaHeaders = array();
$otherMetaHeaders['customName'] ="John";
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$userService->setOtherMetaHeaders($otherMetaHeaders);
$response = $userService->resetUserPassword($userName); 
print_r("Response is : ".$response->toString());
$success = $response->isResponseSuccess();
$jsonResponse = $response->toString(); 
const char* userName = "Nick";
map<string,string>otherMetaHeaders;
otherMetaHeaders["customName"] = "John";
userService->setOtherMetaHeaders(otherMetaHeaders);
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->ResetUserPassword(userName, this, app42callfuncND_selector(Sample_Class::onUserRequestCompleted));

void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
Coming Soon
var userName:String = "Nick";
var otherMetaHeaders:Dictionary = new Dictionary();
otherMetaHeaders["customName"] = "John";
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.setOtherMetaHeaders(otherMetaHeaders);
userService.resetAppUserPassword(userName,new callback());  
public class callback implements App42CallBack  
{  
	public function onSuccess(response:Object):void  
	{  
		var app42Response:App42Response = App42Response(response); 
		trace("response is : "+ app42Response); 
	} 
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}   
} 
Coming Soon 
String userName = "Nick";
HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
otherMetaHeaders.put("customName", "John");
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.setOtherMetaHeaders(otherMetaHeaders);
App42Response response = userService.resetUserPassword(userName); 
boolean  success = response.isResponseSuccess();
String jsonResponse = response.toString(); 

Reset User Password With Email Verification

Send the verification link for resetting the app user password. Note This method works Only if you created email template from AppHQ Console.

Required Parameters

userName - Username for whom password has to be reset.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String userName = "Nick";
HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
otherMetaHeaders.put("emailVerification", "true");
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.setOtherMetaHeaders(otherMetaHeaders);
userService.resetUserPassword(userName,new App42CallBack() {
public void onSuccess(Object response) 
{
	App42Response app42response = (App42Response)response;      
	System.out.println("response is " + app42response) ;  
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});
String userName = "Nick"; 
Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>();
otherMetaHeaders.Add("emailVerification", "true");
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.SetOtherMetaHeaders(otherMetaHeaders);
userService.ResetUserPassword(userName, new Callback());
public class Callback : App42Callback  
{ 	
	public void OnSuccess(Object response)  
	{  
		App42Response app42response = (App42Response) response;     
		String jsonResponse = app42response.ToString();  
	}  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
}  
NSString *userName = @"Nick"; 
NSMutableDictionary *otherMetaHeaders = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"true",@"emailVerification", nil];
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService setOtherMetaHeaders:otherMetaHeaders];
[userService resetUserPassword:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) {
	if (success)
	{
		App42Response *response = (App42Response*)responseObj;
		NSLog(@"Response is %@",response.strResponse);
	}
	else
	{
		NSLog(@"Exception = %@",[exception reason]);
		NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
		NSLog(@"App Error Code = %d",[exception appErrorCode]);
		NSLog(@"User Info = %@",[exception userInfo]);
	}
}];                            
let userName = "Nick";
let otherMeta = NSMutableDictionary(object: "true", forKey: "emailVerification")
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")
let userService = App42API.buildUserService() as? UserService
userService?.otherMetaHeaders = otherMeta
userService?.resetUserPassword(userName , completionBlock: { (success, response, exception) -> Void in
    if(success)
    {
        let app42Response = response as! App42Response
        NSLog("Response success is : %@", app42Response.isResponseSuccess)
        NSLog("Response String is %@", app42Response.strResponse)
    }
    else
    {
        NSLog("%@", exception.reason!)
        NSLog("%d", exception.appErrorCode)
        NSLog("%d", exception.httpErrorCode)
        NSLog("%@", exception.userInfo!)
    }
})
String userName = "Nick";
HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
otherMetaHeaders.put("emailVerification", "true");
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.setOtherMetaHeaders(otherMetaHeaders);
App42Response app42response = userService.resetUserPassword(userName); 
System.out.println("response is " + app42response) ;  
boolean  success = app42response.isResponseSuccess();
String jsonResponse = app42response.toString(); 
String userName = "Nick";
App42Log.SetDebug(true);		//Print output in your editor console
Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>();
otherMetaHeaders.Add("emailVerification", "true");
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.SetOtherMetaHeaders(otherMetaHeaders);
userService.ResetUserPassword(userName,new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		var app42Response:App42Response = App42Response(response);
		App42Log.Console("app42Response is : " + app42Response);
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var userName = "Nick"; 
var result ;  
var otherMetaHeaders = {"emailVerification":"true"};                               
App42.initialize("API_KEY","SECRET_KEY");
var userService  = new App42User();
userService.setOtherMetaHeaders(otherMetaHeaders); 
userService.resetUserPassword(userName,{  
success: function(object) 
	{  
		var userObj = JSON.parse(object);  
		result = userObj.app42.response.users.user;
		console.log("userName is " + result.userName)
	},  
	error: function(error) {
	}  
});   
local userName  = "Nick"
local App42CallBack = {}
local otherMetaHeaders = {};
otherMetaHeaders.emailVerification= "true";
App42API:initialize("API_KEY","SECRET_KEY")
local userService  = App42API:buildUserService()
userService:setOtherMetaHeaders(otherMetaHeaders);
userService:resetUserPassword(userName,App42CallBack)
function App42CallBack:onSuccess(object)
	print(object:getResponseSuccess())
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* userName = "Nick";
map<string,string>otherMetaHeaders;
otherMetaHeaders["emailVerification"] = "true";
userService->setOtherMetaHeaders(otherMetaHeaders);  
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->ResetUserPassword(userName, app42callback(Sample_Class::onUserRequestCompleted, this));

void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
String userName = "Nick";
Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>();
otherMetaHeaders.Add("emailVerification", "true");
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
userService.SetOtherMetaHeaders(otherMetaHeaders);
App42Response response = userService.ResetUserPassword(userName); 
Boolean  success = response.IsResponseSuccess();
String jsonResponse = response.ToString(); 
$userName = "Nick";
$otherMetaHeaders = array();
$otherMetaHeaders['emailVerification'] ="true";
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$userService->setOtherMetaHeaders($otherMetaHeaders);
$response = $userService->resetUserPassword($userName); 
print_r("Response is : ".$response->toString());
$success = $response->isResponseSuccess();
$jsonResponse = $response->toString(); 
const char* userName = "Nick";
map<string,string>otherMetaHeaders;
otherMetaHeaders["emailVerification"] = "true";
userService->setOtherMetaHeaders(otherMetaHeaders);
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->ResetUserPassword(userName, this, app42callfuncND_selector(Sample_Class::onUserRequestCompleted));

void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
Coming Soon
var userName:String = "Nick";
var otherMetaHeaders:Dictionary = new Dictionary();
otherMetaHeaders["emailVerification"] = "true";
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.setOtherMetaHeaders(otherMetaHeaders);
userService.resetAppUserPassword(userName,new callback());  
public class callback implements App42CallBack  
{  
	public function onSuccess(response:Object):void  
	{  
		var app42Response:App42Response = App42Response(response); 
		trace("response is : "+ app42Response); 
	} 
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}   
} 
Coming Soon 
String userName = "Nick";
HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
otherMetaHeaders.put("emailVerification", "true");
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.setOtherMetaHeaders(otherMetaHeaders);
App42Response response = userService.resetUserPassword(userName); 
boolean  success = response.isResponseSuccess();
String jsonResponse = response.toString(); 

Get All Users With Advance Search

Fetch the list of all the users with specific value. For example, if you want to fetch the list of users whose name start from “n” using below code snippet.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
otherMetaHeaders.put("like", "n");		// To get the list of users whose name start from "n"
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.setOtherMetaHeaders(otherMetaHeaders);
userService.getAllUsers(new App42CallBack() {
public void onSuccess(Object response) 
{
	ArrayList<User> user = (ArrayList<User>)response;
	for(int i = 0; i < user.size(); i++)   
	{  
		System.out.println("userName is " + user.get(i).getUserName());  
		System.out.println("emailId is " + user.get(i).getEmail());  
	}  		
}
public void onException(Exception ex)
{
	System.out.println("Exception Message"+ex.getMessage());
}
});
 
Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>();
otherMetaHeaders.Add("like", "n");		// To get the list of users whose name start from "n"
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.SetOtherMetaHeaders(otherMetaHeaders);
userService.GetAllUsers(new Callback()); 
public class Callback : App42Callback  
{ 
	public void OnSuccess(Object response)  
	{  
		IList<User> user = (IList<User>) response;  
		for(int i = 0; i < user.Count; i++) 
		{
			Console.WriteLine("userName is " + user[i].GetUserName());
			Console.WriteLine("emailId is " + user[i].GetEmail());
		}     
	}  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
}  
NSMutableDictionary *otherMetaHeaders = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"n",@"like", nil];		// To get the list of users whose name start from "n"
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService setOtherMetaHeaders:otherMetaHeaders];
[userService getAllUsers:^(BOOL success, id responseObj, App42Exception *exception)
{
	if (success)
	{
		NSArray *usersArray = (NSArray*)responseObj;
		NSLog(@"usersArray=%@",usersArray);
		for (User *user in usersArray)
		{
			NSLog(@"User name is %@",user.userName);
			NSLog(@"Email is %@",user.email);
			NSLog(@"Response is %@",[user toString]);
		}
	}
	else
	{
		NSLog(@"Exception is %@",[exception reason]);
		NSLog(@"HTTP error Code is %d",[exception httpErrorCode]);
		NSLog(@"App Error Code is %d",[exception appErrorCode]);
		NSLog(@"User Info is %@",[exception userInfo]);
	}
}];
let otherMeta = NSMutableDictionary()
otherMeta.setObject("n", forKey:"like")
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")
let userService = App42API.buildUserService() as? UserService
userService?.otherMetaHeaders = otherMeta
userService?.getAllUsers({ (success, response, exception) -> Void in
    if(success)
    {
        let userList  = response as! NSArray
        for user in userList {
        NSLog("UserName is : %@", user.userName)
        NSLog("EmailId is : %@", user.email)
    }
    }
    else
    {
        NSLog("%@", exception.reason!)
        NSLog("%d", exception.appErrorCode)
        NSLog("%d", exception.httpErrorCode)
        NSLog("%@", exception.userInfo!)
    }
})
HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
otherMetaHeaders.put("like", "n");		// To get the list of users whose name start from "n"
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.setOtherMetaHeaders(otherMetaHeaders); 
ArrayList<User> user = userService.getAllUsers(); 
for(int i = 0; i < user.size(); i++)   
{  
	System.out.println("userName is " + user.get(i).getUserName());  
	System.out.println("emailId is " + user.get(i).getEmail());  
}  	
App42Log.SetDebug(true);		//Print output in your editor console
Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>();
otherMetaHeaders.Add("like", "n");		// To get the list of users whose name start from "n"
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.SetOtherMetaHeaders(otherMetaHeaders);
userService.GetAllUsers(new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		IList<User> user = (IList<User>) response;  
		for(int i = 0; i < user.Count; i++) 
		{
			App42Log.Console("userName is " + user[i].GetUserName());
			App42Log.Console("emailId is " + user[i].GetEmail());
		}     
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var result ;  
var otherMetaHeaders = {"like":"n"};   		// To get the list of users whose name start from "n"                            
App42.initialize("API_KEY","SECRET_KEY");
var userService  = new App42User();
userService.setOtherMetaHeaders(otherMetaHeaders);
userService.getAllUsers({  
success: function(object)
 {  
	var userObj = JSON.parse(object);
	result = userObj.app42.response.users.user;
	if (result instanceof Array) {
		for(var i = 0;i<result.length;i++)
		{
			console.log("UserName : " + result[i].userName)
			console.log("EmailId : " + result[i].email)
		}
	} else {
		console.log("UserName : " + result.userName)
		console.log("EmailId : " + result.email)
	}
},  
error: function(error) {  
}  
});     
local App42CallBack = {}
local otherMetaHeaders = {};
otherMetaHeaders.like= "n";		// To get the list of users whose name start from "n"
App42API:initialize("API_KEY","SECRET_KEY")
local userService  = App42API:buildUserService()
userService:setOtherMetaHeaders(otherMetaHeaders);
userService:getAllUsers(App42CallBack)
function App42CallBack:onSuccess(object)
	if table.getn(object) >1 then 
		for i=1,table.getn(object) do
			print("UserName is "..object[i]:getUserName())
			print("Email id is "..object[i]:getEmail())
		end
	else
		print("UserName is "..object:getUserName())
		print("Email id is "..object:getEmail())
	end
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
map<string,string>otherMetaHeaders;
otherMetaHeaders["like"] = "n";		// To get the list of users whose name start from "n"
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->setOtherMetaHeaders(otherMetaHeaders);  
userService->GetAllUsers(app42callback(Sample_Class::onUserRequestCompleted, this));

void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            //Fetching Profile Info
            printf("\n FirstName=%s",it->profile.firstName.c_str());
            printf("\n LastName=%s",it->profile.lastName.c_str());
            printf("\n Sex=%s",it->profile.getSex().c_str());
            printf("\n Date of Birth=%s",it->profile.dateOfBirth.c_str());
            printf("\n Line1=%s",it->profile.line1.c_str());
            printf("\n Line2=%s",it->profile.line2.c_str());
            printf("\n City=%s",it->profile.city.c_str());
            printf("\n Pincode=%s",it->profile.pincode.c_str());
            printf("\n Country=%s",it->profile.country.c_str());
            printf("\n Mobile=%s",it->profile.mobile.c_str());
            printf("\n HomeLandLine=%s",it->profile.homeLandLine.c_str());
            printf("\n OfficeLandLine=%s",it->profile.officeLandLine.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>();
otherMetaHeaders.Add("like", "n");		// To get the list of users whose name start from "n"
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
userService.SetOtherMetaHeaders(otherMetaHeaders);
IList<User> user = userService.GetAllUsers(); 
for(int i = 0; i < user.Count; i++) 
{
	Console.WriteLine("userName is " + user[i].GetUserName());
	Console.WriteLine("emailId is " + user[i].GetEmail());
}             
$otherMetaHeaders = array();
$otherMetaHeaders['like'] ="n";
$userService->setOtherMetaHeaders($otherMetaHeaders);
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$userResponse = $userService->getAllUsers(); 
foreach($userResponse as $user )
{
	print_r("userName is " . $user->getUserName());
	print_r("emailId is " .  $user->getEmail());
	print_r("Account Locked is " . $user->isAccountLocked());
	$profile = $user->getProfile();
	print_r("firstName is " . $profile->getFirstName());
}
$jsonResponse = $userResponse[0]->toString(); 
map<string,string>otherMetaHeaders;
otherMetaHeaders["like"] = "n";		// To get the list of users whose name start from "n"
userService->setOtherMetaHeaders(otherMetaHeaders);  
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->GetAllUsers(this,app42callfuncND_selector(Sample_Class::onUserRequestCompleted));

void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            //Fetching Profile Info
            printf("\n FirstName=%s",it->profile.firstName.c_str());
            printf("\n LastName=%s",it->profile.lastName.c_str());
            printf("\n Sex=%s",it->profile.getSex().c_str());
            printf("\n Date of Birth=%s",it->profile.dateOfBirth.c_str());
            printf("\n Line1=%s",it->profile.line1.c_str());
            printf("\n Line2=%s",it->profile.line2.c_str());
            printf("\n City=%s",it->profile.city.c_str());
            printf("\n State=%s",it->profile.state.c_str());
            printf("\n Pincode=%s",it->profile.pincode.c_str());
            printf("\n Country=%s",it->profile.country.c_str());
            printf("\n Mobile=%s",it->profile.mobile.c_str());
            printf("\n HomeLandLine=%s",it->profile.homeLandLine.c_str());
            printf("\n OfficeLandLine=%s",it->profile.officeLandLine.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
Coming Soon
var otherMetaHeaders:Dictionary = new Dictionary();
otherMetaHeaders["like"] = "n";		// To get the list of users whose name start from "n"
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.setOtherMetaHeaders(otherMetaHeaders);
userService.getAllUsers(new callback());  
public class callback implements App42CallBack  
{ 
	public function onSuccess(response:Object):void  
	{  
		var array:Array = res as Array;
		for(var i:int = 0;i < array.length;i++){
			var user:User = User(array[i])
			trace("userName is : " + user.getUserName());
			trace("emailId is : " +  user.getEmail());
		}
	}   
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}  
}  
Coming Soon
HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
otherMetaHeaders.put("like", "n");		// To get the list of users whose name start from "n"
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.setOtherMetaHeaders(otherMetaHeaders); 
Vector userList = userService.getAllUsers(); 
for(int i=0;i < userList.size();i++)  
{ 
	User user = (User)userList.elementAt(i);  
	System.out.println("userName is " + user.getUserName());
	System.out.println("emailId is " + user.getEmail());
}         

Get Profile With Authenticate

Fetch the user profile along with user authentication.

Required Parameters

userName - Username that you want to authenticate. pwd - Password that was entered when you created the user.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String userName = "Nick";   
String pwd = "********";  
HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
otherMetaHeaders.put("userProfile", "true");
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.setOtherMetaHeaders(otherMetaHeaders); 
userService.authenticate(userName , pwd, new App42CallBack() {
public void onSuccess(Object response)
{
	User user = (User)response;
	System.out.println("userName is " + user.getUserName());  
	System.out.println("sessionId is " + user.getSessionId());  
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message : "+ex.getMessage());
}
});
String userName = "Nick";   
String pwd  = "*****";
Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>();
otherMetaHeaders.Add("userProfile", "true");
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.SetOtherMetaHeaders(otherMetaHeaders);
userService.Authenticate(userName,pwd, new Callback()); 
public class Callback : App42Callback  
{  
	public void OnSuccess(Object response)  
	{  
		User user = (User) response;     
		Console.WriteLine("userName is : " + user.GetUserName());
		Console.WriteLine("sessionId is : " + user.GetSessionId());
	} 
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  	
}  
NSString *userName = @"Nick";
NSString *pwd = @"********";
NSMutableDictionary *otherMetaHeaders = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"true",@"userProfile", nil];
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService setOtherMetaHeaders:otherMetaHeaders];
[userService authenticateUser:userName password:pwd completionBlock:^(BOOL success, id responseObj, App42Exception *exception)
{
	if (success)
	{
		User *user = (User*)responseObj;
		NSLog(@"userName is %@" , user.userName);
		NSLog(@"sessionId is %@" ,  user.sessionId);
	}
	else
	{
		NSLog(@"Exception is %@",[exception reason]);
		NSLog(@"HTTP error Code is %d",[exception httpErrorCode]);
		NSLog(@"App Error Code is %d",[exception appErrorCode]);
		NSLog(@"User Info is %@",[exception userInfo]);
	}
}];
let userName = "Nick"
let pwd = "********"
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")
let userService = App42API.buildUserService() as? UserService
let otherMeta = NSMutableDictionary(object: "true", forKey: "userProfile")
userService?.otherMetaHeaders = otherMeta
userService?.authenticateUser(userName, password:pwd, completionBlock: { (success, response, exception) -> Void in

    if(success)
    {
        let user = response as! User
        NSLog("%@", user.userName)
        NSLog("%@", user.email)
        NSLog("%@", user.sessionId)
    }
    else
    {
        NSLog("%@", exception.reason!)
        NSLog("%d", exception.appErrorCode)
        NSLog("%d", exception.httpErrorCode)
        NSLog("%@", exception.userInfo!)
    }
})
String userName = "Nick";
String pwd = "********";   
HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
otherMetaHeaders.put("userProfile", "true");
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.setOtherMetaHeaders(otherMetaHeaders); 
User user = userService.authenticate(userName, pwd); 
System.out.println("userName is " + user.getUserName());  
System.out.println("sessionId is " + user.getSessionId());  
String userName = "Nick"; 
String pwd = "********";
App42Log.SetDebug(true);		//Print output in your editor console
Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>();
otherMetaHeaders.Add("userProfile", "true");
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.SetOtherMetaHeaders(otherMetaHeaders);
userService.Authenticate(userName, pwd,new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		User user = (User) response;     
		App42Log.Console("userName is " + user.GetUserName());
		App42Log.Console("sessionId is " + user.GetSessionId());
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var userName = "Nick"; 
var pwd = "*********";  
var result ;  
var otherMetaHeaders = {"userProfile":"true"};                               
App42.initialize("API_KEY","SECRET_KEY");
var userService  = new App42User();
userService.setOtherMetaHeaders(otherMetaHeaders); 
userService.authenticate(userName, pwd,{  
	success: function(object) 
	{  
		var userObj = JSON.parse(object);  
		result = userObj.app42.response.users.user;
		console.log("userName is " + result.userName)
		console.log("sessionId is " + result.sessionId)
	},  
	error: function(error) {
	}  
}); 
local userName  = "Nick";
local pwd = "********"
local App42CallBack = {}
local otherMetaHeaders = {};
otherMetaHeaders.userProfile= "true";
App42API:initialize("API_KEY","SECRET_KEY")
local userService  = App42API:buildUserService()
userService:setOtherMetaHeaders(otherMetaHeaders);
userService:authenticate(userName,pwd,App42CallBack)
function App42CallBack:onSuccess(object)
	print("userName is "..object:getUserName())
	print("session id is "..object:getSessionId())
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* pwd = "*******";
const char* userName  = "Nick";  
map<string,string>otherMetaHeaders;
otherMetaHeaders["userProfile"] = "true";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->setOtherMetaHeaders(otherMetaHeaders);  
userService->Authenticate(userName, pwd, app42callback(Sample_Class::onUserRequestCompleted, this));

void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            printf("\n SessionId=%s",it->sessionId.c_str());
            printf("\n isAccountLocked=%d",it->isAccountLocked);
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
String userName = "Nick";
String pwd = "********";
Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>();
otherMetaHeaders.Add("userProfile", "true");
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
userService.SetOtherMetaHeaders(otherMetaHeaders);
User user = userService.Authenticate(userName, pwd); 
Console.WriteLine("userName is " + user.GetUserName());
Console.WriteLine("sessionId is " + user.GetSessionId());
String jsonResponse = user.ToString();         
$userName = "Nick";
$pwd = "********";
$otherMetaHeaders = array();
$otherMetaHeaders['userProfile'] ="true";
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$userService->setOtherMetaHeaders($otherMetaHeaders);
$user = $userService->authenticate($userName, $pwd); 
print_r("userName is " . $user->getUserName());
print_r("sessionId is " . $user->getSessionId());
$jsonResponse = $user->toString(); 
const char* pwd = "*******";
const char* userName = "Nick";  
map<string,string>otherMetaHeaders;
otherMetaHeaders["userProfile"] = "true";
userService->setOtherMetaHeaders(otherMetaHeaders);  
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->Authenticate(emailId, pwd, this, app42callfuncND_selector(Sample_Class::onUserRequestCompleted));

void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            printf("\n SessionId=%s",it->sessionId.c_str());
            printf("\n isAccountLocked=%d",it->isAccountLocked);
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
Coming Soon
var userName:String = "Nick";    
var pwd:String  = "*****";
var otherMetaHeaders:Dictionary = new Dictionary();
otherMetaHeaders["userProfile"] = "true";
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.setOtherMetaHeaders(otherMetaHeaders);
userService.authenticate(userName,pwd, new callback());  
public class callback implements App42CallBack  
{  
	public function onSuccess(response:Object):void  
	{  
		var user:User = User(response);
		trace("userName is " + user.getUserName());
		trace("sessionId is " + user.getSessionId());
	}  
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}  
}
Coming Soon 
String userName = "Nick";
String pwd = "********";   
HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
otherMetaHeaders.put("userProfile", "true");
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.setOtherMetaHeaders(otherMetaHeaders); 
User user = userService.authenticate(userName, pwd); 
System.out.println("userName is " + user.getUserName());
System.out.println("sessionId is " + user.getSessionId());

Get Users By Profile Data With Specific Data

Fetch all the list of users who has a specific value in their profile e.g If you want to fetch the list of users whose first name start from “Nick” and last name start from “Gill” using below code snippet.

Required Parameters

profileData - Profile Data key/value for which Users need to be retrieved.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
otherMetaHeaders.put("like", "true");
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.setOtherMetaHeaders(otherMetaHeaders);
User.Profile profileData = new User().new Profile();
profileData.setFirstName("Nick");
profileData.setLastName("Gill");
userService.getUsersByProfileData(profileData,new App42CallBack() {
public void onSuccess(Object response) 
{
	ArrayList<User> user = (ArrayList<User>)response;
	for(int i = 0; i < user.size(); i++)   
	{ 
		System.out.println("userName is " + user.get(i).getUserName());  
		System.out.println("emailId is " + user.get(i).getEmail());  
		System.out.println("First Name is " + user.get(i).getProfile().getFirstName());  
		System.out.println("Last Name is " + user.get(i).getProfile().getLastName()); 
	}
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});   
Coming Soon
User *userObj = [[User alloc]init];
Profile *profileData = [[Profile alloc]initWithUser:userObj];			
profileData.firstName = @"Nick";
profileData.lastName = @"Gill";
NSMutableDictionary *otherMetaHeaders = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"true",@"like", nil];
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService setOtherMetaHeaders:otherMetaHeaders];
[userService getUsersByProfileData:profileData completionBlock:^(BOOL success, id responseObj, App42Exception *exception) {
	if (success)
	{
		User *user = (User*)responseObj;
		NSLog(@"UserName=%@",user.userName);
		NSLog(@"Email=%@",user.email);
		NSLog(@"RollList=%@",user.roleList);
		NSLog(@"Response=%@",[user toString]);
	}
	else
	{
		NSLog(@"Exception = %@",[exception reason]);
		NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
		NSLog(@"App Error Code = %d",[exception appErrorCode]);
		NSLog(@"User Info = %@",[exception userInfo]);
	}
}];
let profile:Profile = Profile();
profile.firstName = "Nick"
profile.lastName = "Gill"
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")
let userService = App42API.buildUserService() as? UserService
let otherMeta = NSMutableDictionary(object:"true", forKey:"userProfile")
userService?.otherMetaHeaders = otherMeta
userService?.getUsersByProfileData(profile, completionBlock:{ (success, response, exception) -> Void in

    if(success)
    {
        let list = response as! [User]
        for user in list {
            NSLog("%@", user.userName)
            NSLog("First Name = %@", user.profile.firstName)
            NSLog("Sex = %@", user.profile.sex)
            NSLog("Date Of Birth = %@", user.profile.dateOfBirth)
            NSLog("City = %@", user.profile.city)
            NSLog("state = %@", user.profile.state)
        }
    }
    else
    {
        NSLog("%@", exception.reason!)
        NSLog("%d", exception.appErrorCode)
        NSLog("%d", exception.httpErrorCode)
        NSLog("%@", exception.userInfo!)
    }
})
HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
otherMetaHeaders.put("like", "true");
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.setOtherMetaHeaders(otherMetaHeaders);
User.Profile profileData = new User().new Profile();
profileData.setFirstName("Nick");
profileData.setLastName("Gill");
ArrayList<User> user = userService.getUsersByProfileData(profileData); 
for(int i = 0; i < user.size(); i++)   
{ 
	System.out.println("userName is " + user.get(i).getUserName());  
	System.out.println("emailId is " + user.get(i).getEmail());  
	System.out.println("First Name is " + user.get(i).getProfile().getFirstName());  
	System.out.println("Last Name is " + user.get(i).getProfile().getLastName()); 
}
String jsonResponse = user.get(0).toString();    
User.Profile profileData = new User.Profile();
profileData.SetFirstName("Nick");  
profileData.SetLastName("Gill");  
Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>();
otherMetaHeaders.Add("like", "true");
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.SetOtherMetaHeaders(otherMetaHeaders);
userService.GetUsersByProfileData(profileData, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		IList<User> user = (IList<User>) response;     
		for(int i = 0; i < user.Count; i++) 
		{
			App42Log.Console("userName is " + user[i].GetUserName());
			App42Log.Console("emailId is " + user[i].GetEmail());
		}      
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
Not Available
Not Available
map<string,string>otherMetaHeaders;
otherMetaHeaders["like"] = "true";
userService->setOtherMetaHeaders(otherMetaHeaders); 
App42UserProfile userProfile;
userProfile.firstName = "Nick";
userProfile.lastName = "Gill";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->GetUsersByProfileData(&userProfile, app42callback(Sample_Class::onUserRequestCompleted, this));
void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            printf("\n isAccountLocked=%d",it->isAccountLocked);
            //Fetching Profile Info
            printf("\n FirstName=%s",it->profile.firstName.c_str());
            printf("\n LastName=%s",it->profile.lastName.c_str());
            printf("\n Sex=%s",it->profile.getSex().c_str());
            printf("\n Date of Birth=%s",it->profile.dateOfBirth.c_str());
            printf("\n Line1=%s",it->profile.line1.c_str());
            printf("\n Line2=%s",it->profile.line2.c_str());
            printf("\n City=%s",it->profile.city.c_str());
            printf("\n State=%s",it->profile.state.c_str());
            printf("\n Pincode=%s",it->profile.pincode.c_str());
            printf("\n Country=%s",it->profile.country.c_str());
            printf("\n Mobile=%s",it->profile.mobile.c_str());
            printf("\n HomeLandLine=%s",it->profile.homeLandLine.c_str());
            printf("\n OfficeLandLine=%s",it->profile.officeLandLine.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
String userName = "Nick";						
String pwd = "********";
String emailId = "nick@shephertz.co.in";
Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>();
otherMetaHeaders.Add("like", "true");
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
userService.SetOtherMetaHeaders(otherMetaHeaders);
User user = userService.CreateUser(userName, pwd, emailId);			
User.Profile profileData = new User.Profile(user);
profileData.SetFirstName("Nick");
profileData.SetLastName("Gill");
IList<User> user = userService.GetUsersByProfileData(profileData); 
Console.WriteLine("userName is " + user[0].GetUserName());
Console.WriteLine("emailId is " + user[0].GetEmail());
String jsonResponse = user[0].ToString();         
$otherMetaHeaders = array();
$otherMetaHeaders['like'] ="true";
$userService->setOtherMetaHeaders($otherMetaHeaders);
$userName = "Nick";						
$pwd = "********";
$emailId = "nick@shephertz.co.in";
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
$createUser = $userService->createUser($userName, $pwd, $emailId);					
$profileData = new Profile($createUser);
$profileData->setFirstName("Nick");
$profileData->setLastName("Gill");
$userService->createOrUpdateProfile($createUser);
$userResonse = $userService->getUsersByProfileData($profileData); 
foreach($userResonse as $user )
{
	print_r("userName is " . $user->getUserName());
	print_r("emailId is " .  $user->getEmail());
	print_r("Account Locked is " . $user->isAccountLocked());
	$profile = $user->getProfile();
	print_r("firstName is " . $profile->getFirstName());
}
$jsonResponse = $userResonse[0]->toString(); 
map<string,string>otherMetaHeaders;
otherMetaHeaders["like"] = "true";
userService->setOtherMetaHeaders(otherMetaHeaders); 
App42UserProfile userProfile;
userProfile.firstName = "Nick";
userProfile.lastName = "Gill";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->GetUsersByProfileData(&userProfile, this, app42callfuncND_selector(Sample_Class::onUserRequestCompleted));
void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {        
        for(std::vector<App42User>::iterator it = userResponse->users.begin(); it != userResponse->users.end(); ++it)
        {
            printf("\n User name is %s",it->userName.c_str());
            printf("\n Email is %s",it->email.c_str());
            printf("\n isAccountLocked=%d",it->isAccountLocked);
            //Fetching Profile Info
            printf("\n FirstName=%s",it->profile.firstName.c_str());
            printf("\n LastName=%s",it->profile.lastName.c_str());
            printf("\n Sex=%s",it->profile.getSex().c_str());
            printf("\n Date of Birth=%s",it->profile.dateOfBirth.c_str());
            printf("\n Line1=%s",it->profile.line1.c_str());
            printf("\n Line2=%s",it->profile.line2.c_str());
            printf("\n City=%s",it->profile.city.c_str());
            printf("\n State=%s",it->profile.state.c_str());
            printf("\n Pincode=%s",it->profile.pincode.c_str());
            printf("\n Country=%s",it->profile.country.c_str());
            printf("\n Mobile=%s",it->profile.mobile.c_str());
            printf("\n HomeLandLine=%s",it->profile.homeLandLine.c_str());
            printf("\n OfficeLandLine=%s",it->profile.officeLandLine.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
    }
}
Coming Soon
Coming Soon
Coming Soon
HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
otherMetaHeaders.put("like", "true");
userService.setOtherMetaHeaders(otherMetaHeaders); 
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
User.Profile profileData = new User().new Profile();
profileData.setFirstName("Nick");
profileData.setLastName("Gill");
Vector user = userService.getUsersByProfileData(profileData); 
System.out.println("userName is " + ((User)user.elementAt(0)).getUserName());
System.out.println("emailId is " + ((User)user.elementAt(0)).getEmail());
String jsonResponse = ((User)user.elementAt(0)).toString();    

Exception Handling

The functions available under User API can throw some exceptions in abnormal conditions. For example, If a developer is creating a user with a username which is already in the database, the function will throw the App42Exception (as shown below) with the message as “Bad Request” and the appErrorCode as “2001” and the details as “The request parameters are invalid. Username ‘Nick’ already exists”.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String userName = "Nick";
String pwd = "********";
String emailId = "nick@shephertz.co.in";	
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
userService.createUser( userName, pwd, emailId, new App42CallBack() {
public void onSuccess(Object response) 
{
	User user = (User)response;
	System.out.println("userName is " + user.getUserName());
	System.out.println("emailId is " + user.getEmail());
}
public void onException(Exception ex) 
{
	App42Exception Exception is (App42Exception)ex;
	int appErrorCode = exception.getAppErrorCode();  
	int httpErrorCode = exception.getHttpErrorCode();  
	if(appErrorCode == 2001)
	{
	// Handle here for Bad Request (The request parameters are invalid. Username 'Nick' already exists.)
	}
	else if(appErrorCode  == 2005)
	{
	// Handle here for Bad Request (The request parameters are invalid. User with emailId 'nick@shephertz.co.in' already exists.)
	}
	else if(appErrorCode == 1401)
	{
	// handle here for Client is not authorized
	}
	else if(appErrorCode == 1500)
	{
	// handle here for Internal Server Error
	}
	String jsonText = exception.getMessage();  
	}
});                
String userName = "Nick";   
String pwd  = "*****";
String emailId = "nick@shephertz.co.in";
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();  
userService.CreateUser(userName,pwd,emailId, new Callback());  
public class Callback : App42Callback  
{ 
	public void OnSuccess(Object response)  
	{  
		User user = (User) response;
		String jsonResponse = user.ToString();  
	}
	public void OnException(App42Exception exception)  
	{  
		int appErrorCode = exception.GetAppErrorCode();
		int httpErrorCode = exception.GetHttpErrorCode();
		if(appErrorCode == 2001)
		{
			// Handle here for Bad Request (The request parameters are invalid. Username 'Nick' already exists.)
		}
		else if(appErrorCode  == 2005)
		{
			// Handle here for Bad Request (The request parameters are invalid. User with emailId 'nick@shephertz.co.in' already exists.)
		}
		else if(appErrorCode == 1401)
		{
			// handle here for Client is not authorized
		}
		else if(appErrorCode == 1500)
		{
			// handle here for Internal Server Error
		}
		String jsonText = exception.GetMessage();  
	}    
}  
					
NSString *userName = @"Nick";
NSString *pwd = @"********";
NSString *emailId = @"nick@shephertz.co.in";
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
UserService *userService = [App42API buildUserService]; 
[userService createUser:userName password:pwd emailAddress:emailId completionBlock:^(BOOL success, id responseObj, App42Exception *exception)
{
	if (success)
	{
		User *user = (User*)responseObj;
		NSLog(@"Response=%@",user.strResponse);
	}
	else
	{
		int appErrorCode = exception.appErrorCode;
		int httpErrorCode = exception.httpErrorCode;
		if(appErrorCode == 2001)
		{
			// Handle here for Bad Request (The request parameters are invalid. Username 'Nick' already exists.)
		}
		else if(appErrorCode  == 2005){
			// Handle here for Bad Request (The request parameters are invalid. User with emailId 'nick@shephertz.co.in' already exists.)
		}
		else if(appErrorCode == 1401){
			// handle here for Client is not authorized
		}
		else if(appErrorCode == 1500){
			// handle here for Internal Server Error
		}
		NSString *jsonText = exception.reason; 	
	}
}];                        
Coming Soon
String userName = "Nick";
String pwd = "********";
String emailId = "nick@shephertz.co.in";	
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
try 
{  
User user = userService.createUser(userName, pwd, emailId);  
} 
catch(App42Exception exception) 
{  
	int appErrorCode = exception.getAppErrorCode();  
	int httpErrorCode = exception.getHttpErrorCode();  
	if(appErrorCode == 2001)
	{
		// Handle here for Bad Request (The request parameters are invalid. Username 'Nick' already exists.)
	}
	else if(appErrorCode  == 2005)
	{
		// Handle here for Bad Request (The request parameters are invalid. User with emailId 'nick@shephertz.co.in' already exists.)
	}
	else if(appErrorCode == 1401)
	{
		// handle here for Client is not authorized
	}
	else if(appErrorCode == 1500)
	{
		// handle here for Internal Server Error
	}
	String jsonText = exception.getMessage();    
}     
String userName = "Nick";
String pwd = "********";
String emailId = "nick@shephertz.co.in";
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService();
userService.CreateUser(userName, pwd, emailId, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		User user = (User) response;
		App42Log.Console("userName is " + user.GetUserName());
		App42Log.Console("emailId is " + user.GetEmail()); 
	}
	public void OnException(Exception e)
	{	
		App42Exception exception = (App42Exception)e;
		int appErrorCode = exception.GetAppErrorCode();
		int httpErrorCode = exception.GetHttpErrorCode();
		if(appErrorCode == 2001)
		{
			// Handle here for Bad Request (The request parameters are invalid. Username 'Nick' already exists.)
		}
		else if(appErrorCode  == 2005)
		{
			// Handle here for Bad Request (The request parameters are invalid. User with emailId 'nick@shephertz.co.in' already exists.)
		}
		else if(appErrorCode == 1401)
		{
			// handle here for Client is not authorized
		}
		else if(appErrorCode == 1500)
		{
			// handle here for Internal Server Error
		}
		String jsonText = exception.GetMessage(); 
	}
}
var userName = "Nick",
pwd = "***********",
emailId = "nick@shephertz.co.in",
appErrorCode ;
App42.initialize("API_KEY","SECRET_KEY");
var userService  = new App42User();
userService.createUser(userName, pwd, emailId,{
success: function(object) {
},
error: function(error) 
{
	var userObj = JSON.parse(error);
	appErrorCode = userObj.app42Fault.appErrorCode;
	if(appErrorCode == 2001)
	{
		// Handle here for Bad Request (The request parameters are invalid. Username 'Nick' already exists.)
	}
	else if(appErrorCode  == 2005)
	{
		// Handle here for Bad Request (The request parameters are invalid. User with emailId 'nick@shephertz.co.in' already exists.)
	}
	else if(appErrorCode == 1401)
	{
		// handle here for Client is not authorized
	}
	else if(appErrorCode == 1500)
	{
		// handle here for Internal Server Error
	}
}
});
local userName = "Nick"
local pwd = "********"
local emailId = "nick@shephertz.co.in"
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local userService  = App42API:buildUserService()
userService:createUser(userName, pwd, emailId,App42CallBack)
function App42CallBack:onSuccess(object)
	print("Response Success is "..object:getResponseSuccess())
end
function App42CallBack:onException(exception)
	local appErrorCode = exception:getAppErrorCode()
	if appErrorCode == 2001 then
		-- Handle here for Bad Request (The request parameters are invalid. Username 'Nick' already exists.)
	elseif appErrorCode  == 2005 then
		-- Handle here for Bad Request (The request parameters are invalid. User with emailId 'nick@shephertz.co.in' already exists.)
	elseif appErrorCode == 1401 then
		-- handle here for Client is not authorized
	elseif appErrorCode == 1500 then
		-- handle here for Internal Server Error
	end
end
const char* userName = "Nick";
const char* pwd = "*******";
const char* emailId = "nick@shephertz.co.in";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->CreateUser(userName, pwd, emailId,app42callback(Sample_Class::onUserRequestCompleted, this));
void Sample_Class::onUserRequestCompleted(void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {
        //Handle success response here
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
        if(userResponse->appErrorCode == 2001)
	 	{
			// Handle here for Bad Request (The request parameters are invalid. Username 'Nick' already exists.)
		}
		else if(userResponse->appErrorCode  == 2005)
		{
			// Handle here for Bad Request (The request parameters are invalid. User with emailId 'nick@shephertz.co.in' already exists.)
		}
		else if(userResponse->appErrorCode == 1401)
		{
			// handle here for Client is not authorized
		}
		else if(userResponse->appErrorCode == 1500)
		{
			// handle here for Internal Server Error
		}
    }
}
String userName = "Nick";
String pwd = "********";
String emailId = "nick@shephertz.co.in";
App42API.Initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.BuildUserService(); 
try 
{
	User user = userService.CreateUser(userName, pwd, emailId);
}
catch(App42Exception exception) 
{
	int appErrorCode = exception.GetAppErrorCode();
	int httpErrorCode = exception.GetHttpErrorCode();
	if(appErrorCode == 2001)
	{
		// Handle here for Bad Request (The request parameters are invalid. Username 'Nick' already exists.)
	}
	else if(appErrorCode  == 2005)
	{
		// Handle here for Bad Request (The request parameters are invalid. User with emailId 'nick@shephertz.co.in' already exists.)
	}
	else if(appErrorCode == 1401)
	{
		// handle here for Client is not authorized
	}
	else if(appErrorCode == 1500)
	{
		// handle here for Internal Server Error
	}
	String jsonText = exception.GetMessage(); 	
}        
$userName = "Nick";
$pwd = "********";
$emailId = "nick@shephertz.co.in";
App42API::initialize("API_KEY","SECRET_KEY"); 
$userService = App42API::buildUserService(); 
try
{
	$user = $userService->createUser($userName, $pwd, $emailId);
} catch(App42Exception $exception) 
{
	$appErrorCode =$exception->getAppErrorCode();
	$httpErrorCode = $exception->getHttpErrorCode();
	if($appErrorCode == 2001)
	{
		// Handle here for Bad Request (User by the name 'Nick' does not exist.)
	}
	else if($appErrorCode  == 2005){
		// Handle here for Bad Request (The request parameters are invalid. User with emailId 'nick@shephertz.co.in' already exists.)
	}
	else if($appErrorCode == 1401){
		// handle here for Client is not authorized
	}
	else if($appErrorCode == 1500){
		// handle here for Internal Server Error
	}
	$jsonText = $exception->getMessage(); 	
}
const char* userName = "Nick";
const char* pwd = "*******";
const char* emailId = "nick@shephertz.co.in";
App42API::Initialize("APP_KEY", "SECRET_KEY");
UserService *userService = App42API::BuildUserService();
userService->CreateUser(userName, pwd, emailId,this,app42callfuncND_selector(Sample_Class::onUserRequestCompleted));
void Sample_Class::onUserRequestCompleted(App42CallBack *sender, void *response)
{
    App42UserResponse *userResponse = (App42UserResponse*)response;
    printf("\ncode=%d...=%d",userResponse->getCode(),userResponse->isSuccess);
    printf("\nResponse Body=%s",userResponse->getBody().c_str());
    if (userResponse->isSuccess)
    {
        //Handle success response here
    }
    else
    {
        printf("\nerrordetails:%s",userResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",userResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",userResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",userResponse->httpErrorCode);
        if(userResponse->appErrorCode == 2001)
	 	{
			// Handle here for Bad Request (The request parameters are invalid. Username 'Nick' already exists.)
		}
		else if(userResponse->appErrorCode  == 2005)
		{
			// Handle here for Bad Request (The request parameters are invalid. User with emailId 'nick@shephertz.co.in' already exists.)
		}
		else if(userResponse->appErrorCode == 1401)
		{
			// handle here for Client is not authorized
		}
		else if(userResponse->appErrorCode == 1500)
		{
			// handle here for Internal Server Error
		}
    }
}
userName = "Nick";
pwd = "********";
emailId = "nick@shephertz.com";
api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY")
user_service = api.build_user_service
begin
	user = user_service.create_user(userName, pwd, emailId);
	rescue App42Exception => ex
	appErrorCode = ex.app_error_code;
	httpErrorCode = ex.http_error_code;
	if(appErrorCode == 2001)
		# Handle here for Bad Request (User by the name '<userName>' does not exist.)
	elsif(appErrorCode  == 2005)
		# Handle here for Bad Request (The request parameters are invalid. User with emailId '<emailId>' already exists. )
	elsif(appErrorCode == 1401)
		# handle here for Client is not authorized
	else(appErrorCode == 1500)
		# handle here for Internal Server Error
	end
	jsonText = ex.getMessage(); 
end 
var userName:String = "Nick";
var pwd:String = "********";
var emailId:String = "nick@shephertz.co.in";
App42API.initialize("API_KEY","SECRET_KEY");
var userService:UserService = App42API.buildUserService(); 
userService.createUser(userName, pwd, emailId,new callback()); 
public class callback implements App42CallBack  
{   
	public function onSuccess(response:Object):void  
	{  
		var user :User= User(response);    
		trace("user is " + user) 
	}  
	public function onException(exception:App42Exception):void  
	{  
		var appErrorCode:int = exception.getAppErrorCode();  
		var httpErrorCode:int = exception.getHttpErrorCode();  
		if(appErrorCode == 2001)
		{
			// Handle here for Bad Request (The request parameters are invalid. Username 'Nick' already exists.)
		}
		else if(appErrorCode  == 2005)
		{
			// Handle here for Bad Request (The request parameters are invalid. User with emailId 'nick@shephertz.co.in' already exists.)
		}
		else if(appErrorCode == 1401)
		{
			// handle here for Client is not authorized
		}
		else if(appErrorCode == 1500)
		{
			// handle here for Internal Server Error
		}
	}  	
}  
Coming Soon
String userName = "Nick";
String pwd = "********";
String emailId = "nick@shephertz.co.in";	
App42API.initialize("API_KEY","SECRET_KEY");
UserService userService = App42API.buildUserService(); 
try 
{  
User user = userService.createUser(userName, pwd, emailId);  
} 
catch(App42Exception exception) 
{  
	int appErrorCode = exception.getAppErrorCode();  
	int httpErrorCode = exception.getHttpErrorCode();  
	if(appErrorCode == 2001)
	{
		// Handle here for Bad Request (The request parameters are invalid. Username 'Nick' already exists.)
	}
	else if(appErrorCode  == 2005)
	{
		// Handle here for Bad Request (The request parameters are invalid. User with emailId 'nick@shephertz.co.in' already exists.)
	}
	else if(appErrorCode == 1401)
	{
		// handle here for Client is not authorized
	}
	else if(appErrorCode == 1500)
	{
		// handle here for Internal Server Error
	}
	String jsonText = exception.getMessage();    
}     

Error Codes

Functions in User API might throw exceptions with following HTTP and Application Error Codes (along with their descriptions):

1400 - BAD REQUEST - The requested parameters are invalid 1401 - UNAUTHORIZED - Client is not authorized. 1500 - INTERNAL SERVER ERROR - Internal Server Error. Please try again 2000 - NOT FOUND - User by the name '@userName' does not exist. 2001 - BAD REQUEST - The request parameters are invalid. Username '@userName' already exists. 2002 - NOT FOUND - UserName/Password did not match. Authentication Failed. 2003 - BAD REQUEST - Old Password is not matching for user '@userName'. 2004 - NOT FOUND - User with the emailId '@emailId' does not exist. 2005 - BAD REQUEST - The request parameters are invalid. User with emailId '@emailId' already exists. 2006 - NOT FOUND - Users do not exist. 2007 - NOT FOUND - The number of users are less than the specified offset 2008 - NOT FOUND - The number of locked users are less than the specified offset 2009 - NOT FOUND - Users with the role '@role' do not exist. 2010 - NOT FOUND - No role found for the user '@userName'. 2011 - NOT FOUND - Role '@role' for the user '@userName' does not exist. 2012 - NOT FOUND - Roles for the user '@userName' do not exist.