Session Management Service

This service manages user sessions on the server side. It is a persistent session manager that allows to save attributes in the session and retrieve them.

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.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 "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.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"></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
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;
Initialize

In order to use the various functions available in a specific API, the 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("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
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 they 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 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
SessionService sessionService = App42API.buildSessionManager(); 
SessionService sessionService = App42API.BuildSessionService();  
SessionService *sessionService = [App42API buildSessionService]; 
let sessionService :SessionService? = App42API.buildSessionService
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
SessionService sessionService = App42API.buildSessionManager(); 
Get Session

Create Session for the User. If the session does not exist then it will get created.

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 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");
SessionService sessionService = App42API.buildSessionManager(); 
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";
App42API.Initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.BuildSessionService();
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";
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
SessionService *sessionService = [App42API buildSessionService]; 
[sessionService getSession:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Session *session = (Session*)responseObj;
		NSLog(@"User Name is = %@",session.userName);
		NSLog(@"SessionId is = %@",session.sessionId);
	}
	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("APP_KEY", andSecretKey:"SECRET_KEY")
let sessionService :SessionService? = App42API.buildSessionService  
sessionService?.getSession(userName, completionBlock: { (success, response, exception) ->Void in
if (success)
{
    let session = response as! Session
    NSLog("%@",session.userName)
    NSLog("%@",session.sessionId)
}
else
{
    NSLog("%@",exception.reason!)
    NSLog("%d",exception.httpErrorCode)
    NSLog("%d",exception.appErrorCode)
    NSLog("%@",exception.userInfo!)
}
})
String userName = "Nick";
App42API.initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.buildSessionManager(); 
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
App42API.Initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.BuildSessionService(); 
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 ;
App42.initialize("API_KEY","SECRET_KEY");
var sessionService  = new App42Session();
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 = {}
App42API:initialize("API_KEY","SECRET_KEY")
local sessionService  = App42API:buildSessionManager()
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";
App42API::Initialize("API_KEY", "SECRET_KEY");
SessionService *sessionService = App42API::BuildSessionService();
sessionService->GetSession(userName, app42callback(Sample_Class::onSessionServiceRequestCompleted, this));
void Sample_Class::onSessionServiceRequestCompleted( 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";
App42API.Initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.BuildSessionService(); 
Session session = sessionService.GetSession(userName); 
Console.WriteLine("userName is" + session.GetUserName());
Console.WriteLine("sessionId is" + session.GetSessionId());
String jsonResponse = session.ToString();         
$userName = "Nick";
App42API::initialize("API_KEY","SECRET_KEY");
$sessionService = App42API::buildSessionService();
$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";
App42API::Initialize("API_KEY", "SECRET_KEY");
SessionService *sessionService = App42API::BuildSessionService();
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";						
api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") 
session_service = api.build_session_service()
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";	
App42API.initialize("API_KEY","SECRET_KEY");
var sessionService:SessionService = App42API.buildSessionService(); 
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
String userName = "Nick";
App42API.initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.buildSessionManager(); 
Session session = sessionService.getSession(userName); 
System.out.println("userName is" + session.getUserName());
System.out.println("sessionId is" + session.getSessionId());
String jsonResponse = session.toString();                
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 then it is returned. If there is no existing session then a 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 be created or not.

  • 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";  
boolean  isCreate = true;  
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
SessionService sessionService = App42API.buildSessionManager(); 
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;  
App42API.Initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.BuildSessionService();
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;  
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
SessionService *sessionService = [App42API buildSessionService]; 
[sessionService getSession:userName isCreate:isCreate completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Session *session = (Session*)responseObj;
		NSLog(@"User Name is = %@",session.userName);
		NSLog(@"SessionId is = %@",session.sessionId);
	}
	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 isCreate = true
App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY")
let sessionService :SessionService? = App42API.buildSessionService  
sessionService?.getSession(userName, isCreate:isCreate, completionBlock: { (success, response, exception) ->Void in
if (success)
{
    let session = response as! Session
    NSLog("%@",session.userName)
    NSLog("%@",session.sessionId)
}
else
{
    NSLog("%@",exception.reason!)
    NSLog("%d",exception.httpErrorCode)
    NSLog("%d",exception.appErrorCode)
    NSLog("%@",exception.userInfo!)
}
})
String userName = "Nick";
boolean  isCreate = true;  
App42API.initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.buildSessionManager(); 
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
App42API.Initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.BuildSessionService(); 
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 = {}
App42API:initialize("API_KEY","SECRET_KEY")
local sessionService  = App42API:buildSessionManager()
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;
App42API::Initialize("API_KEY", "SECRET_KEY");
SessionService *sessionService = App42API::BuildSessionService();
sessionService->GetSession(userName, isCreate, app42callback(Sample_Class::onSessionServiceRequestCompleted, this));
void Sample_Class::onSessionServiceRequestCompleted(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;  
App42API.Initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.BuildSessionService(); 
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";  
App42API::initialize("API_KEY","SECRET_KEY");
$sessionService = App42API::buildSessionService();
$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;
App42API::Initialize("API_KEY", "SECRET_KEY");
SessionService *sessionService = App42API::BuildSessionService();
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;
api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") 
session_service = api.build_session_service()
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;
App42API.initialize("API_KEY","SECRET_KEY");
var sessionService:SessionService = App42API.buildSessionService(); 
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
String userName = "Nick";
boolean  isCreate = true;  
App42API.initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.buildSessionManager(); 
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();                
Invalidate

Invalidate a session based on the session ID. All the attributes stored 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 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 = "sessionId";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
SessionService sessionService = App42API.buildSessionManager(); 
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";
App42API.Initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.BuildSessionService();
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";
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
SessionService *sessionService = [App42API buildSessionService]; 
[sessionService invalidate:sessionId completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		App42Response *response = (App42Response*)responseObj; 
		NSString *success = response.isResponseSuccess;
		NSString *jsonResponse = [response 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 sessionId  = "sessionId"  
App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY")
let sessionService :SessionService? = App42API.buildSessionService  
sessionService?.invalidate(sessionId, completionBlock: { (success, response, exception) ->Void in
if (success)
    {  
        let response = response as! App42Response
        NSLog("%@", response.strResponse)
        NSLog("%@", response.isResponseSuccess) 
    }  
   else  
    {  
        NSLog("%@",exception.reason!)
        NSLog("%d",exception.httpErrorCode)  
        NSLog("%d",exception.appErrorCode)  
        NSLog("%@",exception.userInfo!)  
    }   
})

String sessionId = "sessionId";
App42API.initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.buildSessionManager(); 
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
App42API.Initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.BuildSessionService(); 
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 ;  
App42.initialize("API_KEY","SECRET_KEY");
var sessionService  = new App42Session();
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 = {}
App42API:initialize("API_KEY","SECRET_KEY")
local sessionService  = App42API:buildSessionManager()
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";
App42API::Initialize("API_KEY", "SECRET_KEY");
SessionService *sessionService = App42API::BuildSessionService();
sessionService->Invalidate(sessionId, app42callback(Sample_Class::onSessionServiceRequestCompleted, this));
void Sample_Class::onSessionServiceRequestCompleted(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";
App42API.Initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.BuildSessionService(); 
App42Response response = sessionService.Invalidate(sessionId); 
Boolean  success = response.IsResponseSuccess();
String jsonResponse = response.ToString(); 
$sessionId = "sessionId";
App42API::initialize("API_KEY","SECRET_KEY");
$sessionService = App42API::buildSessionService();
$response = $sessionService->invalidate($sessionId); 
print_r("Response is :". $response->toString());
$success = $response->isResponseSuccess();
$jsonResponse = $response->toString(); 
const char* sessionId = "sessionId";
App42API::Initialize("API_KEY", "SECRET_KEY");
SessionService *sessionService = App42API::BuildSessionService();
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";						
api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") 
session_service = api.build_session_service()
response = session_service.invalidate(sessionId); 
success = response.is_response_success();
json_response = session.to_s(); 
var sessionId:String = "sessionId";	
App42API.initialize("API_KEY","SECRET_KEY");
var sessionService:SessionService = App42API.buildSessionService(); 
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 
String sessionId = "sessionId";
App42API.initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.buildSessionManager(); 
App42Response app42response = sessionService.invalidate(sessionId); 
System.out.println("response is " + app42response); 
boolean  success = app42response.isResponseSuccess();
String jsonResponse = app42response.toString(); 
Set Attribute

Sets attribute in a session whose 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 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 = "sessionId";
String attributeName = "attributeName";  
String  attributeValue = "attributeValue";  
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
SessionService sessionService = App42API.buildSessionManager(); 
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";  
App42API.Initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.BuildSessionService();
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";  
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
SessionService *sessionService = [App42API buildSessionService]; 
[sessionService setAttribute:sessionId attributeName:attributeName attributeValue:attributeValue completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Session *session = (Session*)responseObj;
		NSLog(@"SessionId is = %@",session.sessionId);
	}
	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 sessionId = "sessionId" 
let attributeName  = "attributeName"
let attributeValue  = "attributeValue" 
App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY")
let sessionService :SessionService? = App42API.buildSessionService  
sessionService?.setAttribute(sessionId, attributeName:attributeName, attributeValue:attributeValue, completionBlock: { (success, response, exception) ->Void in
if (success)
  
    {  
        let session = response as! Session    
        NSLog("%@",session.sessionId)  
    }  
   else  
    {  
        NSLog("%@",exception.reason!)
        NSLog("%d",exception.httpErrorCode)  
        NSLog("%d",exception.appErrorCode)  
        NSLog("%@",exception.userInfo!)  
    }   
})
String sessionId = "sessionId";
String attributeName = "attributeName";  
String  attributeValue = "attributeValue";  
App42API.initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.buildSessionManager(); 
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
App42API.Initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.BuildSessionService(); 
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 ;
App42.initialize("API_KEY","SECRET_KEY");
var sessionService  = new App42Session();
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 = {}
App42API:initialize("API_KEY","SECRET_KEY")
local sessionService  = App42API:buildSessionManager()
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";  
App42API::Initialize("API_KEY", "SECRET_KEY");
SessionService *sessionService = App42API::BuildSessionService();
sessionService->SetAttribute(sessionId, attributeName, attributeValue, app42callback(Sample_Class::onSessionServiceRequestCompleted, this));
void Sample_Class::onSessionServiceRequestCompleted(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";  
App42API.Initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.BuildSessionService(); 
Session session = sessionService.SetAttribute(sessionId,attributeName,attributeValue); 
Console.WriteLine("sessionId is" + session.GetSessionId());
String jsonResponse = session.ToString();         
$sessionId = "sessionId";
$attributeName = "attributeName";  
$attributeValue = "attributeValue";  
App42API::initialize("API_KEY","SECRET_KEY");
$sessionService = App42API::buildSessionService();
$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";  
App42API::Initialize("API_KEY", "SECRET_KEY");
SessionService *sessionService = App42API::BuildSessionService();
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";						
api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") 
session_service = api.build_session_service()
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"; 
App42API.initialize("API_KEY","SECRET_KEY");
var sessionService:SessionService = App42API.buildSessionService(); 
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
String sessionId = "sessionId";
String attributeName = "attributeName";  
String  attributeValue = "attributeValue";  
App42API.initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.buildSessionManager(); 
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();                
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 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 = "sessionId";
String attributeName = "attributeName";  
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
SessionService sessionService = App42API.buildSessionManager(); 
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";  
App42API.Initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.BuildSessionService();
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";  
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
SessionService *sessionService = [App42API buildSessionService]; 
[sessionService getAttribute:sessionId attributeName:attributeName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Session *session = (Session*)responseObj;
		NSLog(@"SessionId is = %@",session.sessionId);
	}
	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 sessionId = "sessionId" 
let attributeName  = "attributeName"  
App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY")
let sessionService :SessionService? = App42API.buildSessionService  
sessionService?.getAttribute(sessionId, attributeName:attributeName, completionBlock: { (success, response, exception) ->Void in
if (success)
    {  
        let session = response as! Session  
        NSLog("%@",session.sessionId)  
    }  
   else  
    {  
        NSLog("%@",exception.reason!)
        NSLog("%d",exception.httpErrorCode)  
        NSLog("%d",exception.appErrorCode)  
        NSLog("%@",exception.userInfo!)  
    }   
})
String sessionId = "sessionId";
String attributeName = "attributeName";  
App42API.initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.buildSessionManager(); 
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
App42API.Initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.BuildSessionService(); 
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 ;
App42.initialize("API_KEY","SECRET_KEY");
var sessionService  = new App42Session();
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 = {}
App42API:initialize("API_KEY","SECRET_KEY")
local sessionService  = App42API:buildSessionManager()
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"; 
App42API::Initialize("API_KEY", "SECRET_KEY");
SessionService *sessionService = App42API::BuildSessionService();
sessionService->GetAttribute(sessionId, attributeName, app42callback(Sample_Class::onSessionServiceRequestCompleted, this));
void Sample_Class::onSessionServiceRequestCompleted(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";  
App42API.Initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.BuildSessionService(); 
Session session = sessionService.GetAttribute(sessionId,attributeName); 
Console.WriteLine("sessionId is" + session.GetSessionId());
String jsonResponse = session.ToString();         
$sessionId = "sessionId";
$attributeName = "attributeName";  
App42API::initialize("API_KEY","SECRET_KEY");
$sessionService = App42API::buildSessionService();
$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"; 
App42API::Initialize("API_KEY", "SECRET_KEY");
SessionService *sessionService = App42API::BuildSessionService();
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";						
api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") 
session_service = api.build_session_service()
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";  
App42API.initialize("API_KEY","SECRET_KEY");
var sessionService:SessionService = App42API.buildSessionService(); 
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
String sessionId = "sessionId";
String attributeName = "attributeName";  
App42API.initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.buildSessionManager(); 
Session session = sessionService.getAttribute(sessionId,attributeName); 
System.out.println("sessionId is" + session.getSessionId());
String jsonResponse = session.toString();                
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 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 = "sessionId";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
SessionService sessionService = App42API.buildSessionManager(); 
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";
App42API.Initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.BuildSessionService();
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";
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
SessionService *sessionService = [App42API buildSessionService]; 
[sessionService getAllAttributes:sessionId completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Session *session = (Session*)responseObj;
		NSLog(@"SessionId is = %@",session.sessionId);
	}
	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 sessionId  = "sessionId"  
App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY")
let sessionService :SessionService? = App42API.buildSessionService  
sessionService?.getAllAttributes(sessionId, completionBlock: { (success, response, exception) ->Void in
    if (success)
    {
        let session = response as! Session
        NSLog("%@",session.userName)  
        NSLog("%@",session.sessionId)  
    }  
   else  
    {  
        NSLog("%@",exception.reason!)
        NSLog("%d",exception.httpErrorCode)  
        NSLog("%d",exception.appErrorCode)  
        NSLog("%@",exception.userInfo!)  
    }   
})

String sessionId = "sessionId";
App42API.initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.buildSessionManager(); 
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
App42API.Initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.BuildSessionService(); 
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 ;
App42.initialize("API_KEY","SECRET_KEY");
var sessionService  = new App42Session();
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 = {}
App42API:initialize("API_KEY","SECRET_KEY")
local sessionService  = App42API:buildSessionManager()
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";
App42API::Initialize("API_KEY", "SECRET_KEY");
SessionService *sessionService = App42API::BuildSessionService();
sessionService->GetAllAttributes(sessionId, app42callback(Sample_Class::onSessionServiceRequestCompleted, this));
void Sample_Class::onSessionServiceRequestCompleted(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";
App42API.Initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.BuildSessionService(); 
Session session = sessionService.GetAllAttributes(sessionId); 
Console.WriteLine("sessionId is" + session.GetSessionId());
String jsonResponse = session.ToString();         
$sessionId = "sessionId";
App42API::initialize("API_KEY","SECRET_KEY");
$sessionService = App42API::buildSessionService();
$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";
App42API::Initialize("API_KEY", "SECRET_KEY");
SessionService *sessionService = App42API::BuildSessionService();
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";
api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") 
session_service = api.build_session_service()
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"; 
App42API.initialize("API_KEY","SECRET_KEY");
var sessionService:SessionService = App42API.buildSessionService(); 
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
String sessionId = "sessionId";
App42API.initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.buildSessionManager(); 
Session session = sessionService.getAllAttributes(sessionId); 
System.out.println("sessionId is" + session.getSessionId());
String jsonResponse = session.toString();                
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 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 = "sessionId";
String attributeName = "attributeName";  
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
SessionService sessionService = App42API.buildSessionManager(); 
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";  
App42API.Initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.BuildSessionService();
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";  
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
SessionService *sessionService = [App42API buildSessionService]; 
[sessionService removeAttribute:sessionId attributeName:attributeName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		App42Response *response = (App42Response*)responseObj; 
		NSString *success = response.isResponseSuccess;
		NSString *jsonResponse = [response 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 sessionId = "sessionId"  
let attributeName = "attributeName"    
App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY")
let sessionService :SessionService? = App42API.buildSessionService  
sessionService?.removeAttribute(sessionId, attributeName:attributeName, completionBlock: { (success, response, exception) ->Void in
   if (success)
    {  
        let response = response as! App42Response
        NSLog("%@", response.strResponse)
        NSLog("%@", response.isResponseSuccess)  
    }  
   else  
    {  
        NSLog("%@",exception.reason!)
        NSLog("%d",exception.httpErrorCode)  
        NSLog("%d",exception.appErrorCode)  
        NSLog("%@",exception.userInfo!)  
    }   
})
String sessionId = "sessionId";
String attributeName = "attributeName";  
App42API.initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.buildSessionManager(); 
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
App42API.Initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.BuildSessionService(); 
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 ;  
App42.initialize("API_KEY","SECRET_KEY");
var sessionService  = new App42Session();
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 = {}
App42API:initialize("API_KEY","SECRET_KEY")
local sessionService  = App42API:buildSessionManager()
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"; 
App42API::Initialize("API_KEY", "SECRET_KEY");
SessionService *sessionService = App42API::BuildSessionService();
sessionService->RemoveAttribute(sessionId, attributeName, app42callback(Sample_Class::onSessionServiceRequestCompleted, this));
void Sample_Class::onSessionServiceRequestCompleted(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";  
App42API.Initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.BuildSessionService(); 
App42Response response = sessionService.RemoveAttribute(sessionId,attributeName); 
Boolean  success = response.IsResponseSuccess();
String jsonResponse = response.ToString(); 
$sessionId = "sessionId";
$attributeName = "attributeName";  
App42API::initialize("API_KEY","SECRET_KEY");
$sessionService = App42API::buildSessionService();
$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"; 
App42API::Initialize("API_KEY", "SECRET_KEY");
SessionService *sessionService = App42API::BuildSessionService();
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";						
api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") 
session_service = api.build_session_service()
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"; 
App42API.initialize("API_KEY","SECRET_KEY");
var sessionService:SessionService = App42API.buildSessionService(); 
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 
String sessionId = "sessionId";
String attributeName = "attributeName";  
App42API.initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.buildSessionManager(); 
App42Response response = sessionService.removeAttribute(sessionId,attributeName); 
boolean  success = response.isResponseSuccess();
String jsonResponse = response.toString(); 
Remove All Attributes

Remove 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 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 = "sessionId";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
SessionService sessionService = App42API.buildSessionManager(); 
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";
App42API.Initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.BuildSessionService();
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";
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
SessionService *sessionService = [App42API buildSessionService]; 
[sessionService removeAllAttributes:sessionId completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		App42Response *response = (App42Response*)responseObj; 
		NSString *success = response.isResponseSuccess;
		NSString *jsonResponse = [response 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 sessionId = "sessionId"  
App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY")
let sessionService :SessionService? = App42API.buildSessionService  
sessionService?.removeAllAttributes(sessionId, completionBlock: { (success, response, exception) ->Void in
if (success)
    {
        let response = response as! App42Response
        NSLog("%@", response.strResponse)
        NSLog("%@", response.isResponseSuccess)  
    }  
   else  
    {  
        NSLog("%@",exception.reason!)
        NSLog("%d",exception.httpErrorCode)  
        NSLog("%d",exception.appErrorCode)  
        NSLog("%@",exception.userInfo!)  
    }   
})

String sessionId = "sessionId";
App42API.initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.buildSessionManager(); 
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
App42API.Initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.BuildSessionService(); 
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 ;  
App42.initialize("API_KEY","SECRET_KEY");
var sessionService  = new App42Session();
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 = {}
App42API:initialize("API_KEY","SECRET_KEY")
local sessionService  = App42API:buildSessionManager()
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";
App42API::Initialize("API_KEY", "SECRET_KEY");
SessionService *sessionService = App42API::BuildSessionService();
sessionService->RemoveAllAttributes(sessionId, app42callback(Sample_Class::onSessionServiceRequestCompleted, this));
void Sample_Class::onSessionServiceRequestCompleted(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";
App42API.Initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.BuildSessionService(); 
App42Response app42response = sessionService.RemoveAllAttributes(sessionId); 
Boolean  success = app42response.IsResponseSuccess();
String jsonResponse = app42response.ToString(); 
$sessionId = "sessionId";
App42API::initialize("API_KEY","SECRET_KEY");
$sessionService = App42API::buildSessionService();
$response = $sessionService->removeAllAttributes($sessionId); 
print_r("Response is : ".$response->toString());
$success = $response->isResponseSuccess();
$jsonResponse = $response->toString(); 
const char* sessionId = "sessionId";
App42API::Initialize("API_KEY", "SECRET_KEY");
SessionService *sessionService = App42API::BuildSessionService();
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";						
api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") 
session_service = api.build_session_service()
response = session_service.remove_all_attribute(sessionId);
success = response.is_response_success();
json_response = session.to_s();
var sessionId:String = "sessionId";  
App42API.initialize("API_KEY","SECRET_KEY");
var sessionService:SessionService = App42API.buildSessionService(); 
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 
String sessionId = "sessionId";
App42API.initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.buildSessionManager(); 
App42Response response = sessionService.removeAllAttributes(sessionId); 
boolean  success = response.isResponseSuccess();
String jsonResponse = response.toString(); 
Exception Handling

The functions available under Session Management API can throw some exceptions in abnormal conditions. For exmample, if a 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 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 = "sessionId";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
SessionService sessionService = App42API.buildSessionManager(); 
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";
App42API.Initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.BuildSessionService();
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";
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
SessionService *sessionService = [App42API buildSessionService]; 
[sessionService invalidate:sessionId completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		App42Response *response = (App42Response*)responseObj; 
		NSString *success = response.isResponseSuccess;
		NSString *jsonResponse = [response toString]; 
	}
	else
	{
		int appErrorCode =exception.appErrorCode;
		int httpErrorCode = exception.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 = exception.reason; 	
	}    
}];	
Coming Soon
String sessionId = "sessionId";
App42API.initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.buildSessionManager(); 
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";
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.BuildSessionService(); 
sessionService.Invalidate(sessionId, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		App42Log.Console("Success : " + response);
	}

	public void OnException(Exception e)
	{
		App42Exception exception = (App42Exception)e;
		int appErrorCode = exception.GetAppErrorCode();
		int httpErrorCode = exception.GetHttpErrorCode();
		if(appErrorCode == 2202)
		{
			// Handle here for Not Found (Session with the id '@sessionId' does not exist.)
		}
		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(); 
	}
}
var sessionId = "sessionId";
var appErrorCode ;
App42.initialize("API_KEY","SECRET_KEY");
var sessionService  = new App42Session();
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 = {}
App42API:initialize("API_KEY","SECRET_KEY")
local sessionService  = App42API:buildSessionManager()
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";
App42API::Initialize("API_KEY", "SECRET_KEY");
SessionService *sessionService = App42API::BuildSessionService();
sessionService->Invalidate(sessionId, app42callback(Sample_Class::onSessionServiceRequestCompleted, this));
void Sample_Class::onSessionServiceRequestCompleted(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";
App42API.Initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.BuildSessionService(); 
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";
App42API::initialize("API_KEY","SECRET_KEY");
$sessionService = App42API::buildSessionService();
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";
App42API::Initialize("API_KEY", "SECRET_KEY");
SessionService *sessionService = App42API::BuildSessionService();
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
String sessionId = "sessionId";
App42API.initialize("API_KEY","SECRET_KEY");
SessionService sessionService = App42API.buildSessionManager(); 
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(); 	
}    
Error Codes

Functions in session 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. 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.