Session Management Service

The Session Manager manages user sessions on the server side. It is a persistent Session Manager. It allows to save attributes in the session and retrieve them. This Session Manager is especially useful for Mobile/Device Apps which want to do session management.

Import Statement

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • 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.session.Session;
import com.shephertz.app42.paas.sdk.android.session.SessionService;
using com.shephertz.app42.paas.sdk.windows;  
using com.shephertz.app42.paas.sdk.windows.session;   
#import "Shephertz_App42_iOS_API/Shephertz_App42_iOS_API.h"   
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.session.Session;
import com.shephertz.app42.paas.sdk.jme.session.SessionService;
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.session.Session;
import com.shephertz.app42.paas.sdk.java.session.SessionService;
using com.shephertz.app42.paas.sdk.csharp;  
using com.shephertz.app42.paas.sdk.csharp.session;
<script type="text/javascript" src="App42-all-x.x.x.min.js">&lt;/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.session;  
 
include_once '../App42Response.php';  
include_once '../App42Exception.php';  
include_once '../App42BadParameterException.php';  
include_once '../App42NotFoundException.php'; 
include_once '../SessionService.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.session.Session;
import com.shephertz.app42.paas.sdk.as3.session.SessionService;
Coming Soon

Initialize

In order to use various the functions available in a specific API, a developer has to initialize with App42API by passing the apiKey and secretKey which will be created 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 J2ME
  • 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.initialize("API_KEY","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("API_KEY", "SECRET_KEY");
App42API.Initialize("API_KEY","SECRET_KEY");
App42API::initialize("API_KEY","SECRET_KEY");
App42API::Initialize("API_KEY", "SECRET_KEY");
api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") 
App42API.initialize("API_KEY","SECRET_KEY");
Coming Soon

Build Service

After initialization, developer needs 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 Session Service, buildSessionService() method needs to be called.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • 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
SessionService sessionService = App42API.buildSessionManager(); 
SessionService sessionService = App42API.BuildSessionService();  
SessionService *sessionService = [App42API buildSessionService]; 
SessionService sessionService = App42API.buildSessionManager(); 
SessionService sessionService = App42API.buildSessionManager(); 
SessionService sessionService = App42API.BuildSessionService(); 
var sessionService  = new App42Session();
local sessionService  = App42API:buildSessionManager()
SessionService *sessionService = App42API::BuildSessionService();
SessionService sessionService = App42API.BuildSessionService(); 
$sessionService = App42API::buildSessionService();
SessionService *sessionService = App42API::BuildSessionService();
session_service = api.build_session_service()
var sessionService:SessionService = App42API.buildSessionService(); 
Coming Soon

Get Session

Create Session for the User. If the session does not exist it will create a new session.

Required Parameters

userName - Username for which the session has to be created.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • 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";
sessionService.getSession(userName,new App42CallBack() {
public void onSuccess(Object response)
{
	Session session = (Session)response;
	System.out.println("userName is:" + session.getUserName());  
	System.out.println("sessionId is:" + session.getSessionId());  
	System.out.println("Created On is:"+session.getCreatedOn());
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});            
String userName = "Nick";
sessionService.GetSession(userName, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Session session = (Session) response;    
		Console.WriteLine("userName is" + session.GetUserName()); 
		String jsonResponse = session.ToString();  
	}  
}  
	
NSString *userName = @"Nick";
Session *session = [sessionService getSession:userName];  
NSLog(@"User Name is = %@",session.userName);
NSLog(@"SessionId is = %@",session.sessionId);
NSString *jsonResponse = [session toString];                                
String userName = "Nick";
Session session = sessionService.getSession(userName); 
System.out.println("userName is" + session.getUserName());
System.out.println("sessionId is" + session.getSessionId());
String jsonResponse = session.toString();                
String userName = "Nick";
Session session = sessionService.getSession(userName); 
System.out.println("userName is" + session.getUserName());  
System.out.println("sessionId is" + session.getSessionId());  
System.out.println("Created On is:"+session.getCreatedOn());
String jsonResponse = session.toString();            
String userName = "Nick";
App42Log.SetDebug(true);		//Print output in your editor console
sessionService.GetSession(userName, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Session session = (Session) response;    
		App42Log.Console("userName is" + session.GetUserName()); 
		App42Log.Console("userName is" + session.GetSessionId());
		App42Log.Console("userName is" + session.GetCreatedOn());
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var userName = "Nick",
var session ;
sessionService.getSession(userName,{
	success: function(object) {
	var response = JSON.parse(object);  
		session = response.app42.response.session;
		console.log("userName is " + session.userName)
		console.log("sessionId is " + session.sessionId)
		console.log("CreatedOn is " + session.createdOn)
	},
	error: function(error) {
	}
});
local userName  = "Nick"
local App42CallBack = {}
sessionService:getSession(userName, App42CallBack)
function App42CallBack:onSuccess(object)
	print("Session Id is :"..object:getSessionId());
	print("CreatedOn is :"..object:getCreatedOn());
	print("UserName is :"..object:getUserName());
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";
sessionService->GetSession(userName, this, app42callfuncND_selector(Sample_Class::onSessionServiceRequestCompleted));
void Sample_Class::onSessionServiceRequestCompleted(App42CallBack *sender, void *response)
{
    App42SessionResponse *app42SessionResponse = (App42SessionResponse*)response;
    if(app42SessionResponse->isSuccess)
    {
        printf("\ncode=%d",app42SessionResponse->getCode());
        printf("\nisSuccess=%d",app42SessionResponse->isSuccess);
        printf("\nResponse Body=%s",app42SessionResponse->getBody().c_str());
        printf("\nUserName=%s",app42SessionResponse->app42Session.userName.c_str());
        printf("\nSessionId=%s",app42SessionResponse->app42Session.sessionId.c_str());
        printf("\nCreatedOn=%s",app42SessionResponse->app42Session.createdOn.c_str());
    }
    else
    {
        printf("\nerrordetails:%s",app42SessionResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",app42SessionResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",app42SessionResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",app42SessionResponse->httpErrorCode);
    }
}
String userName = "Nick";
Session session = sessionService.GetSession(userName); 
Console.WriteLine("userName is" + session.GetUserName());
Console.WriteLine("sessionId is" + session.GetSessionId());
String jsonResponse = session.ToString();         
$userName = "Nick";
$session = $sessionService->getSession($userName); 
print_r("userName is:" . $session->getUserName());
print_r("sessionId is:" . $session->getSessionId());
print_r("Created On is:" . $session->getCreatedOn());
$jsonResponse = $session->toString();
const char* userName = "Nick";
sessionService->GetSession(userName, this, app42callfuncND_selector(Sample_Class::onSessionServiceRequestCompleted));
void Sample_Class::onSessionServiceRequestCompleted(App42CallBack *sender, void *response)
{
    App42SessionResponse *app42SessionResponse = (App42SessionResponse*)response;
    if(app42SessionResponse->isSuccess)
    {
        printf("\ncode=%d",app42SessionResponse->getCode());
        printf("\nisSuccess=%d",app42SessionResponse->isSuccess);
        printf("\nResponse Body=%s",app42SessionResponse->getBody().c_str());
        printf("\nUserName=%s",app42SessionResponse->app42Session.userName.c_str());
        printf("\nSessionId=%s",app42SessionResponse->app42Session.sessionId.c_str());
        printf("\nCreatedOn=%s",app42SessionResponse->app42Session.createdOn.c_str());
    }
    else
    {
        printf("\nerrordetails:%s",app42SessionResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",app42SessionResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",app42SessionResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",app42SessionResponse->httpErrorCode);
    }
}
userName = "Nick";						
session = session_service.get_session(userName);   
puts "userName is #{session.userName}";
puts "sessionId is #{session.session_id}";
puts "createdOn #{session.created_on}";
json_response = session.to_s(); 
var userName:String = "userName";	
sessionService.getSession(userName,new callback());  
public class callback implements App42CallBack  
{ 
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
	public function onSuccess(response:Object):void  
	{  
		var session:Session = Session(response);
		trace("User Name is : " + session.getUserName());
		trace("SessionId is : " + session.getSessionId());
	}  
}
Coming Soon

Get Session Create

Create User Session based on the isCreate boolean parameter. If isCreate is true and there is an existing session for the user, the existing session is returned. If there is no existing session for the user a new one is created. If isCreate is false and there is an existing session, the existing session is returned if there is no existing session new one is not created.

Required Parameters

userName - Username for which the session has to be created. isCreate - A boolean value for specifying if an existing session is not there, should a new one is to be created or not.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • 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";  
boolean  isCreate = true;  
sessionService.getSession(userName, isCreate, new App42CallBack() {
public void onSuccess(Object response) 
{
	Session session = (Session)response;
	System.out.println("userName is" + session.getUserName());  
	System.out.println("sessionId is" + session.getSessionId());  
	System.out.println("Created On is:"+session.getCreatedOn());
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});           
String userName = "Nick";
Boolean  isCreate = true;  
sessionService.GetSession(userName,isCreate, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Session session = (Session) response;    
		Console.WriteLine("userName is" + session.GetUserName()); 
		Console.WriteLine("userName is" + session.GetSessionId()); 
		Console.WriteLine("userName is" + session.GetCreatedOn()); 
		String jsonResponse = session.ToString();  
	}  
}  
	
NSString *userName = @"Nick";  
BOOL  isCreate = true;  
Session *session = [sessionService getSession:userName isCreate:isCreate];  
NSLog(@"User Name is = %@",session.userName);
NSLog(@"SessionId is = %@",session.sessionId);
NSString *jsonResponse = [session toString];                                
String userName = "Nick";
boolean  isCreate = true;  
Session session = sessionService.getSession(userName,isCreate); 
System.out.println("userName is" + session.getUserName());
System.out.println("sessionId is" + session.getSessionId());
System.out.println("Created On is:"+session.getCreatedOn());
String jsonResponse = session.toString();                
String userName = "Nick";
boolean  isCreate = true;  
Session session = sessionService.getSession(userName,isCreate); 
System.out.println("userName is" + session.getUserName());  
System.out.println("sessionId is" + session.getSessionId());  
System.out.println("Created On is:"+session.getCreatedOn());
String jsonResponse = session.toString();            
String userName = "Nick";
Boolean  isCreate = true;  
App42Log.SetDebug(true);		//Print output in your editor console
sessionService.GetSession(userName,isCreate, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Session session = (Session) response;    
		App42Log.Console("userName is" + session.GetUserName()); 
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
Coming Soon
local userName  = "Nick"
local isCreate = "true" 
local App42CallBack = {}
sessionService:getSessionIsCreate(userName,isCreate ,App42CallBack)
function App42CallBack:onSuccess(object)
	print("Session Id is :"..object:getSessionId());
	print("CreatedOn is :"..object:getCreatedOn());
	print("UserName is :"..object:getUserName());
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";
bool isCreate = true;
sessionService->GetSession(userName, isCreate, this, app42callfuncND_selector(Sample_Class::onSessionServiceRequestCompleted));
void Sample_Class::onSessionServiceRequestCompleted(App42CallBack *sender, void *response)
{
    App42SessionResponse *app42SessionResponse = (App42SessionResponse*)response;
    if(app42SessionResponse->isSuccess)
    {
        printf("\ncode=%d",app42SessionResponse->getCode());
        printf("\nisSuccess=%d",app42SessionResponse->isSuccess);
        printf("\nResponse Body=%s",app42SessionResponse->getBody().c_str());
        printf("\nUserName=%s",app42SessionResponse->app42Session.userName.c_str());
        printf("\nSessionId=%s",app42SessionResponse->app42Session.sessionId.c_str());
        printf("\nCreatedOn=%s",app42SessionResponse->app42Session.createdOn.c_str());
    }
    else
    {
        printf("\nerrordetails:%s",app42SessionResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",app42SessionResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",app42SessionResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",app42SessionResponse->httpErrorCode);
    }
}
String userName = "Nick";
Boolean  isCreate = true;  
Session session = sessionService.GetSession(userName,isCreate); 
Console.WriteLine("userName is" + session.GetUserName());
Console.WriteLine("sessionId is" + session.GetSessionId());
String jsonResponse = session.ToString();         
$userName = "Nick";
$isCreate = "true";  
$session = $sessionService->getSession($userName,$isCreate); 
print_r("userName is" . $session->getUserName());
print_r("sessionId is" . $session->getSessionId());
print_r("Created On is:" . $session->getCreatedOn());
$jsonResponse = $session->toString();
const char* userName = "Nick";
bool isCreate = true;
sessionService->GetSession(userName, isCreate, this, app42callfuncND_selector(Sample_Class::onSessionServiceRequestCompleted));
void Sample_Class::onSessionServiceRequestCompleted(App42CallBack *sender, void *response)
{
    App42SessionResponse *app42SessionResponse = (App42SessionResponse*)response;
    if(app42SessionResponse->isSuccess)
    {
        printf("\ncode=%d",app42SessionResponse->getCode());
        printf("\nisSuccess=%d",app42SessionResponse->isSuccess);
        printf("\nResponse Body=%s",app42SessionResponse->getBody().c_str());
        printf("\nUserName=%s",app42SessionResponse->app42Session.userName.c_str());
        printf("\nSessionId=%s",app42SessionResponse->app42Session.sessionId.c_str());
        printf("\nCreatedOn=%s",app42SessionResponse->app42Session.createdOn.c_str());
    }
    else
    {
        printf("\nerrordetails:%s",app42SessionResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",app42SessionResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",app42SessionResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",app42SessionResponse->httpErrorCode);
    }
}
userName = "Nick";
isCreate = true;
session = session_service.get_session_boolean(userName, isCreate);
puts "userName is #{session.userName}";
puts "sessionId is #{session.session_id}";
puts "createdOn #{session.created_on}"; 
json_response = session.to_s();
var userName:String = "userName";	
var isCreate:Boolean = true;
sessionService.getSessionIsCreate(userName, isCreate,new callback()); 
public class callback implements App42CallBack  
{ 
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
	public function onSuccess(response:Object):void  
	{  
		var session:Session = Session(response);
		trace("response is : " + session);
		trace("User Name is : " + session.getUserName());
		trace("SessionId is : " + session.getSessionId());
	}  
}
Coming Soon

Invalidate

Invalidate a session based on the session id. All the attributes store in the session will be lost.

Required Parameters

sessionId - The session id for which the session has to be invalidated.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • 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 = "sessionId";
sessionService.invalidate(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 = "sessionId";
sessionService.Invalidate(sessionId, new Callback());  
public class Callback : App42Callback 
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		App42Response user = (App42Response) response;     
		String jsonResponse = user.ToString();  
	}  
}  
NSString *sessionId = @"sessionId";
App42Response *response = [sessionService invalidate:sessionId]; 
NSString *success = response.isResponseSuccess;
NSString *jsonResponse = [response toString];                             
String sessionId = "sessionId";
App42Response app42response = sessionService.invalidate(sessionId); 
System.out.println("response is " + app42response); 
boolean  success = app42response.isResponseSuccess();
String jsonResponse = app42response.toString(); 
String sessionId = "sessionId";
App42Response response = sessionService.invalidate(sessionId); 
boolean  success = response.isResponseSuccess();
String jsonResponse = response.toString(); 
String sessionId = "sessionId";
App42Log.SetDebug(true);		//Print output in your editor console
sessionService.Invalidate(sessionId, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		App42Log.Console("Success : " + response);
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var sessionId = "sessionId",
response ;  
sessionService.invalidate(sessionId,{  
	success: function(object) 
	{  
		var sessionObj = JSON.parse(object);  
		response = sessionObj.app42.response;
		console.log("response is " + response)
	},  
	error: function(error) {  
	}  
}); 
local sessionId  = "sessionId"
local App42CallBack = {}
sessionService:invalidate(sessionId ,App42CallBack)
function App42CallBack:onSuccess(object)
	print("Session Id is :"..object:getSessionId())
	print("CreatedOn is :"..object:getCreatedOn())
	print("UserName is :"..object:getUserName())
	print("InvalidatedOn is :"..object:getInvalidatedOn())   
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 = "sessionId";
sessionService->Invalidate(sessionId, this, app42callfuncND_selector(Sample_Class::onSessionServiceRequestCompleted));
void Sample_Class::onSessionServiceRequestCompleted(App42CallBack *sender, void *response)
{
    App42SessionResponse *app42SessionResponse = (App42SessionResponse*)response;
    if(app42SessionResponse->isSuccess)
    {
        printf("\ncode=%d",app42SessionResponse->getCode());
        printf("\nisSuccess=%d",app42SessionResponse->isSuccess);
        printf("\nResponse Body=%s",app42SessionResponse->getBody().c_str());
        printf("\nSessionId=%s",app42SessionResponse->app42Session.sessionId.c_str());
        printf("\nCreatedOn=%s",app42SessionResponse->app42Session.createdOn.c_str());
        printf("\nInvalidatedOn=%s",app42SessionResponse->app42Session.invalidatedOn.c_str());
    }
    else
    {
        printf("\nerrordetails:%s",app42SessionResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",app42SessionResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",app42SessionResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",app42SessionResponse->httpErrorCode);
    }
}
String sessionId = "sessionId";
App42Response response = sessionService.Invalidate(sessionId); 
Boolean  success = response.IsResponseSuccess();
String jsonResponse = response.ToString(); 
$sessionId = "sessionId";
$response = $sessionService->invalidate($sessionId); 
print_r("Response is :". $response->toString());
$success = $response->isResponseSuccess();
$jsonResponse = $response->toString(); 
const char* sessionId = "sessionId";
sessionService->Invalidate(sessionId, this, app42callfuncND_selector(Sample_Class::onSessionServiceRequestCompleted));
void Sample_Class::onSessionServiceRequestCompleted(App42CallBack *sender, void *response)
{
    App42SessionResponse *app42SessionResponse = (App42SessionResponse*)response;
    if(app42SessionResponse->isSuccess)
    {
        printf("\ncode=%d",app42SessionResponse->getCode());
        printf("\nisSuccess=%d",app42SessionResponse->isSuccess);
        printf("\nResponse Body=%s",app42SessionResponse->getBody().c_str());
        printf("\nSessionId=%s",app42SessionResponse->app42Session.sessionId.c_str());
        printf("\nCreatedOn=%s",app42SessionResponse->app42Session.createdOn.c_str());
        printf("\nInvalidatedOn=%s",app42SessionResponse->app42Session.invalidatedOn.c_str());
    }
    else
    {
        printf("\nerrordetails:%s",app42SessionResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",app42SessionResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",app42SessionResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",app42SessionResponse->httpErrorCode);
    }
}
sessionId = "sessionId";						
response = session_service.invalidate(sessionId); 
success = response.is_response_success();
json_response = session.to_s(); 
var sessionId:String = "sessionId";	
sessionService.invalidate(sessionId,new callback());
public class callback implements App42CallBack  
{ 
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
	public function onSuccess(response:Object):void  
	{  
		var session:Session = Session(response);
		trace("User Name is : " + session.getUserName());
		trace("SessionId is : " + session.getSessionId());
	}  
}
Coming Soon 

Set Attribute

Sets attribute in a session whose session id is provided. The attributes are stored in a key value pair.

Required Parameters

sessionId - Session id for which the attribute has to be saved. attributeName - The attribute key that needs to be stored. attributeValue - The attribute value that needs to be stored.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • 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 = "sessionId";
String attributeName = "attributeName";  
String  attributeValue = "attributeValue";  
sessionService.setAttribute(sessionId, attributeName, attributeValue, new App42CallBack() {					
public void onSuccess(Object response) 
{
	Session session = (Session)response;
	System.out.println("sessionId is" + session.getSessionId()); 				
	System.out.println("Attribute Name is " + session.getAttributeList().get(0).getName());  
	System.out.println("Attribute Value is " + session.getAttributeList().get(0).getValue());  
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});           
String sessionId = "sessionId";
String attributeName = "attributeName";  
String  attributeValue = "attributeValue";  
sessionService.SetAttribute(sessionId,attributeName,attributeValue, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Session session = (Session) response;    
		Console.WriteLine("sessionId is" + session.GetSessionId()); 
		String jsonResponse = session.ToString();  
	}  
}  
	
NSString *sessionId = @"sessionId";
NSString *attributeName = @"attributeName";  
NSString *attributeValue = @"attributeValue";  
Session *session = [sessionService setAttribute:sessionId attributeName:attributeName attributeValue:attributeValue];
NSLog(@"SessionId is = %@",session.sessionId);
NSString *jsonResponse = [session toString];                                
String sessionId = "sessionId";
String attributeName = "attributeName";  
String  attributeValue = "attributeValue";  
Session session = sessionService.setAttribute(sessionId,attributeName,attributeValue); 
System.out.println("sessionId is" + session.getSessionId());
System.out.println("Attribute Name is " + session.getAttributeList().get(0).getName());  
System.out.println("Attribute Value is " + session.getAttributeList().get(0).getValue());  
String jsonResponse = session.toString();                
String sessionId = "sessionId";
String attributeName = "attributeName";  
String  attributeValue = "attributeValue";  
Session session = sessionService.setAttribute(sessionId,attributeName,attributeValue); 
System.out.println("sessionId is" + session.getSessionId()); 				
System.out.println("Attribute Name is " + session.getAttributeList().get(0).getName());  
System.out.println("Attribute Value is " + session.getAttributeList().get(0).getValue());  
String jsonResponse = session.toString();            
String sessionId = "sessionId";
String attributeName = "attributeName";  
String  attributeValue = "attributeValue";  
App42Log.SetDebug(true);		//Print output in your editor console
sessionService.SetAttribute(sessionId, attributeName, attributeValue, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Session session = (Session) response;    
		App42Log.Console("sessionId is" + session.GetSessionId()); 
		App42Log.Console("Attribute Name is " + session.GetAttributeList().get[0].GetName());  
		App42Log.Console("Attribute Value is " + session.GetAttributeList()[0].GetValue());  
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var sessionId = "sessionId";
var attributeName = "attributeName";  
var  attributeValue = "attributeValue";  
var session ;
sessionService.setAttribute(sessionId,attributeName,attributeValue,{
	success: function(object) {
	var response = JSON.parse(object);  
		session = response.app42.response.session;
		console.log("sessionId is " + session.sessionId)
	},
	error: function(error) {
	}
});
local sessionId  = "sessionId"
local attributeName = "attributeName" 
local  attributeValue = "attributeValue"  
local App42CallBack = {}
sessionService:setAttribute(sessionId, attributeName,attributeValue ,App42CallBack)
function App42CallBack:onSuccess(object)
	print("Session Id is :"..object:getSessionId());
	print("Attribute Name :"..object:getAttributeList():getName())
	print("Value is: "..object:getAttributeList():getValue());   
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 = "sessionId";
const char* attributeName = "attributeName";  
const char*  attributeValue = "attributeValue";  
sessionService->SetAttribute(sessionId, attributeName, attributeValue, this, app42callfuncND_selector(Sample_Class::onSessionServiceRequestCompleted));
void Sample_Class::onSessionServiceRequestCompleted(App42CallBack *sender, void *response)
{
    App42SessionResponse *app42SessionResponse = (App42SessionResponse*)response;
    if(app42SessionResponse->isSuccess)
    {
        printf("\ncode=%d",app42SessionResponse->getCode());
        printf("\nisSuccess=%d",app42SessionResponse->isSuccess);
        printf("\nResponse Body=%s",app42SessionResponse->getBody().c_str());
        printf("\nSessionId=%s",app42SessionResponse->app42Session.sessionId.c_str());
        printf("\nCreatedOn=%s",app42SessionResponse->app42Session.createdOn.c_str());        
        vector<App42Attribute> attributesArray = app42SessionResponse->app42Session.attributeArray;
        for(std::vector<App42Attribute>::iterator attribute = attributesArray.begin(); attribute != attributesArray.end(); ++attribute)
        {
            printf("\n Name=%s",attribute->name.c_str());
            printf("\n Value=%s\n",attribute->value.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",app42SessionResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",app42SessionResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",app42SessionResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",app42SessionResponse->httpErrorCode);
    }
}
String sessionId = "sessionId";
String attributeName = "attributeName";  
String  attributeValue = "attributeValue";  
Session session = sessionService.SetAttribute(sessionId,attributeName,attributeValue); 
Console.WriteLine("sessionId is" + session.GetSessionId());
String jsonResponse = session.ToString();         
$sessionId = "sessionId";
$attributeName = "attributeName";  
$attributeValue = "attributeValue";  
$session = $sessionService->setAttribute($sessionId,$attributeName,$attributeValue); 
print_r("sessionId is" . $session->getSessionId());
$attributeList = $session->getAttributeList();
foreach ($attributeList as $attribute) 
{
	print_r("Attribute Name is " . $attribute->getName());
	print_r("Attribute Value is " . $attribute->getValue());
}
$jsonResponse = $session->toString();
const char* sessionId = "sessionId";
const char* attributeName = "attributeName";  
const char*  attributeValue = "attributeValue";  
sessionService->SetAttribute(sessionId, attributeName, attributeValue, this, app42callfuncND_selector(Sample_Class::onSessionServiceRequestCompleted));
void Sample_Class::onSessionServiceRequestCompleted(App42CallBack *sender, void *response)
{
    App42SessionResponse *app42SessionResponse = (App42SessionResponse*)response;
    if(app42SessionResponse->isSuccess)
    {
        printf("\ncode=%d",app42SessionResponse->getCode());
        printf("\nisSuccess=%d",app42SessionResponse->isSuccess);
        printf("\nResponse Body=%s",app42SessionResponse->getBody().c_str());
        printf("\nSessionId=%s",app42SessionResponse->app42Session.sessionId.c_str());
        printf("\nCreatedOn=%s",app42SessionResponse->app42Session.createdOn.c_str());        
        vector<App42Attribute> attributesArray = app42SessionResponse->app42Session.attributeArray;
        for(std::vector<App42Attribute>::iterator attribute = attributesArray.begin(); attribute != attributesArray.end(); ++attribute)
        {
            printf("\n Name=%s",attribute->name.c_str());
            printf("\n Value=%s\n",attribute->value.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",app42SessionResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",app42SessionResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",app42SessionResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",app42SessionResponse->httpErrorCode);
    }
}
sessionId = "sessionId";
attributeName = "attributeName";
attributeValue = "attributeValue";						
session = session_service.set_attribute(sessionId, attributeName, attributeValue);
puts "sessionId is #{session.sessionId}";
attribute_list = Array.new();
attribute_list = session.attribute_list();
for attrbute in attribute_list do
  puts "name is #{attribute.name}";
  puts "attribute is #{attribute.value}";
end
json_response = session.to_s();
var sessionId:String = "sessionId";
var attributeName:String = "attributeName";  
var attributeValue:String = "attributeValue"; 
sessionService.setAttribute(sessionId,attributeName,attributeValue,new callback());	
public class callback implements App42CallBack  
{ 
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
	public function onSuccess(response:Object):void  
	{  
		var session:Session = Session(response);
		trace("SessionId is : " + session.getSessionId());
		if(session.getAttributeList() != null){
		var sessionList:Array = session.getAttributeList();
		for(var j:int= 0;j < sessionList.length;j++)
		{
			trace("attributeName is : " + Attribute(sessionList[0]).getName());
			trace("attributeValue is : " + Attribute(sessionList[0]).getValue());
		}
	}  
}
Coming Soon

Get Attribute

Gets the attribute value in a session whose session id is provided.

Required Parameters

sessionId - The session id for which the attribute has to be fetched. attributeName - The attribute key that has to be fetched.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • 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 = "sessionId";
String attributeName = "attributeName";  
sessionService.getAttribute(sessionId, attributeName, new App42CallBack() {
public void onSuccess(Object response)
 {
	Session session = (Session)response;
	System.out.println("sessionId is" + session.getSessionId()); 				
	System.out.println("Attribute Name is " + session.getAttributeList().get(0).getName());  
	System.out.println("Attribute Value is " + session.getAttributeList().get(0).getValue());  
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});           
String sessionId = "sessionId";
String attributeName = "attributeName";  
sessionService.GetAttribute(sessionId,attributeName, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Session session = (Session) response;    
		Console.WriteLine("sessionId is" + session.GetSessionId()); 
		String jsonResponse = session.ToString();  
	}  
}  
	
NSString *sessionId = @"sessionId";
NSString *attributeName = @"attributeName";  
Session *session = [sessionService getAttribute:sessionId attributeName:attributeName];
NSLog(@"SessionId is = %@",session.sessionId);
NSString *jsonResponse = [session toString];                                
String sessionId = "sessionId";
String attributeName = "attributeName";  
Session session = sessionService.getAttribute(sessionId,attributeName); 
System.out.println("sessionId is" + session.getSessionId());
String jsonResponse = session.toString();                
String sessionId = "sessionId";
String attributeName = "attributeName";  
Session session = sessionService.getAttribute(sessionId,attributeName); 
System.out.println("sessionId is" + session.getSessionId()); 				
System.out.println("Attribute Name is " + session.getAttributeList().get(0).getName());  
System.out.println("Attribute Value is " + session.getAttributeList().get(0).getValue());  
String jsonResponse = session.toString();            
String sessionId = "sessionId";
String attributeName = "attributeName";  
App42Log.SetDebug(true);		//Print output in your editor console
sessionService.GetAttribute(sessionId, attributeName, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Session session = (Session) response;    
		App42Log.Console("sessionId is" + session.GetSessionId()); 
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var sessionId = "sessionId";
var attributeName = "attributeName";  
var session ;
sessionService.getAttribute(sessionId,attributeName,{
	success: function(object) {
	var response = JSON.parse(object);  
		session = response.app42.response.session;
		console.log("sessionId is " + session.sessionId)
	},
	error: function(error) {
	}
});
local sessionId  = "sessionId"
local attributeName = "attributeName" 
local App42CallBack = {}
sessionService:getAttribute(sessionId,attributeName ,App42CallBack)
function App42CallBack:onSuccess(object)
	print("Session Id is :"..object:getSessionId());
	print("Attribute Name :"..object:getAttributeList():getName())
	print("Value is: "..object:getAttributeList():getValue());   
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 = "sessionId";
const char* attributeName = "attributeName"; 
sessionService->GetAttribute(sessionId, attributeName, this, app42callfuncND_selector(Sample_Class::onSessionServiceRequestCompleted));
void Sample_Class::onSessionServiceRequestCompleted(App42CallBack *sender, void *response)
{
    App42SessionResponse *app42SessionResponse = (App42SessionResponse*)response;
    if(app42SessionResponse->isSuccess)
    {
        printf("\ncode=%d",app42SessionResponse->getCode());
        printf("\nisSuccess=%d",app42SessionResponse->isSuccess);
        printf("\nResponse Body=%s",app42SessionResponse->getBody().c_str());
        printf("\nSessionId=%s",app42SessionResponse->app42Session.sessionId.c_str());
        printf("\nCreatedOn=%s",app42SessionResponse->app42Session.createdOn.c_str());        
        vector<App42Attribute> attributesArray = app42SessionResponse->app42Session.attributeArray;
        for(std::vector<App42Attribute>::iterator attribute = attributesArray.begin(); attribute != attributesArray.end(); ++attribute)
        {
            printf("\n Name=%s",attribute->name.c_str());
            printf("\n Value=%s\n",attribute->value.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",app42SessionResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",app42SessionResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",app42SessionResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",app42SessionResponse->httpErrorCode);
    }
}
String sessionId = "sessionId";
String attributeName = "attributeName";  
Session session = sessionService.GetAttribute(sessionId,attributeName); 
Console.WriteLine("sessionId is" + session.GetSessionId());
String jsonResponse = session.ToString();         
$sessionId = "sessionId";
$attributeName = "attributeName";  
$session = $sessionService->getAttribute($sessionId,$attributeName); 
print_r("sessionId is" . $session->getSessionId());
$attributeList = $session->getAttributeList();
foreach ($attributeList as $attribute) 
{
	print_r("Attribute Name is " . $attribute->getName());
	print_r("Attribute Value is " . $attribute->getValue());
}
$jsonResponse = $session->toString();                       
const char* sessionId = "sessionId";
const char* attributeName = "attributeName"; 
sessionService->GetAttribute(sessionId, attributeName, this, app42callfuncND_selector(Sample_Class::onSessionServiceRequestCompleted));
void Sample_Class::onSessionServiceRequestCompleted(App42CallBack *sender, void *response)
{
    App42SessionResponse *app42SessionResponse = (App42SessionResponse*)response;
    if(app42SessionResponse->isSuccess)
    {
        printf("\ncode=%d",app42SessionResponse->getCode());
        printf("\nisSuccess=%d",app42SessionResponse->isSuccess);
        printf("\nResponse Body=%s",app42SessionResponse->getBody().c_str());
        printf("\nSessionId=%s",app42SessionResponse->app42Session.sessionId.c_str());
        printf("\nCreatedOn=%s",app42SessionResponse->app42Session.createdOn.c_str());        
        vector<App42Attribute> attributesArray = app42SessionResponse->app42Session.attributeArray;
        for(std::vector<App42Attribute>::iterator attribute = attributesArray.begin(); attribute != attributesArray.end(); ++attribute)
        {
            printf("\n Name=%s",attribute->name.c_str());
            printf("\n Value=%s\n",attribute->value.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",app42SessionResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",app42SessionResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",app42SessionResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",app42SessionResponse->httpErrorCode);
    }
}
sessionId = "sessionId";
attributeName = "attributeName";						
session = session_service.get_attribute(sessionId, attributeName); 
puts "sessionId is #{session.sessionId}";
attribute_list = Array.new();
attribute_list = session.attribute_list();
for  attribute in attribute_list do
  puts "name is #{attribute.name}";
  puts "attribute is #{attribute.value}";
end
json_response = session.to_s();
var sessionId:String = "sessionId";
var attributeName:String = "attributeName";  
sessionService.getAttribute(sessionId,attributeName,new callback());
public class callback implements App42CallBack  
{ 
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
	public function onSuccess(response:Object):void  
	{  
		var session:Session = Session(response);
		trace("SessionId is : " + session.getSessionId());
		if(session.getAttributeList() != null){
		var sessionList:Array = session.getAttributeList();
		for(var j:int= 0;j < sessionList.length;j++)
		{
			trace("attributeName is : " + Attribute(sessionList[0]).getName());
			trace("attributeValue is : " + Attribute(sessionList[0]).getValue());
		}
	}  
}
Coming Soon

Get All Attributes

Gets all the attributes for a given session id.

Required Parameters

sessionId - The session id for which the attribute has to be fetched.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • 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 = "sessionId";
sessionService.getAllAttributes(sessionId,	new App42CallBack() {
public void onSuccess(Object response) {
	Session session = (Session)response;
	System.out.println("sessionId is" + session.getSessionId());  
	ArrayList<Session.Attribute> attributeList = session.getAttributeList();   
	for(Session.Attribute attribute :attributeList )  
	{      
		System.out.println("name is" + attribute.getName());  
		System.out.println("value is" + attribute.getValue());  
	} 
}
public void onException(Exception ex)
{
	System.out.println("Exception Message"+ex.getMessage());
}
});           
String sessionId = "sessionId";
sessionService.GetAllAttributes(sessionId, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Session session = (Session) response;    
		Console.WriteLine("sessionId is" + session.GetSessionId()); 
		String jsonResponse = session.ToString();  
	}  
}  
	
NSString *sessionId = @"sessionId";
Session *session = [sessionService getAllAttributes:sessionId];
NSLog(@"SessionId is = %@",session.sessionId);
NSString *jsonResponse = [session toString];                                
String sessionId = "sessionId";
Session session = sessionService.getAllAttributes(sessionId); 
System.out.println("sessionId is" + session.getSessionId());
String jsonResponse = session.toString();                
String sessionId = "sessionId";
Session session = sessionService.getAllAttributes(sessionId); 
System.out.println("sessionId is" + session.getSessionId());  
ArrayList<Session.Attribute> attributeList = session.getAttributeList();   
for(Session.Attribute attribute :attributeList )  
{      
	System.out.println("name is" + attribute.getName());  
	System.out.println("value is" + attribute.getValue());  
} 
String jsonResponse = session.toString();            
String sessionId = "sessionId";
App42Log.SetDebug(true);		//Print output in your editor console
sessionService.GetAllAttributes(sessionId, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Session session = (Session) response;    
		App42Log.Console("sessionId is" + session.GetSessionId()); 
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var sessionId = "sessionId";
var session ;
sessionService.getAllAttributes(sessionId,{
	success: function(object) {
	var response = JSON.parse(object);  
		session = response.app42.response.session;
		console.log("sessionId is " + session.sessionId)
	},
	error: function(error) {
	}
});
local sessionId  = "sessionId"
local App42CallBack = {}
sessionService:getAllAttributes(sessionId ,App42CallBack)
function App42CallBack:onSuccess(object)
	print("Session Id is :"..object:getSessionId());
    if table.getn(object:getAttributeList()) >1 then   
	for i=1,table.getn(object:getAttributeList()) do  
		print("GetName :"..object:getAttributeList()[i]:getName())
		print("Value is: "..object:getAttributeList()[i]:getValue()); 
	end  
	else  
		print("GetName :"..object:getAttributeList():getName())
		print("Value is: "..object:getAttributeList():getValue()); 
	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
const char* sessionId = "sessionId";
sessionService->GetAllAttributes(sessionId, this, app42callfuncND_selector(Sample_Class::onSessionServiceRequestCompleted));
void Sample_Class::onSessionServiceRequestCompleted(App42CallBack *sender, void *response)
{
    App42SessionResponse *app42SessionResponse = (App42SessionResponse*)response;
    if(app42SessionResponse->isSuccess)
    {
        printf("\ncode=%d",app42SessionResponse->getCode());
        printf("\nisSuccess=%d",app42SessionResponse->isSuccess);
        printf("\nResponse Body=%s",app42SessionResponse->getBody().c_str());
        printf("\nSessionId=%s",app42SessionResponse->app42Session.sessionId.c_str());
        printf("\nCreatedOn=%s",app42SessionResponse->app42Session.createdOn.c_str());        
        vector<App42Attribute> attributesArray = app42SessionResponse->app42Session.attributeArray;
        for(std::vector<App42Attribute>::iterator attribute = attributesArray.begin(); attribute != attributesArray.end(); ++attribute)
        {
            printf("\n Name=%s",attribute->name.c_str());
            printf("\n Value=%s\n",attribute->value.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",app42SessionResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",app42SessionResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",app42SessionResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",app42SessionResponse->httpErrorCode);
    }
}
String sessionId = "sessionId";
Session session = sessionService.GetAllAttributes(sessionId); 
Console.WriteLine("sessionId is" + session.GetSessionId());
String jsonResponse = session.ToString();         
$sessionId = "sessionId";
$session = $sessionService->getAllAttributes($sessionId); 
print_r("sessionId is" . $session->getSessionId());
$attributeList = $session->getAttributeList();
foreach ($attributeList as $attribute) 
{
	print_r("Attribute Name is :" . $attribute->getName());
	print_r("Attribute Value is :" . $attribute->getValue());
}
$jsonResponse = $session->toString();                         
const char* sessionId = "sessionId";
sessionService->GetAllAttributes(sessionId, this, app42callfuncND_selector(Sample_Class::onSessionServiceRequestCompleted));
void Sample_Class::onSessionServiceRequestCompleted(App42CallBack *sender, void *response)
{
    App42SessionResponse *app42SessionResponse = (App42SessionResponse*)response;
    if(app42SessionResponse->isSuccess)
    {
        printf("\ncode=%d",app42SessionResponse->getCode());
        printf("\nisSuccess=%d",app42SessionResponse->isSuccess);
        printf("\nResponse Body=%s",app42SessionResponse->getBody().c_str());
        printf("\nSessionId=%s",app42SessionResponse->app42Session.sessionId.c_str());
        printf("\nCreatedOn=%s",app42SessionResponse->app42Session.createdOn.c_str());        
        vector<App42Attribute> attributesArray = app42SessionResponse->app42Session.attributeArray;
        for(std::vector<App42Attribute>::iterator attribute = attributesArray.begin(); attribute != attributesArray.end(); ++attribute)
        {
            printf("\n Name=%s",attribute->name.c_str());
            printf("\n Value=%s\n",attribute->value.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",app42SessionResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",app42SessionResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",app42SessionResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",app42SessionResponse->httpErrorCode);
    }
}
sessionId = "sessionId";
session = session_service.get_all_attribute(sessionId); 
puts "sessionId is #{session.sessionId}";
attribute_list = Array.new();
attribute_list = session.attribute_list();
for attribute in attribute_list do
  puts "name is #{attribute.name}";
  puts "attribute is #{attribute.value}";
end
json_response = session.to_s();
var sessionId:String = "sessionId"; 
sessionService.getAllAttributes(sessionId,new callback());
public class callback implements App42CallBack  
{ 
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
	public function onSuccess(response:Object):void  
	{  
		var session:Session = Session(response);
		trace("SessionId is : " + session.getSessionId());
		if(session.getAttributeList() != null){
		var sessionList:Array = session.getAttributeList();
		for(var j:int= 0;j < sessionList.length;j++)
		{
			trace("attributeName is : " + Attribute(sessionList[0]).getName());
			trace("attributeValue is : " + Attribute(sessionList[0]).getValue());
		}
	}  
}
Coming Soon

Remove Attribute

Removes the attribute from a session whose session id is provided.

Required Parameters

sessionId - The session id for which the attribute has to be removed. attributeName - The attribute key that has to be removed.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • 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 = "sessionId";
String attributeName = "attributeName";  
sessionService.removeAttribute(sessionId,attributeName, 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 = "sessionId";
String attributeName = "attributeName";  
sessionService.RemoveAttribute(sessionId,attributeName, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		App42Response user = (App42Response) response;     
		String jsonResponse = user.ToString();  
	}  
}  
NSString *sessionId = @"sessionId";
NSString *attributeName = @"attributeName";  
App42Response *response = [sessionService removeAttribute:sessionId attributeName:attributeName]; 
NSString *success = response.isResponseSuccess;
NSString *jsonResponse = [response toString];                             
String sessionId = "sessionId";
String attributeName = "attributeName";  
App42Response response = sessionService.removeAttribute(sessionId,attributeName); 
boolean  success = response.isResponseSuccess();
String jsonResponse = response.toString(); 
String sessionId = "sessionId";
String attributeName = "attributeName";  
App42Response app42response = sessionService.removeAttribute(sessionId,attributeName);
System.out.println("response is " + app42response) ; 
boolean  success = app42response.isResponseSuccess();
String jsonResponse = app42response.toString(); 
String sessionId = "sessionId";
String attributeName = "attributeName";  
App42Log.SetDebug(true);		//Print output in your editor console
sessionService.RemoveAttribute(sessionId, attributeName, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		App42Log.Console("Success : " + response);
		App42Response user = (App42Response) response;
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var sessionId = "sessionId",
attributeName = "attributeName",
response ;  
sessionService.removeAttribute(sessionId,attributeName,{  
	success: function(object) 
	{  
		var sessionObj = JSON.parse(object);  
		response = sessionObj.app42.response;
		console.log("response is " + response)
	},  
	error: function(error) {  
	}  
}); 
local sessionId  = "sessionId"
local attributeName = "attributeName"
local App42CallBack = {}
sessionService:removeAttribute(sessionId, attributeName ,App42CallBack)
function App42CallBack:onSuccess(object)
	print("Response is :"..object:getStrResponse()); 
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 = "sessionId";
const char* attributeName = "attributeName"; 
sessionService->RemoveAttribute(sessionId, attributeName, this, app42callfuncND_selector(Sample_Class::onSessionServiceRequestCompleted));
void Sample_Class::onSessionServiceRequestCompleted(App42CallBack *sender, void *response)
{
    App42SessionResponse *app42SessionResponse = (App42SessionResponse*)response;
    if(app42SessionResponse->isSuccess)
    {
        printf("\ncode=%d",app42SessionResponse->getCode());
        printf("\nisSuccess=%d",app42SessionResponse->isSuccess);
        printf("\nResponse Body=%s",app42SessionResponse->getBody().c_str());
        printf("\nSessionId=%s",app42SessionResponse->app42Session.sessionId.c_str());
        printf("\nCreatedOn=%s",app42SessionResponse->app42Session.createdOn.c_str());        
        vector<App42Attribute> attributesArray = app42SessionResponse->app42Session.attributeArray;
        for(std::vector<App42Attribute>::iterator attribute = attributesArray.begin(); attribute != attributesArray.end(); ++attribute)
        {
            printf("\n Name=%s",attribute->name.c_str());
            printf("\n Value=%s\n",attribute->value.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",app42SessionResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",app42SessionResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",app42SessionResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",app42SessionResponse->httpErrorCode);
    }
}
String sessionId = "sessionId";
String attributeName = "attributeName";  
App42Response response = sessionService.RemoveAttribute(sessionId,attributeName); 
Boolean  success = response.IsResponseSuccess();
String jsonResponse = response.ToString(); 
$sessionId = "sessionId";
$attributeName = "attributeName";  
$response = $sessionService->removeAttribute($sessionId,$attributeName); 
print_r("Response is : ".$response->toString());
$success = $response->isResponseSuccess();
$jsonResponse = $response->toString(); 
const char* sessionId = "sessionId";
const char* attributeName = "attributeName"; 
sessionService->RemoveAttribute(sessionId, attributeName, this, app42callfuncND_selector(Sample_Class::onSessionServiceRequestCompleted));
void Sample_Class::onSessionServiceRequestCompleted(App42CallBack *sender, void *response)
{
    App42SessionResponse *app42SessionResponse = (App42SessionResponse*)response;
    if(app42SessionResponse->isSuccess)
    {
        printf("\ncode=%d",app42SessionResponse->getCode());
        printf("\nisSuccess=%d",app42SessionResponse->isSuccess);
        printf("\nResponse Body=%s",app42SessionResponse->getBody().c_str());
        printf("\nSessionId=%s",app42SessionResponse->app42Session.sessionId.c_str());
        printf("\nCreatedOn=%s",app42SessionResponse->app42Session.createdOn.c_str());        
        vector<App42Attribute> attributesArray = app42SessionResponse->app42Session.attributeArray;
        for(std::vector<App42Attribute>::iterator attribute = attributesArray.begin(); attribute != attributesArray.end(); ++attribute)
        {
            printf("\n Name=%s",attribute->name.c_str());
            printf("\n Value=%s\n",attribute->value.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",app42SessionResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",app42SessionResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",app42SessionResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",app42SessionResponse->httpErrorCode);
    }
}
sessionId = "sessionId";
attributeName = "attributeName";						
response = session_service.remove_attribute(sessionId, attributeName);
success = response.is_response_success();
json_response = session.to_s();
var sessionId:String = "sessionId"; 
var attributeName:String = "attributeName"; 
sessionService.removeAttribute(sessionId,attributeName,new callback());
public class callback implements App42CallBack  
{ 
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
	public function onSuccess(response:Object):void  
	{  
		var session:Session = Session(response);
		trace("SessionId is : " + session.getSessionId());
		if(session.getAttributeList() != null){
		var sessionList:Array = session.getAttributeList();
		for(var j:int= 0;j < sessionList.length;j++)
		{
			trace("attributeName is : " + Attribute(sessionList[0]).getName());
		}
	}  
}
Coming Soon 

Remove All Attributes

Removes all the attributes for a given session id.

Required Parameters

sessionId - The session id for which the attributes have to be removed.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • 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 = "sessionId";
sessionService.removeAllAttributes(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 = "sessionId";
sessionService.RemoveAllAttributes(sessionId, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		App42Response user = (App42Response) response;     
		String jsonResponse = user.ToString();  
	}  
}  
NSString *sessionId = @"sessionId";
App42Response *response = [sessionService removeAllAttributes:sessionId]; 
NSString *success = response.isResponseSuccess;
NSString *jsonResponse = [response toString];                             
String sessionId = "sessionId";
App42Response response = sessionService.removeAllAttributes(sessionId); 
boolean  success = response.isResponseSuccess();
String jsonResponse = response.toString(); 
String sessionId = "sessionId";
App42Response app42response = sessionService.removeAllAttributes(sessionId); 
System.out.println("response is " + app42response) ;  
boolean  success = app42response.isResponseSuccess();
String jsonResponse = app42response.toString(); 
String sessionId = "sessionId";
App42Log.SetDebug(true);		//Print output in your editor console
sessionService.RemoveAllAttributes(sessionId, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		App42Log.Console("Success : " + response);
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var sessionId = "sessionId",
response ;  
sessionService.removeAllAttributes(sessionId,{  
	success: function(object) 
	{  
		var sessionObj = JSON.parse(object);  
		response = sessionObj.app42.response;
		console.log("response is " + response)
	},  
	error: function(error) {  
	}  
}); 
local sessionId  = "sessionId"
local App42CallBack = {}
sessionService:removeAllAttributes(sessionId ,App42CallBack)
function App42CallBack:onSuccess(object)
	print("Response is :"..object:getStrResponse()); 
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 = "sessionId";
sessionService->RemoveAllAttributes(sessionId, this, app42callfuncND_selector(Sample_Class::onSessionServiceRequestCompleted));
void Sample_Class::onSessionServiceRequestCompleted(App42CallBack *sender, void *response)
{
    App42SessionResponse *app42SessionResponse = (App42SessionResponse*)response;
    if(app42SessionResponse->isSuccess)
    {
        printf("\ncode=%d",app42SessionResponse->getCode());
        printf("\nisSuccess=%d",app42SessionResponse->isSuccess);
        printf("\nResponse Body=%s",app42SessionResponse->getBody().c_str());
        printf("\nSessionId=%s",app42SessionResponse->app42Session.sessionId.c_str());
        printf("\nCreatedOn=%s",app42SessionResponse->app42Session.createdOn.c_str());        
        vector<App42Attribute> attributesArray = app42SessionResponse->app42Session.attributeArray;
        for(std::vector<App42Attribute>::iterator attribute = attributesArray.begin(); attribute != attributesArray.end(); ++attribute)
        {
            printf("\n Name=%s",attribute->name.c_str());
            printf("\n Value=%s\n",attribute->value.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",app42SessionResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",app42SessionResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",app42SessionResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",app42SessionResponse->httpErrorCode);
    }
}
String sessionId = "sessionId";
App42Response app42response = sessionService.RemoveAllAttributes(sessionId); 
Boolean  success = app42response.IsResponseSuccess();
String jsonResponse = app42response.ToString(); 
$sessionId = "sessionId";
$response = $sessionService->removeAllAttributes($sessionId); 
print_r("Response is : ".$response->toString());
$success = $response->isResponseSuccess();
$jsonResponse = $response->toString(); 
const char* sessionId = "sessionId";
sessionService->RemoveAllAttributes(sessionId, this, app42callfuncND_selector(Sample_Class::onSessionServiceRequestCompleted));
void Sample_Class::onSessionServiceRequestCompleted(App42CallBack *sender, void *response)
{
    App42SessionResponse *app42SessionResponse = (App42SessionResponse*)response;
    if(app42SessionResponse->isSuccess)
    {
        printf("\ncode=%d",app42SessionResponse->getCode());
        printf("\nisSuccess=%d",app42SessionResponse->isSuccess);
        printf("\nResponse Body=%s",app42SessionResponse->getBody().c_str());
        printf("\nSessionId=%s",app42SessionResponse->app42Session.sessionId.c_str());
        printf("\nCreatedOn=%s",app42SessionResponse->app42Session.createdOn.c_str());        
        vector<App42Attribute> attributesArray = app42SessionResponse->app42Session.attributeArray;
        for(std::vector<App42Attribute>::iterator attribute = attributesArray.begin(); attribute != attributesArray.end(); ++attribute)
        {
            printf("\n Name=%s",attribute->name.c_str());
            printf("\n Value=%s\n",attribute->value.c_str());
        }
    }
    else
    {
        printf("\nerrordetails:%s",app42SessionResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",app42SessionResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",app42SessionResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",app42SessionResponse->httpErrorCode);
    }
}
sessionId = "sessionId";						
response = session_service.remove_all_attribute(sessionId);
success = response.is_response_success();
json_response = session.to_s();
var sessionId:String = "sessionId";  
sessionService.removeAllAttributes(sessionId,new callback());
public class callback implements App42CallBack  
{ 
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
	public function onSuccess(response:Object):void  
	{  
		var session:Session = Session(response);
		trace("SessionId is : " + session.getSessionId());
		if(session.getAttributeList() != null){
		var sessionList:Array = session.getAttributeList();
		for(var j:int= 0;j < sessionList.length;j++)
		{
			trace("attributeName is : " + Attribute(sessionList[0]).getName());
		}
	}  
}
Coming Soon 

Exception Handling

The functions available under Session Management API can throw some exceptions in abnormal conditions. Example of the same has been given below. E.g. If App developer is trying to invalidate a Session which is already in invalidated, the function will throw the App42Exception (as shown below) with message as “Not Found” and the appErrorCode as “2202” and the details as “Session with the id ‘48dacb76-7f5e-4011-ac24-e09623bdc70f’ does not exist”.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • 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 = "sessionId";
sessionService.invalidate(sessionId, new App42CallBack() {
public void onSuccess(Object response) 
{
	App42Response app42response = (App42Response)response;      
	System.out.println("response is " + app42response) ;  
}
public void onException(Exception ex) 
{
	App42Exception exception = (App42Exception)ex;
	int appErrorCode = exception.getAppErrorCode();
	int httpErrorCode = exception.getHttpErrorCode();
	if(appErrorCode == 2202)
	{
	// Handle here for Not Found (Session with the id '@sessionId' does not exist.)
	}
	else if(appErrorCode  == 2203)
	{
	// Handle here for Bad Request (The request parameters are invalid. Session with the Id '@sessionId' is already invalidated.)
	}
	else if(appErrorCode == 1401)
	{
	// handle here for Client is not authorized
	}
	else if(appErrorCode == 1500)
	{
	// handle here for Internal Server Error
	}	
	String jsonText = ex.getMessage();
	}
});	       
String sessionId = "sessionId";
sessionService.Invalidate(sessionId, new Callback()); 
public class Callback : App42Callback  
{   
	public void OnException(App42Exception exception)  
	{  
		int appErrorCode = exception.GetAppErrorCode();
		int httpErrorCode = exception.GetHttpErrorCode();
		if(appErrorCode == 2202)
		{
			// Handle here for Not Found (Session with the id '@sessionId' does not exist.)
		}
		else if(appErrorCode  == 2203)
		{
			// Handle here for Bad Request (The request parameters are invalid. Session with the Id '@sessionId' is already invalidated.)
		}
		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(); 
	}  
	public void OnSuccess(Object response)  
	{  
		Session session = (Session) response;
		String jsonResponse = session.ToString();  
	}  
} 
	
NSString *sessionId = @"sessionId";
@try
{
	App42Response *response = [sessionService invalidate:sessionId]; 
} 
@catch(App42Exception *ex) 
{
	int appErrorCode = ex.appErrorCode;
	int httpErrorCode = ex.httpErrorCode;
	if(appErrorCode == 2202)
	{
		// Handle here for Not Found (Session with the id '@sessionId' does not exist.)
	}
	else if(appErrorCode  == 2203){
		// Handle here for Bad Request (The request parameters are invalid. Session with the Id '@sessionId' is already invalidated.)
	}
	else if(appErrorCode == 1401){
		// handle here for Client is not authorized
	}
	else if(appErrorCode == 1500){
		// handle here for Internal Server Error
	}	
	NSString *jsonText = ex.reason; 	
}                                                
String sessionId = "sessionId";
try
{
	App42Response response = sessionService.invalidate(sessionId);
}
catch(App42Exception ex) 
{
	int appErrorCode = ex.getAppErrorCode();
	int httpErrorCode = ex.getHttpErrorCode();
	if(appErrorCode == 2202)
	{
		// Handle here for Not Found (Session with the id '@sessionId' does not exist.)
	}
	else if(appErrorCode  == 2203)
	{
		// Handle here for Bad Request (The request parameters are invalid. Session with the Id '@sessionId' is already invalidated.)
	}
	else if(appErrorCode == 1401)
	{
		// handle here for Client is not authorized
	}
	else if(appErrorCode == 1500)
	{
		// handle here for Internal Server Error
	}	
	String jsonText = ex.getMessage(); 	
}    
String sessionId = "sessionId";
try
{
	App42Response response = sessionService.invalidate(sessionId);
}
catch(App42Exception ex) 
{
	int appErrorCode = ex.getAppErrorCode();
	int httpErrorCode = ex.getHttpErrorCode();
	if(appErrorCode == 2202)
	{
		// Handle here for Not Found (Session with the id '@sessionId' does not exist.)
	}
	else if(appErrorCode  == 2203)
	{
		// Handle here for Bad Request (The request parameters are invalid. Session with the Id '@sessionId' is already invalidated.)
	}
	else if(appErrorCode == 1401)
	{
		// handle here for Client is not authorized
	}
	else if(appErrorCode == 1500)
	{
		// handle here for Internal Server Error
	}	
	String jsonText = ex.getMessage(); 	
}
Coming Soon
var sessionId = "sessionId";
var appErrorCode ;
sessionService.invalidate(sessionId,{
	success: function(object) {
	},
	error: function(error) 
	{
		var sessionObj = JSON.parse(error);
		appErrorCode = sessionObj.app42Fault.appErrorCode;
		if(appErrorCode == 2202)
		{
			// Handle here for Not Found (Session with the id '@sessionId' does not exist.)
		}
		else if(appErrorCode  == 2203)
		{
			// Handle here for Bad Request (The request parameters are invalid. Session with the Id '@sessionId' is already invalidated.)
		}
		else if(appErrorCode == 1401)
		{
			// handle here for Client is not authorized
		}
		else if(appErrorCode == 1500)
		{
			// handle here for Internal Server Error
		}	
	}
});
local sessionId = "sessionId"
local App42CallBack = {}
sessionService:invalidate(sessionId ,App42CallBack)
function App42CallBack:onSuccess(object)
	print("Response Success is "..object:getResponseSuccess())
end
function App42CallBack:onException(exception)
	local appErrorCode = exception:getAppErrorCode()
	if appErrorCode == 2202 then
		-- Handle here for Not Found (Session with the id '@sessionId' does not exist.)
	elseif appErrorCode  == 2203 then
		-- Handle here for Bad Request (The request parameters are invalid. Session with the Id '@sessionId' is already invalidated.)
	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* sessionId = "sessionId";
sessionService->Invalidate(sessionId, this, app42callfuncND_selector(Sample_Class::onSessionServiceRequestCompleted));
void Sample_Class::onSessionServiceRequestCompleted(App42CallBack *sender, void *response)
{
    App42SessionResponse *app42SessionResponse = (App42SessionResponse*)response;
    if(app42SessionResponse->isSuccess)
    {
       //Handle success response here
    }
    else
    {
        printf("\nerrordetails:%s",app42SessionResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",app42SessionResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",app42SessionResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",app42SessionResponse->httpErrorCode);
        
        int appErrorCode = app42SessionResponse->appErrorCode;
		int httpErrorCode = app42SessionResponse->httpErrorCode;
		if(appErrorCode == 2202)
		{
		// Handle here for Not Found (Session with the id '@sessionId' does not exist.)
		}
		else if(appErrorCode  == 2203)
		{
		// Handle here for Bad Request (The request parameters are invalid. Session with the Id '@sessionId' is already invalidated.)
		} 
		else if(appErrorCode == 1401)
		{
		// handle here for Client is not authorized
		}
		else if(appErrorCode == 1500)
		{
		// handle here for Internal Server Error
		}	
    }
}
String sessionId = "sessionId";
try
{
	App42Response response = sessionService.Invalidate(sessionId);
}
catch(App42Exception ex) 
{
	int appErrorCode = ex.GetAppErrorCode();
	int httpErrorCode = ex.GetHttpErrorCode();
	if(appErrorCode == 2202)
    {
    // Handle here for Not Found (Session with the id '@sessionId' does not exist.)
    }
    else if(appErrorCode  == 2203)
	{
    // Handle here for Bad Request (The request parameters are invalid. Session with the Id '@sessionId' is already invalidated.)
    } 
    else if(appErrorCode == 1401)
	{
    // handle here for Client is not authorized
    }
    else if(appErrorCode == 1500)
	{
    // handle here for Internal Server Error
    }	
	String jsonText = ex.GetMessage(); 	
}      
$sessionId = "sessionId";
try
{
	$response = $sessionService->invalidate($sessionId);
} 
catch(App42Exception $ex) 
{
	$appErrorCode = $ex->getAppErrorCode();
	$httpErrorCode = $ex->getHttpErrorCode();
	if($appErrorCode == 2202)
	{
		// Handle here for Not Found (Session with the id '@sessionId' does not exist.)
	}
	else if($appErrorCode  == 2203){
		// Handle here for Bad Request (The request parameters are invalid. Session with the Id '@sessionId' is already invalidated.)
	}
	else if($appErrorCode == 1401){
		// handle here for Client is not authorized
	}
	else if($appErrorCode == 1500){
		// handle here for Internal Server Error
	}	
	$jsonText = $ex->getMessage(); 	
}                          
const char* sessionId = "sessionId";
sessionService->Invalidate(sessionId, this, app42callfuncND_selector(Sample_Class::onSessionServiceRequestCompleted));
void Sample_Class::onSessionServiceRequestCompleted(App42CallBack *sender, void *response)
{
    App42SessionResponse *app42SessionResponse = (App42SessionResponse*)response;
    if(app42SessionResponse->isSuccess)
    {
       //Handle success response here
    }
    else
    {
        printf("\nerrordetails:%s",app42SessionResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",app42SessionResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",app42SessionResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",app42SessionResponse->httpErrorCode);
        
        int appErrorCode = app42SessionResponse->appErrorCode;
		int httpErrorCode = app42SessionResponse->httpErrorCode;
		if(appErrorCode == 2202)
		{
		// Handle here for Not Found (Session with the id '@sessionId' does not exist.)
		}
		else if(appErrorCode  == 2203)
		{
		// Handle here for Bad Request (The request parameters are invalid. Session with the Id '@sessionId' is already invalidated.)
		} 
		else if(appErrorCode == 1401)
		{
		// handle here for Client is not authorized
		}
		else if(appErrorCode == 1500)
		{
		// handle here for Internal Server Error
		}	
    }
}
Coming Soon
Coming Soon 
Coming Soon

Error Codes

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

1400 - BAD REQUEST - The Request parameters are invalid 1401 - UNAUTHORIZED - Client is not authorized 1500 - INTERNAL SERVER ERROR - Internal Server Error. Please try again 2200 - NOT FOUND - User by the name '@userName' does not exist. 2201 - NOT FOUND - Session for the user '@userName' does not exist. 2202 - NOT FOUND - Session with the id '@sessionId' does not exist. 2203 - BAD REQUEST - The request parameters are invalid. Session with the Id '@sessionId' is already invalidated. 2204 - NOT FOUND - Attribute with the name '@name' for session id '@sessionId' does not exist. 2205 - NOT FOUND - There are no attributes for session id '@sessionId'. 2206 - NOT FOUND - Attributes for session id '@sessionId' do not exist. 2207 - BAD REQUEST - Session Id not valid 2208 - BAD REQUEST - The request parameters are invalid. Max attributes should be 100