Achievement Service

Assign badge or achievement to your app users. Using this service you can manage achievements by allowing the user to create, earn, get achievements etc.

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.achievement.Achievement;
import com.shephertz.app42.paas.sdk.android.achievement.AchievementService;
using com.shephertz.app42.paas.sdk.windows;  
using com.shephertz.app42.paas.sdk.windows.achievement;   
#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.achievement.Achievement;
import com.shephertz.app42.paas.sdk.java.achievement.AchievementService;
using com.shephertz.app42.paas.sdk.csharp;  
using com.shephertz.app42.paas.sdk.csharp.achievement;  
<script type="text/javascript" src="App42-all-x.x.x.min.js">
Coming Soon
Coming Soon
using com.shephertz.app42.paas.sdk.csharp;  
using com.shephertz.app42.paas.sdk.csharp.achievement;  
include_once '../AchievementService.php';
include_once '../GameService.php';
include_once '../App42Response.php';
include_once '../App42Exception.php';
include_once '../App42BadParameterException.php';
include_once '../App42NotFoundException.php';
include_once '../App42Log.php';
Not Available
Not Available
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.achievement.Achievement;
import com.shephertz.app42.paas.sdk.as3.achievement.AchievementService;
Not Available
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.achievement.Achievement;
import com.shephertz.app42.paas.sdk.jme.achievement.AchievementService;
Initialize

In order to use the various functions available in a specific API, a developer has to initialize App42API by passing the apiKey and the secretKey which will become available after you create app 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");
Coming Soon
Coming Soon
App42API.Initialize("API_KEY","SECRET_KEY");
App42API::initialize("API_KEY","SECRET_KEY"); 
Not Available
Not Available
App42API.initialize("API_KEY","SECRET_KEY");
Not Available
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 AchievementService, buildAchievementService() 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
AchievementService achievementService = App42API.buildAchievementService(); 
AchievementService achievementService = App42API.BuildAchievementService();  
AchievementService *achievementService = [App42API buildAchievementService];
let achievementService = App42API.buildAchievementService() as? AchievementService
AchievementService achievementService = App42API.buildAchievementService(); 
AchievementService achievementService = App42API.BuildAchievementService();  
var achievementService  = new App42Achievement();
Coming Soon
Coming Soon
AchievementService achievementService = App42API.BuildAchievementService(); 
$achievementService = App42API::buildAchievementService(); 
Not Available
Not Available
var achievementService:AchievementService = App42API.buildAchievementService(); 
Not Available
AchievementService achievementService = App42API.buildAchievementService(); 
Create Achievement

You can create multiple achievements or badges for your app.

Required Parameters

achievementName - Name of achievement to be created. description - Description of the achievement.

  • 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 achievementName = "Shephertz Nick";
String description = "My Game achievement";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.buildAchievementService(); 
achievementService.createAchievement(achievementName, description,new App42CallBack() {
public void onSuccess(Object response) 
{
	Achievement achievement = (Achievement)response;
	System.out.println("achievementName is :" + achievement.getName());  
	System.out.println("description is :" + achievement.getDescription());  
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});		
String achievementName = "Shephertz Nick";
String description = "My Game achievement";
App42API.Initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.BuildAchievementService();  
achievementService.CreateAchievement(achievementName, description, new Callback());
public class Callback : App42Callback  
{   
	public void OnSuccess(Object response)  
	{  
		Achievement achievement = (Achievement) response;   
		Console.WriteLine("achievementName is :" + achievement.GetName());
		Console.WriteLine("description is :" + achievement.GetDescription());
	} 
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
}
NSString *achievementName = @"Shephertz Nick";
NSString *description = @"My Game achievement";
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
AchievementService *achievementService = [App42API buildAchievementService];
[achievementService createAchievementWithName:achievementName description:description completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Achievement *achievement = (Achievement*)responseObj;
		NSLog(@"achievementName=%@",achievement.name);
		NSLog(@"userName=%@",achievement.userName);
		NSLog(@"achievedOn=%@",achievement.achievedOn);
		NSLog(@"GameName=%@",achievement.gameName);
		NSLog(@"description=%@",achievement.description);
	}
	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 achievementName = "Expert"
let description = "Expert achievement"
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")
let achievementService = App42API.buildAchievementService() as? AchievementService
achievementService?.createAchievementWithName(achievementName, description: description, completionBlock:{ (success, response, exception) -> Void in
	if(success)
    {
        let achievement = response as! Achievement
        NSLog("Response is %@" , achievement.strResponse);
        NSLog("isResponseSuccess is %d" , achievement.isResponseSuccess);
        NSLog("name is %@" , achievement.name);
        NSLog("description is %@" , achievement.description);

    }
    else
    {
        NSLog("Exception = %@", exception.reason!)
        NSLog("App Error Code = %d", exception.appErrorCode)
        NSLog("HTTP error Code = %d", exception.httpErrorCode)
        NSLog("User Info = %@", exception.userInfo!)
    }
})
String achievementName = "Shephertz Nick";
String description = "My Game achievement";
App42API.initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.buildAchievementService(); 
Achievement achievement =  achievementService.createAchievement(achievementName, description);
System.out.println("achievementName is :" + achievement.getName());
System.out.println("description is :" + achievement.getDescription());
String achievementName = "Shephertz Nick";
String description = "My Game achievement";
App42Log.SetDebug(true);		//Prints output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.BuildAchievementService();  
achievementService.CreateAchievement(achievementName, description,new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Achievement achievement = (Achievement) response;   
		App42Log.Console("achievementName is :" + achievement.GetName());
		App42Log.Console("description is :" + achievement.GetDescription());
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var achievementName = "Shephertz Nick",
description = "My Game achievement",
result;
App42.initialize("API_KEY","SECRET_KEY");
var achievementService  = new App42Achievement();
achievementService.createAchievement(achievementName, description,{  
	success: function(object) 
	{  
		var achievementObj = JSON.parse(object);  
		result = achievementObj.app42.response.achievements.achievement;
		console.log("achievementName is : " + result.name)
		console.log("description is : " + result.description)
	},  
	error: function(error) 
	{ 
		console.log("Exception is : " + error)
	}  
});     
Coming Soon
Coming Soon
String achievementName = "Shephertz Nick";
String description = "My Game achievement";
App42API.Initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.BuildAchievementService();  
Achievement achievement =  achievementService.CreateAchievement(achievementName, description);
Console.WriteLine("achievementName is :" + achievement.GetName());
Console.WriteLine("description is :" + achievement.GetDescription());
$achievementName = "Shephertz Nick";
$description = "My Game achievement";
App42API::initialize("API_KEY","SECRET_KEY"); 
$achievementService = App42API::buildAchievementService(); 
$achievement = $achievementService->createAchievement($achievementName, $description);
print_r("achievement name is   :  " . $achievement->getName());
print_r("description is   :  " . $achievement->getDescription());
$jsonResponse = $achievement->toString();
Not Available
Not Available
var achievementName:String = "Shephertz Nick";
var description:String = "My Game achievement";
App42API.initialize("API_KEY","SECRET_KEY");
var achievementService:AchievementService = App42API.buildAchievementService(); 
achievementService.createAchievement(achievementName, description, new callback());  
public class callback implements App42CallBack  
{   
	public function onSuccess(response:Object):void  
	{  
		var achievement:Achievement = Achievement(response);
		trace("achievementName is :" + achievement.getName());
		trace("description is :" + achievement.getDescription());
	}  
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	} 
}  
Not Available 
String achievementName = "Shephertz Nick";
String description = "My Game achievement";
App42API.initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.buildAchievementService(); 
Achievement achievement =  achievementService.createAchievement(achievementName, description);
System.out.println("achievementName is :" + achievement.getName());
System.out.println("description is :" + achievement.getDescription());
Earn Achievement

App users can earn achievements based on your custom rules in your game.

Required Parameters

userName - Name of the user who has earned the achievement. achievementName - Name of the achievement which is to be earned. gameName - Name of the game for which achievement has been earned. description - Description of the achievement.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String userName = "Nick";
String achievementName = "Shephertz Nick";
String gameName = "<Enter the Game Name>";
String description = "My Game achievement";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.buildAchievementService(); 
achievementService.earnAchievement(userName,achievementName, gameName,description,	new App42CallBack() {
public void onSuccess(Object response)
{
	Achievement achievement = (Achievement)response;
	System.out.println("userName is :" + achievement.getUserName());  
	System.out.println("gameName is :" + achievement.getGameName());  
	System.out.println("achievedOn is :" + achievement.getAchievedOn());   
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});		
String userName = "Nick";
String achievementName = "Shephertz Nick";
String gameName = "<Enter the Game Name>";
String description = "My Game achievement";
App42API.Initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.BuildAchievementService();  
achievementService.EarnAchievement(userName, achievementName, gameName, description, new Callback());
public class Callback : App42Callback  
{   
	public void OnSuccess(Object response)  
	{  
		Achievement achievement = (Achievement) response;   
		Console.WriteLine("AchievementName is :" + achievement.GetName());
		Console.WriteLine("UserName is :" + achievement.GetUserName());
		Console.WriteLine("GameName is :" + achievement.GetGameName());
		Console.WriteLine("AchievedOn is :" + achievement.GetAchievedOn());
	} 
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
}
NSString *achievementName = @"Shephertz Nick";
NSString *description = @"My Game achievement";
NSString *userName = @"Nick";
NSString *gameName = @"<Enter the Game Name>";

[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
AchievementService *achievementService = [App42API buildAchievementService];
[achievementService earnAchievementWithName:achievementName userName:userName gameName:gameName description:description completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Achievement *achievement = (Achievement*)responseObj;
		NSLog(@"achievementName=%@",achievement.name);
		NSLog(@"userName=%@",achievement.userName);
		NSLog(@"achievedOn=%@",achievement.achievedOn);
		NSLog(@"GameName=%@",achievement.gameName);
		NSLog(@"description=%@",achievement.description);
	}
	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 achievementName = "Expert"
let userName = "Nick"
let gameName = "<Enter the Game Name>"
let description = "Expert achievement"
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")
let achievementService = App42API.buildAchievementService() as? AchievementService
achievementService?.earnAchievementWithName(achievementName, userName: userName, gameName: gameName, description: description, completionBlock:{ (success, response, exception) -> Void in

    if(success)
    {
        let achievement = response as! Achievement
        NSLog("Response is %@" , achievement.strResponse);
        NSLog("isResponseSuccess is %d" , achievement.isResponseSuccess);
        NSLog("User Name is %@" , achievement.userName);
        NSLog("name is %@" , achievement.name);
        NSLog("description is %@" , achievement.description);
        NSLog("achievedOn is %@" , achievement.achievedOn);
    }
    else
    {
        NSLog("Exception = %@", exception.reason!)
        NSLog("App Error Code = %d", exception.appErrorCode)
        NSLog("HTTP error Code = %d", exception.httpErrorCode)
        NSLog("User Info = %@", exception.userInfo!)
    }
})
String userName = "Nick";
String achievementName = "Shephertz Nick";
String gameName = "<Enter the Game Name>";
String description = "My Game achievement";
App42API.initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.buildAchievementService(); 
Achievement achievement =  achievementService.earnAchievement(userName, achievementName,gameName, description);	
System.out.println("userName is :" + achievement.getUserName());
System.out.println("gameName is :" + achievement.getGameName());
System.out.println("achievedOn is :" + achievement.getAchievedOn());
String userName = "Nick";
String achievementName = "Shephertz Nick";
String gameName = "<Enter the Game Name>";
String description = "My Game achievement";
App42Log.SetDebug(true);		//Prints output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.BuildAchievementService();  
achievementService.EarnAchievement(userName, achievementName, gameName, description, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Achievement achievement = (Achievement) response;   
		App42Log.Console("userName is :" + achievement.getUserName());
		App42Log.Console("gameName is :" + achievement.getGameName());
		App42Log.Console("achievementName is :" + achievement.GetName());
		App42Log.Console("description is :" + achievement.GetDescription());
		App42Log.Console("achievedOn is :" + achievement.GetAchievedOn());
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var userName = "Nick",
achievementName = "Shephertz Nick",
gameName = "<Enter the Game Name>",
description = "My Game achievement",
result;
App42.initialize("API_KEY","SECRET_KEY");
var achievementService  = new App42Achievement();
achievementService.earnAchievement(userName, achievementName,gameName, description,{  
	success: function(object) 
	{  
		var achievementObj = JSON.parse(object);  
		result = achievementObj.app42.response.achievements.achievement;
		console.log("userName is :" + result.userName);
		console.log("gameName is :" + result.gameName);
		console.log("achievedOn is :" + result.achievedOn);
	},  
	error: function(error) 
	{ 
		console.log("Exception is : " + error)
	}  
});     
Coming Soon
Coming Soon
String userName = "Nick";
String achievementName = "Shephertz Nick";
String gameName = "<Enter the Game Name>";
String description = "My Game achievement";
App42API.Initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.BuildAchievementService();  
Achievement achievement =  achievementService.EarnAchievement(userName, achievementName,gameName, description);	
Console.WriteLine("userName is :" + achievement.GetUserName());
Console.WriteLine("gameName is :" + achievement.GetGameName());
Console.WriteLine("achievedOn is :" + achievement.GetAchievedOn());
$userName = "Nick";
$achievementName = "Shephertz Nick";
$gameName = "<Enter the Game Name>";
$description = "My Game achievement";
App42API::initialize("API_KEY","SECRET_KEY"); 
$achievementService = App42API::buildAchievementService(); 
$achievement = $achievementService->earnAchievement($userName,$achievementName, $gameName, $description);
print_r("achievement name is   :  " . $achievement->getName());
print_r("userName is   :  " . $achievement->getUserName());
print_r("Game name  is   :  " .$achievement->getGameName());
print_r("achieved on is   :  " . $achievement->getAchievedOn());
print_r("Description is   :  " . $achievement->getDescription());
$jsonResponse = $achievement->toString();
Not Available
Not Available
var userName:String = "Nick";
var achievementName:String = "Shephertz Nick";
var gameName:String = "<Enter the Game Name>";
var description:String = "My Game achievement";
App42API.initialize("API_KEY","SECRET_KEY");
var achievementService:AchievementService = App42API.buildAchievementService(); 
achievementService.earnAchievement(userName, achievementName,gameName, description, new callback());  
public class callback implements App42CallBack  
{  
	public function onSuccess(response:Object):void  
	{  
		var achievement:Achievement = Achievement(response);
		trace("achievementName is :" + achievement.getName());
		trace("description is :" + achievement.getDescription());
		trace("achievedOn is :" + achievement.getAchievedOn());
	}  
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
}  
Not Available 
String userName = "Nick";
String achievementName = "Shephertz Nick";
String gameName = "<Enter the Game Name>";
String description = "My Game achievement";
App42API.initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.buildAchievementService(); 
Achievement achievement =  achievementService.earnAchievement(userName, achievementName,gameName, description);	
System.out.println("userName is :" + achievement.getUserName());
System.out.println("gameName is :" + achievement.getGameName());
System.out.println("achievedOn is :" + achievement.getAchievedOn());
Get All Achievements Of User

Fetch all the achievements of a particular user.

Required Parameters

userName - Name of the user whose achievements have 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 userName = "Nick";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.buildAchievementService(); 
achievementService.getAllAchievementsForUser(userName,	new App42CallBack() {
public void onSuccess(Object response) 
{
	ArrayList<Achievement> achievement = (ArrayList<Achievement>)response;
	for(int i=0;i<achievement.size();i++)  
	{  
		System.out.println("userName  is :" + achievement.get(i).getUserName());  
		System.out.println("gameName  is :" + achievement.get(i).getGameName());  
		System.out.println("achievedOn  is :" + achievement.get(i).getAchievedOn());  
	} 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});		
String userName = "Nick";
App42API.Initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.BuildAchievementService();  
achievementService.GetAllAchievementsForUser(userName, new Callback());
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		IList<Achievement> achievement = (List<Achievement>) response; 
		for (int i = 0; i < achievement.Count; i++) 
		{
		    Console.WriteLine("AchievementName is :" + achievement[i].GetName());
			Console.WriteLine("UserName is :" + achievement[i].GetUserName());
			Console.WriteLine("GameName is :" + achievement[i].GetGameName());
			Console.WriteLine("AchievedOn is :" + achievement[i].GetAchievedOn());
		}
	}  
}  
NSString *userName = @"Nick";
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
AchievementService *achievementService = [App42API buildAchievementService];
[achievementService getAllAchievementsForUser:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		NSArray *achievementsArray = (NSArray*)responseObj;
		for (Achievement *achievement in achievementsArray)
		{
		   NSLog(@"achievementName=%@",achievement.name);
		   NSLog(@"userName=%@",achievement.userName);
		   NSLog(@"achievedOn=%@",achievement.achievedOn);
		   NSLog(@"GameName=%@",achievement.gameName);
		   NSLog(@"description=%@",achievement.description);
		}
	}
	else
	{
		NSLog(@"Exception = %@",[exception reason]);
		NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
		NSLog(@"App Error Code = %d",[exception appErrorCode]);
		NSLog(@"User Info = %@",[exception userInfo]);
	}
}];
let userName = "Nick"
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")
let achievementService = App42API.buildAchievementService() as? AchievementService
achievementService?.getAllAchievementsForUser(userName, completionBlock:{ (success, response, exception) -> Void in
    if(success)
    {
        let achievements = response as! NSArray
        for achievement in achievements{
            NSLog("Response is %@" , achievement.strResponse);
            NSLog("isResponseSuccess is %d" , achievement.isResponseSuccess);
            NSLog("User Name is %@" , achievement.userName);
            NSLog("name is %@" , achievement.name);
            NSLog("description is %@" , achievement.description);
            NSLog("achievedOn is %@" , achievement.achievedOn);
        }
    }
    else
    {
        NSLog("Exception = %@", exception.reason!)
        NSLog("App Error Code = %d", exception.appErrorCode)
        NSLog("HTTP error Code = %d", exception.httpErrorCode)
        NSLog("User Info = %@", exception.userInfo!)
    }
})
String userName = "Nick";
App42API.initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.buildAchievementService(); 
ArrayList<Achievement> achievement =  achievementService.getAllAchievementsForUser(userName);
for(int i=0;i<achievement.size();i++)
{
	System.out.println("userName is :" + achievement.get(i).getUserName());
	System.out.println("gameName is :" + achievement.get(i).getGameName());
	System.out.println("achievedOn is :" + achievement.get(i).getAchievedOn());
}
String userName = "Nick";
App42Log.SetDebug(true);		//Prints output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.BuildAchievementService();  
achievementService.GetAllAchievementsForUser(userName,new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		IList<Achievement> achievement = (IList<Achievement>) response; 
		for (int i = 0; i < achievement.Count; i++) 
		{
			App42Log.Console("userName is :" + achievement[i].GetUserName());
			App42Log.Console("gameName is :" + achievement[i].GetGameName());
			App42Log.Console("achievedOn is :" + achievement[i].GetAchievedOn());
		}
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var userName = "Nick",
result;
App42.initialize("API_KEY","SECRET_KEY");
var achievementService  = new App42Achievement();
achievementService.getAllAchievementsForUser(userName,{  
	success: function(object) 
	{  
		var achievementObj = JSON.parse(object);  
		result = achievementObj.app42.response.achievements.achievement;
		if(result instanceof Array)
		{
		for(var i = 0;i<result.length;i++){
			console.log("userName is : " + result[i].userName);
			console.log("gameName is : " + result[i].gameName);
			console.log("achievedOn is : " + result[i].achievedOn);
		}
		}else{
			console.log("userName is : " + result.userName);
			console.log("gameName is : " + result.gameName);
			console.log("achievedOn is : " + result.achievedOn);
		}
	},  
	error: function(error) 
	{ 
		console.log("Exception is : " + error)
	}  
});     
Coming Soon
Coming Soon
String userName = "Nick";
App42API.Initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.BuildAchievementService();  
IList<Achievement> achievement = achievementService.GetAllAchievementsForUser(userName);
for (int i = 0; i < achievement.Count; i++) 
{
	Console.WriteLine("userName is :" + achievement[i].GetUserName());
	Console.WriteLine("gameName is :" + achievement[i].GetGameName());
	Console.WriteLine("achievedOn is :" + achievement[i].GetAchievedOn());
}
$userName = "Nick";
App42API::initialize("API_KEY","SECRET_KEY"); 
$achievementService = App42API::buildAchievementService(); 
$achievement = $achievementService->getAllAchievementsForUser($userName);
foreach($achievement as $user )
{
	print_r("GameName is :" . $user->getGameName());
	print_r("UserName is : " .  $user->getUserName());
	print_r("Achievement Name is : " . $user->getName());
	print_r("Achieved On is :" . $user->getAchievedOn());
	print_r("Description is   :  " . $user->getDescription());
}
$jsonResponse = $achievement[0]->toString();
Not Available
Not Available
var userName:String = "Nick";
App42API.initialize("API_KEY","SECRET_KEY");
var achievementService:AchievementService = App42API.buildAchievementService(); 
achievementService.getAllAchievementsForUser(userName,new callback());  
public class callback implements App42CallBack  
{   
	public function onSuccess(response:Object):void  
	{  
		if(response is Array) 
		{
			for(var i:int = 0;i < response.length;i++)
			{
				var achievement:Achievement = Achievement(response[i]);
				trace("gameName is : "+achievement.getGameName());
				trace("userName is : "+achievement.getUserName());
				trace("achievedOn is : " + achievement.getAchievedOn());
			}	
		}
	}  
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	} 
}  
Not Available 
String userName = "Nick";
App42API.initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.buildAchievementService(); 
Vector achievementList = achievementService.getAllAchievementsForUser(userName);
for(int i=0;i< achievementList.size();i++)
{
	Achievement achievement = (Achievement) achievementList.elementAt(i);
	System.out.println("userName is :" + achievement.getUserName());
	System.out.println("gameName is :" + achievement.getGameName());
	System.out.println("achievedOn is :" + achievement.getAchievedOn());
}
Get All Achievements Of User In Game

Fetch all the achievements of a user in a particular game.

Required Parameters

userName - Name of the user whose achievements have to be fetched. gameName - Name of the game for which achievements have 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 userName = "Nick";
String gameName = "<Enter the Game Name>";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.buildAchievementService(); 
achievementService.getAllAchievementsForUserInGame(userName,gameName,new App42CallBack() {
public void onSuccess(Object response) 
{
	ArrayList<Achievement> achievement = (ArrayList<Achievement>)response;
	for(int i=0;i<achievement.size();i++)  
	{  
		System.out.println("userName is :" + achievement.get(i).getUserName());  
		System.out.println("gameName is :" + achievement.get(i).getGameName());  
		System.out.println("achievedOn is :" + achievement.get(i).getAchievedOn());  
	} 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});		
String userName = "Nick";
String gameName = "<Enter the Game Name>";
App42API.Initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.BuildAchievementService();  
achievementService.GetAllAchievementsForUserInGame(userName,gameName,new Callback());
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		IList<Achievement> achievement = (List<Achievement>) response; 
		for (int i = 0; i < achievement.Count; i++) 
		{
			Console.WriteLine("userName is :" + achievement[i].GetUserName());
			Console.WriteLine("gameName is :" + achievement[i].GetGameName());
			Console.WriteLine("achievedOn is :" + achievement[i].GetAchievedOn());
		}
	}  
}  
NSString *userName = @"Nick";
NSString *gameName = @"<Enter the Game Name>";
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
AchievementService *achievementService = [App42API buildAchievementService];
[achievementService getAllAchievementsForUser:userName inGame:gameName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		NSArray *achievementsArray = (NSArray*)responseObj;
		for (Achievement *achievement in achievementsArray)
		{
		   NSLog(@"achievementName=%@",achievement.name);
		   NSLog(@"userName=%@",achievement.userName);
		   NSLog(@"achievedOn=%@",achievement.achievedOn);
		   NSLog(@"GameName=%@",achievement.gameName);
		   NSLog(@"description=%@",achievement.description);
		}
	}
	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 gameName = "<Enter the Game Name>"
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")
let achievementService = App42API.buildAchievementService() as? AchievementService
achievementService?.getAllAchievementsForUser(userName, inGame: gameName, completionBlock:{ (success, response, exception) -> Void in
    if(success)
    {
        let achievements = response as! NSArray
        for achievement in achievements{
            NSLog("Response is %@" , achievement.strResponse);
            NSLog("isResponseSuccess is %d" , achievement.isResponseSuccess);
            NSLog("User Name is %@" , achievement.userName);
            NSLog("Game Name is %@" , achievement.gameName);
            NSLog("name is %@" , achievement.name);
            NSLog("description is %@" , achievement.description);
            NSLog("achievedOn is %@" , achievement.achievedOn);
        }
    }
    else
    {
        NSLog("Exception = %@", exception.reason!)
        NSLog("App Error Code = %d", exception.appErrorCode)
        NSLog("HTTP error Code = %d", exception.httpErrorCode)
        NSLog("User Info = %@", exception.userInfo!)
    }
})
String userName = "Nick";
String gameName = "<Enter the Game Name>";
App42API.initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.buildAchievementService(); 
ArrayList<Achievement> achievement =  achievementService.getAllAchievementsForUserInGame(userName,gameName);
for(int i=0;i<achievement.size();i++)
{
	System.out.println("userName is :" + achievement.get(i).getUserName());
	System.out.println("gameName is :" + achievement.get(i).getGameName());
	System.out.println("achievedOn is :" + achievement.get(i).getAchievedOn());
}
String userName = "Nick";
String gameName = "<Enter the Game Name>";
App42Log.SetDebug(true);		//Prints output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.BuildAchievementService();  
achievementService.GetAllAchievementsForUserInGame(userName,gameName,new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		IList<Achievement> achievement = (IList<Achievement>) response; 
		for (int i = 0; i < achievement.Count; i++) 
		{
			App42Log.Console("userName is :" + achievement[i].GetUserName());
			App42Log.Console("gameName is :" + achievement[i].GetGameName());
			App42Log.Console("achievedOn is :" + achievement[i].GetAchievedOn());
		}
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var userName = "Nick",
gameName = "<Enter the Game Name>",
result;
App42.initialize("API_KEY","SECRET_KEY");
var achievementService  = new App42Achievement();
achievementService.getAllAchievementsForUserInGame(userName,gameName,{  
	success: function(object) 
	{  
		var achievementObj = JSON.parse(object);  
		result = achievementObj.app42.response.achievements.achievement;
		if(result instanceof Array)
		{
		for(var i = 0;i<result.length;i++){
			console.log("userName is :" + result[i].userName);
			console.log("gameName is :" + result[i].gameName);
			console.log("achievedOn is :" + result[i].achievedOn);
		}
		}else{
			console.log("userName is :" + result.userName);
			console.log("gameName is :" + result.gameName);
			console.log("achievedOn is :" + result.achievedOn);
		}
	},  
	error: function(error) 
	{ 
		console.log("Exception is : " + error)
	}  
});     
Coming Soon
Coming Soon
String userName = "Nick";
String gameName = "<Enter the Game Name>";
App42API.Initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.BuildAchievementService();  
IList<Achievement> achievement = achievementService.GetAllAchievementsForUserInGame(userName,gameName);
for (int i = 0; i < achievement.Count; i++) 
{
	Console.WriteLine("userName is :" + achievement[i].GetUserName());
	Console.WriteLine("gameName is :" + achievement[i].GetGameName());
	Console.WriteLine("achievedOn is :" + achievement[i].GetAchievedOn());
}
$userName = "Nick";
$gameName = "<Enter the Game Name>";
App42API::initialize("API_KEY","SECRET_KEY"); 
$achievementService = App42API::buildAchievementService(); 
$achievement = $achievementService->getAllAchievementsForUserInGame($userName,$gameName);
foreach($achievement as $user )
{
	print_r("GameName is " . $user->getGameName());
	print_r("UserName is " .  $user->getUserName());
	print_r("Achievement Name is " . $user->getName());
	print_r("Achieved On is " . $user->getAchievedOn());
	print_r("Description is   :  " . $user->getDescription());
}
$jsonResponse = $achievement[0]->toString();
Not Available
Not Available
var userName:String = "Nick";
var gameName:String = "<Enter the Game Name>";
App42API.initialize("API_KEY","SECRET_KEY");
var achievementService:AchievementService = App42API.buildAchievementService(); 
achievementService.getAllAchievementsForUserInGame(userName,gameName, new callback());  
public class callback implements App42CallBack  
{  
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
	public function onSuccess(response:Object):void  
	{  
		if(response is Array) {
			for(var i:int = 0;i < response.length;i++)
			{
				var achievement:Achievement = Achievement(response[i]);
				trace("gameName is : "+achievement.getGameName());
				trace("userName is : "+achievement.getUserName());
				trace("achievedOn is : " + achievement.getAchievedOn());
			}	
		}
	}  
}  
Not Available 
String userName = "Nick";
String gameName = "<Enter the Game Name>";
App42API.initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.buildAchievementService(); 
Vector achievementList = achievementService.getAllAchievementsForUserInGame(userName,gameName);
for(int i=0;i< achievementList.size();i++)
{
	Achievement achievement = (Achievement) achievementList.elementAt(i);
	System.out.println("userName is :" + achievement.getUserName());
	System.out.println("gameName is :" + achievement.getGameName());
	System.out.println("achievedOn is :" + achievement.getAchievedOn());
}
Get All Achievements

View detailed description of all achievements created in an app.

  • 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");
AchievementService achievementService = App42API.buildAchievementService(); 
achievementService.getAllAchievements(new App42CallBack() {
public void onSuccess(Object response)
{
	ArrayList<Achievement> achievement = (ArrayList<Achievement>)response;
	for(int i=0;i<achievement .size();i++)
	{
		System.out.println("Achievement Name is :" + achievement .get(i).getName());
		System.out.println("Description is :" + achievement.get(i).getDescription());
	}
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});		
App42API.Initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.BuildAchievementService();  
achievementService.GetAllAchievements(new Callback());
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		IList<Achievement> achievement = (List<Achievement>) response; 
		for (int i = 0; i < achievement.Count; i++) 
		{
			Console.WriteLine("Achievement Name is :" + achievement[i].GetName());
			Console.WriteLine("Description is :" + achievement[i].GetDescription());
		}
	}  
}  
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
AchievementService *achievementService = [App42API buildAchievementService];
[achievementService getAllAchievements:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		NSArray *achievementsArray = (NSArray*)responseObj;
		for (Achievement *achievement in achievementsArray)
		{
		   NSLog(@"achievementName=%@",achievement.name);
		   NSLog(@"userName=%@",achievement.userName);
		   NSLog(@"achievedOn=%@",achievement.achievedOn);
		   NSLog(@"GameName=%@",achievement.gameName);
		   NSLog(@"description=%@",achievement.description);
		}
	}
	else
	{
		NSLog(@"Exception = %@",[exception reason]);
		NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
		NSLog(@"App Error Code = %d",[exception appErrorCode]);
		NSLog(@"User Info = %@",[exception userInfo]);
	}
}];
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")
let achievementService = App42API.buildAchievementService() as? AchievementService
achievementService?.getAllAchievements({ (success, response, exception) -> Void in
    if(success)
    {
        let achievements = response as! NSArray
        for achievement in achievements{
            NSLog("Response is %@" , achievement.strResponse);
            NSLog("isResponseSuccess is %d" , achievement.isResponseSuccess);
            NSLog("name is %@" , achievement.name);
            NSLog("description is %@" , achievement.description);
        }
    }
    else
    {
        NSLog("Exception = %@", exception.reason!)
        NSLog("App Error Code = %d", exception.appErrorCode)
        NSLog("HTTP error Code = %d", exception.httpErrorCode)
        NSLog("User Info = %@", exception.userInfo!)
    }
})
App42API.initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.buildAchievementService(); 
ArrayList<Achievement> achievement =  achievementService.getAllAchievements();
for(int i=0;i<achievement.size();i++)
{
	System.out.println("Achievement Name is :" + achievement .get(i).getName());
	System.out.println("Description is :" + achievement.get(i).getDescription());
}
App42Log.SetDebug(true);		//Prints output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.BuildAchievementService();  
achievementService.GetAllAchievements(new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		IList<Achievement> achievement = (IList<Achievement>) response; 
		for (int i = 0; i < achievement.Count; i++) 
		{
			App42Log.Console("Achievement Name is :" + achievement[i].GetName());
			App42Log.Console("Description is :" + achievement[i].GetDescription());
		}
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var result;
App42.initialize("API_KEY","SECRET_KEY");
var achievementService  = new App42Achievement();
achievementService.getAllAchievements({  
	success: function(object) 
	{  
		var achievementObj = JSON.parse(object);  
		result = achievementObj.app42.response.achievements.achievement;
		if(result instanceof Array)
		{
			for(var i = 0;i<result.length;i++){
				console.log("Achievement Name is : " + result[i].name);
				console.log("Description is : " + result[i].description);
			}
		}
		else{
		console.log("Achievement Name is : " + result.name);
		console.log("Description is : " + result.description);
		}
	},  
	error: function(error) 
	{ 
		console.log("Exception is : " + error)
	}  
});     
Coming Soon
Coming Soon
App42API.Initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.BuildAchievementService();  
IList<Achievement> achievement = achievementService.GetAllAchievements();
for (int i = 0; i < achievement.Count; i++) 
{
	Console.WriteLine("Achievement Name is :" + achievement[i].GetName());
	Console.WriteLine("Description is :" + achievement[i].GetDescription());
}
App42API::initialize("API_KEY","SECRET_KEY"); 
$achievementService = App42API::buildAchievementService(); 
$achievement = $achievementService->getAllAchievements();
foreach($achievement as $achievementInformation )
{
	print_r("Achievement Name  is " . $achievementInformation->getName());
	print_r("Description is : ".$achievementInformation->getDescription());
}
$jsonResponse = $achievement[0]->toString();
Not Available
Not Available
App42API.initialize("API_KEY","SECRET_KEY");
var achievementService:AchievementService = App42API.buildAchievementService(); 
achievementService.getAllAchievements(new callback());  
public class callback implements App42CallBack  
{  
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
	public function onSuccess(response:Object):void  
	{  
		if(response is Array) {
			for(var i:int = 0;i < response.length;i++)
			{
				var achievement:Achievement = Achievement(response[i]);
				trace("Achievement Name is : "+achievement.getName());
				trace("Description is : "+achievement.getDescription());
			}	
		}
	}  
}  
Not Available 
App42API.initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.buildAchievementService(); 
Vector achievementList = achievementService.getAllAchievements();
for(int i=0;i< achievementList.size();i++)
{
	Achievement achievement = (Achievement) achievementList.elementAt(i);
	System.out.println("Achievement Name is :" + achievement .get(i).getName());
	System.out.println("Description is :" + achievement.get(i).getDescription());
}
Get Achievement By Name

Fetch the detailed description of achievement by its name.

Required Parameters

achievementName - Name of the achievement for which details have 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 achievementName = "Shephertz Nick";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.buildAchievementService(); 
achievementService.getAchievementByName(achievementName,new App42CallBack() {
public void onSuccess(Object response) 
{
	Achievement achievement = (Achievement)response;
	System.out.println("Achievement Name is :" + achievement.getName());
	System.out.println("Description is :" + achievement.getDescription());	
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});			
String achievementName = "Shephertz Nick";
App42API.Initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.BuildAchievementService();  
achievementService.GetAchievementByName(achievementName,new Callback());
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Achievement achievement = (Achievement) response;   
		Console.WriteLine("Achievement Name is :" + achievement.GetName());
		Console.WriteLine("Description is :" + achievement.GetDescription());
	}  
}  
NSString *achievementName = @"Shephertz Nick";
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
AchievementService *achievementService = [App42API buildAchievementService];
[achievementService getAchievementByName:achievementName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		(Achievement *achievement = (Achievement*)responseObj;
		NSLog(@"achievementName=%@",achievement.name);
		NSLog(@"userName=%@",achievement.userName);
		NSLog(@"achievedOn=%@",achievement.achievedOn);
		NSLog(@"GameName=%@",achievement.gameName);
		NSLog(@"description=%@",achievement.description);
	}
	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 achievementName = "Expert"
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")
let achievementService = App42API.buildAchievementService() as? AchievementService
achievementService?.getAchievementByName(achievementName, completionBlock:{ (success, response, exception) -> Void in

    if(success)
    {
        let achievement = response as! Achievement
        NSLog("Response is %@" , achievement.strResponse);
        NSLog("isResponseSuccess is %d" , achievement.isResponseSuccess);
        NSLog("name is %@" , achievement.name);
        NSLog("description is %@" , achievement.description);
    }
    else
    {
        NSLog("Exception = %@", exception.reason!)
        NSLog("App Error Code = %d", exception.appErrorCode)
        NSLog("HTTP error Code = %d", exception.httpErrorCode)
        NSLog("User Info = %@", exception.userInfo!)
    }
})
String achievementName = "Shephertz Nick";
App42API.initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.buildAchievementService(); 
Achievement achievement =  achievementService.getAchievementByName(achievementName);	
System.out.println("Achievement Name is :" + achievement.getName());
System.out.println("Description is :" + achievement.getDescription());
String achievementName = "Shephertz Nick";
App42Log.SetDebug(true);		//Prints output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.BuildAchievementService();  
achievementService.GetAchievementByName(achievementName,new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Achievement achievement = (Achievement) response;   
		App42Log.Console("Achievement Name is :" + achievement.GetName());
		App42Log.Console("description is :" + achievement.GetDescription());
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var achievementName = "Shephertz Nick",
result;
App42.initialize("API_KEY","SECRET_KEY");
var achievementService  = new App42Achievement();
achievementService.getAchievementByName(achievementName,{  
	success: function(object) 
	{  
		var achievementObj = JSON.parse(object);  
		result = achievementObj.app42.response.achievements.achievement;
		console.log("Achievement Name is :" + result.name);
		console.log("description is :" + result.description);
	},  
	error: function(error) 
	{ 
		console.log("Exception is : " + error)
	}  
});     
Coming Soon
Coming Soon
String achievementName = "Shephertz Nick";
App42API.Initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.BuildAchievementService();  
Achievement achievement =  achievementService.GetAchievementByName(achievementName);	
Console.WriteLine("Achievement Name is :" + achievement.GetName());
Console.WriteLine("description is :" + achievement.GetDescription());
$achievementName = "Shephertz Nick";
App42API::initialize("API_KEY","SECRET_KEY"); 
$achievementService = App42API::buildAchievementService(); 
$achievement = $achievementService->getAchievementByName($achievementName);
print_r("achievement name is   :  " . $achievement->getName());
print_r("description is   :  " . $achievement->getDescription());
$jsonResponse = $achievement->toString();
Not Available
Not Available
var achievementName:String = "Shephertz Nick";
App42API.initialize("API_KEY","SECRET_KEY");
var achievementService:AchievementService = App42API.buildAchievementService(); 
achievementService.getAchievementByName(achievementName, new callback());  
public class callback implements App42CallBack  
{  
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
	public function onSuccess(response:Object):void  
	{  
		var achievement:Achievement = Achievement(response);
		trace("achievementName is :" + achievement.getName());
		trace("description is :" + achievement.getDescription());
	}  
}  
Not Available 
String achievementName = "Shephertz Nick";
App42API.initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.buildAchievementService(); 
Achievement achievement =  achievementService.getAchievementByName(achievementName);	
System.out.println("Achievement Name is :" + achievement.getName());
System.out.println("Description is :" + achievement.getDescription());
Get Users Based On Achievement

Fetch all users who have earned a particular achievement in a specific game.

Required Parameters

achievementName - Name of achievement for which all users have to be fetched. gameName - Name of the game for which user achievement 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 achievementName = "Shephertz Nick";
String gameName = "<Enter the Game Name>";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.buildAchievementService(); 
achievementService.getUsersAchievement(achievementName, gameName, new App42CallBack() {
public void onSuccess(Object response) 
{
	ArrayList<Achievement> achievement = (ArrayList<Achievement>)response;
	for(int i=0;i<achievement.size();i++)  
	{  
		System.out.println("userName is :" + achievement.get(i).getUserName());  
		System.out.println("gameName is :" + achievement.get(i).getGameName());  
		System.out.println("achievedOn is :" + achievement.get(i).getAchievedOn());  
	} 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});		
String achievementName = "Shephertz Nick";
String gameName = "<Enter the Game Name>";
App42API.Initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.BuildAchievementService();  
achievementService.GetUsersAchievement(achievementName,gameName,new Callback());
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		IList<Achievement> achievement = (List<Achievement>) response; 
		for (int i = 0; i < achievement.Count; i++) 
		{
			Console.WriteLine("userName is :" + achievement[i].GetUserName());
			Console.WriteLine("gameName is :" + achievement[i].GetGameName());
			Console.WriteLine("achievedOn is :" + achievement[i].GetAchievedOn());
		}
	}  
}  
NSString *achievementName = @"Shephertz Nick";
NSString *gameName = @"<Enter the Game Name>";
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
AchievementService *achievementService = [App42API buildAchievementService];
[achievementService getAllUsersWithAchievement:achievementName inGame:gameName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		NSArray *achievementsArray = (NSArray*)responseObj;
		for (Achievement *achievement in achievementsArray)
		{
		   NSLog(@"achievementName=%@",achievement.name);
		   NSLog(@"userName=%@",achievement.userName);
		   NSLog(@"achievedOn=%@",achievement.achievedOn);
		   NSLog(@"GameName=%@",achievement.gameName);
		   NSLog(@"description=%@",achievement.description);
		}
	}
	else
	{
		NSLog(@"Exception = %@",[exception reason]);
		NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
		NSLog(@"App Error Code = %d",[exception appErrorCode]);
		NSLog(@"User Info = %@",[exception userInfo]);
	}
}];
String achievementName = "Shephertz Nick";
String gameName = "<Enter the Game Name>";
App42API.initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.buildAchievementService(); 
ArrayList<Achievement> achievement =  achievementService.getUsersAchievement(achievementName,gameName);
for(int i=0;i<achievement.size();i++)
{
	System.out.println("userName is :" + achievement.get(i).getUserName());
	System.out.println("gameName is :" + achievement.get(i).getGameName());
	System.out.println("achievedOn is :" + achievement.get(i).getAchievedOn());
}
String achievementName = "Shephertz Nick";
String gameName = "<Enter the Game Name>";
App42Log.SetDebug(true);		//Prints output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.BuildAchievementService();  
achievementService.GetUsersAchievement(achievementName,gameName,new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		IList<Achievement> achievement = (IList<Achievement>) response; 
		for (int i = 0; i < achievement.Count; i++) 
		{
			App42Log.Console("userName is :" + achievement[i].GetUserName());
			App42Log.Console("gameName is :" + achievement[i].GetGameName());
			App42Log.Console("achievementName is :" + achievement.GetName());
			App42Log.Console("description is :" + achievement.GetDescription());
			App42Log.Console("achievedOn is :" + achievement[i].GetAchievedOn());
		}
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var achievementName = "Shephertz Nick",
gameName = "<Enter the Game Name>",
result;
App42.initialize("API_KEY","SECRET_KEY");
var achievementService  = new App42Achievement();
achievementService.getUsersAchievement(achievementName,gameName,{  
	success: function(object) 
	{  
		var achievementObj = JSON.parse(object);  
		result = achievementObj.app42.response.achievements.achievement;
		if(result instanceof Array)
		{
			for(var i = 0;i<result.length;i++){
			console.log("userName is :" + result[i].userName);
			console.log("gameName is :" + result[i].gameName);
			console.log("achievedOn is :" + result[i].achievedOn);
			}
		}
		else{
			console.log("userName is :" + result.userName);
			console.log("gameName is :" + result.gameName);
			console.log("achievedOn is :" + result.achievedOn);
		}
	},  
	error: function(error) 
	{ 
		console.log("Exception is : " + error)
	}  
});     
Coming Soon
Coming Soon
String achievementName = "Shephertz Nick";
String gameName = "<Enter the Game Name>";
App42API.Initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.BuildAchievementService();  
IList<Achievement> achievement = achievementService.GetUsersAchievement(achievementName,gameName);
for (int i = 0; i < achievement.Count; i++) 
{
	Console.WriteLine("userName is :" + achievement[i].GetUserName());
	Console.WriteLine("gameName is :" + achievement[i].GetGameName());
	Console.WriteLine("achievedOn is :" + achievement[i].GetAchievedOn());
}
$achievementName = "Shephertz Nick";
$gameName = "<Enter the Game Name>";
App42API::initialize("API_KEY","SECRET_KEY"); 
$achievementService = App42API::buildAchievementService(); 
$achievement = $achievementService->getUsersAchievement($achievementName1, $gameName);
foreach ($achievement as $achievementInfomation) 
{
	print_r("GameName is " . $achievementInfomation->getGameName());
	print_r("UserName is " . $achievementInfomation->getUserName());
	print_r("Achievement Name is " . $achievementInfomation->getName());
	print_r("Achieved On is " . $achievementInfomation->getAchievedOn());
	print_r("Description is   :  " . $achievementInfomation->getDescription());
}
$jsonResponse = $achievement[0]->toString();
Not Available
Not Available
var achievementName:String = "Shephertz Nick";
var gameName:String = "<Enter the Game Name>";
App42API.initialize("API_KEY","SECRET_KEY");
var achievementService:AchievementService = App42API.buildAchievementService(); 
achievementService.getUsersAchievement(achievementName,gameName,new callback());  
public class callback implements App42CallBack  
{  
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
	public function onSuccess(response:Object):void  
	{  
		if(response is Array) {
			for(var i:int = 0;i < response.length;i++)
			{
				var achievement:Achievement = Achievement(response[i]);
				trace("gameName is : "+achievement.getGameName());
				trace("userName is : "+achievement.getUserName());
				trace("achievedOn is : " + achievement.getAchievedOn());
			}	
		}
	}  
}  
Not Available 
String achievementName = "Shephertz Nick";
String gameName = "<Enter the Game Name>";
App42API.initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.buildAchievementService(); 
Vector achievementList = achievementService.getUsersAchievement(achievementName,gameName);
for(int i=0;i< achievementList.size();i++)
{
	Achievement achievement = (Achievement) achievementList.elementAt(i);
	System.out.println("userName is :" + achievement.getUserName());
	System.out.println("gameName is :" + achievement.getGameName());
	System.out.println("achievedOn is :" + achievement.getAchievedOn());
}
let achievementName = "Expert"
let gameName = "<Enter the Game Name>"
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")
let achievementService = App42API.buildAchievementService() as? AchievementService
achievementService?.getAllUsersWithAchievement(achievementName, inGame: gameName, completionBlock:{ (success, response, exception) -> Void in
	if(success)
    {
        let achievements = response as! NSArray
        for achievement in achievements
		{
            NSLog("Response is %@" , achievement.strResponse);
            NSLog("isResponseSuccess is %d" , achievement.isResponseSuccess);
            NSLog("name is %@" , achievement.name);
            NSLog("User Name = %@", achievement.userName)
            NSLog("description is %@" , achievement.description);
        }
    }
    else
    {
        NSLog("Exception = %@", exception.reason!)
        NSLog("App Error Code = %d", exception.appErrorCode)
        NSLog("HTTP error Code = %d", exception.httpErrorCode)
        NSLog("User Info = %@", exception.userInfo!)
    }
})
Delete User Achievement

Required Parameters

userName - Name of the user for which achievement has to be deleted. achievementName - Name of the achievement which is to be deleted. gameName - Name of the game for which achievement has to be deleted.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String userName = "Nick";
String achievementName = "Shephertz Nick";
String gameName = "<Enter the Game Name>";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.buildAchievementService();
achievementService.deleteUserAchievement(gameName, achievementName, userName, new App42CallBack() {
public void onSuccess(Object response) 
{
	App42Response app42response = (App42Response)response;      
	System.out.println("response is " + app42response) ;  
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message " + ex.getMessage());
}
});  
Coming Soon
Coming Soon
Coming Soon
Coming Soon 
Coming Soon
Coming Soon
Coming Soon
Coming Soon
Coming Soon  
Coming Soon
Coming Soon
Coming Soon
Coming Soon
Coming Soon 
Coming Soon         
Exception Handling

The functions available under Achievement API can throw some exceptions in abnormal conditions. For example, if a developer is creating an achievement name that already exists in the database, the function will throw an App42Exception (as shown below) with the message as “Bad Request” and the appErrorCode as “4800” and the details as “The Request parameters are invalid. Achievement by the name Shephertz Nick already exists.”

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
 
String achievementName = "Shephertz Nick";
String description = "My Game achievement";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.buildAchievementService(); 
achievementService.createAchievement(achievementName, description, new App42CallBack() {
public void onSuccess(Object response) 
{
	Achievement achievement = (Achievement)response;
	System.out.println("achievementName is :" + achievement.getName());  
	System.out.println("description is :" + achievement.getDescription());  
}
public void onException(Exception ex) 
{
	App42Exception exception = (App42Exception)ex;
	int appErrorCode = exception.getAppErrorCode();
	int httpErrorCode = exception.getHttpErrorCode();
	if(appErrorCode == 4800)
	{
	// Handle here for Bad Request (The Request parameters are invalid. Achievement by the name 'Shephertz Nick' alreary exists.)
	}
	else if(appErrorCode == 1401)
	{
	// handle here for Client is not authorized
	}
	else if(appErrorCode == 1500)
	{
	// handle here for Internal Server Error
	}
	String jsonText = exception.getMessage(); 
}                         	   
});                        
String achievementName = "Shephertz Nick";
String description = "My Game achievement";
App42API.Initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.BuildAchievementService();  
achievementService.CreateAchievement(achievementName, description,new Callback());
public class Callback : App42Callback  
{ 
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception); 
        int appErrorCode = exception.GetAppErrorCode();
		int httpErrorCode = exception.GetHttpErrorCode();
		if(appErrorCode == 4800)
		{
			// Handle here for Bad Request (The Request parameters are invalid. Achievement by the name 'Shephertz Nick' alreary exists.)
		}
		else if(appErrorCode == 1401)
		{
			// handle here for Client is not authorized
		}
		else if(appErrorCode == 1500)
		{
			// handle here for Internal Server Error
		}
		String jsonText = exception.GetMessage(); 		
	}  
	public void OnSuccess(Object response)  
	{
		Achievement achievement = (Achievement) response;
		String jsonResponse = achievement.ToString();  
	}
}  
					
NSString *achievementName = @"Shephertz Nick";
NSString *description = @"My Game achievement";	
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
AchievementService *achievementService = [App42API buildAchievementService];
[achievementService createAchievementWithName:achievementName description:description completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Achievement *achievement = (Achievement*)responseObj;
	}
	else
	{
		int appErrorCode = exception.appErrorCode;
		int httpErrorCode = exception.httpErrorCode;
		if(appErrorCode == 4800)
		{
			// Handle here for Bad Request (The Request parameters are invalid. Achievement by the name 'Shephertz Nick' alreary exists.)
		}
		else if(appErrorCode == 1401){
			// handle here for Client is not authorized
		}
		else if(appErrorCode == 1500){
			// handle here for Internal Server Error
		}
		NSString *jsonText = exception.reason; 	
	}
}];
Coming Soon
String achievementName = "Shephertz Nick";
String description = "My Game achievement";
App42API.initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.buildAchievementService(); 
try
{
	Achievement achievement =  achievementService.createAchievement(achievementName, description);
} 
catch(App42Exception exception)
{
	int appErrorCode = exception.getAppErrorCode();
	int httpErrorCode = exception.getHttpErrorCode();
	if(appErrorCode == 4800)
	{
		// Handle here for Bad Request (The Request parameters are invalid. Achievement by the name 'Shephertz Nick' alreary exists.)
	}
	else if(appErrorCode == 1401)
	{
		// handle here for Client is not authorized
	}
	else if(appErrorCode == 1500)
	{
		// handle here for Internal Server Error
	}
	String jsonText = exception.getMessage(); 
}      
String achievementName = "Shephertz Nick";
String description = "My Game achievement";
App42Log.SetDebug(true);		//Prints output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.BuildAchievementService();  
achievementService.CreateAchievement(achievementName, description,new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnException(Exception e)
	{  
	    App42Exception exception = (App42Exception)e;
		int appErrorCode = exception.GetAppErrorCode();
		int httpErrorCode = exception.GetHttpErrorCode();
		if(appErrorCode == 4800)
		{
			// Handle here for Bad Request (The Request parameters are invalid. Achievement by the name 'Shephertz Nick' alreary exists.)
		}
		else if(appErrorCode == 1401)
		{
			// handle here for Client is not authorized
		}
		else if(appErrorCode == 1500)
		{
			// handle here for Internal Server Error
		}
		String jsonText = exception.GetMessage(); 
	}  
	public void OnSuccess(object response)
	{  
		String jsonResponse = response.ToString();  
	}  
}   
var achievementName = "Shephertz Nick",
description = "My Game achievement",
appErrorCode ;
App42.initialize("API_KEY","SECRET_KEY");
var achievementService  = new App42Achievement();
achievementService.createAchievement(achievementName, description,{
success: function(object) {
},
error: function(error) 
{
	var achievementObj = JSON.parse(error);
	appErrorCode = achievementObj.app42Fault.appErrorCode;
	if(appErrorCode == 4800)
	{
		// Handle here for Bad Request (The Request parameters are invalid. Achievement by the name 'Shephertz Nick' alreary exists.)
	}
	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
String achievementName = "Shephertz Nick";
String description = "My Game achievement";
App42API.Initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.BuildAchievementService();  
try
{
	Achievement achievement =  achievementService.CreateAchievement(achievementName, description);
} 
catch(App42Exception exception)
{
	int appErrorCode = exception.GetAppErrorCode();
	int httpErrorCode = exception.GetHttpErrorCode();
	if(appErrorCode == 4800)
	{
		// Handle here for Bad Request (The Request parameters are invalid. Achievement by the name 'Shephertz Nick' alreary exists.)
	}
	else if(appErrorCode == 1401)
	{
		// handle here for Client is not authorized
	}
	else if(appErrorCode == 1500)
	{
		// handle here for Internal Server Error
	}
	String jsonText = exception.GetMessage(); 
}        
$achievementName = "Shephertz Nick";
$description = "My Game achievement";
App42API::initialize("API_KEY","SECRET_KEY"); 
$achievementService = App42API::buildAchievementService(); 
try
{
	$achievement = $achievementService->createAchievement($achievementName, $description);
} catch(App42Exception $exception) 
{
	$appErrorCode =$exception->getAppErrorCode();
	$httpErrorCode = $exception->getHttpErrorCode();
	if($appErrorCode == 4800)
	{
		// Handle here for Bad Request (The Request parameters are invalid. Achievement by the name 'Shephertz Nick' alreary exists.)
	}
	else if($appErrorCode == 1401){
		// handle here for Client is not authorized
	}
	else if($appErrorCode == 1500){
		// handle here for Internal Server Error
	}
	$jsonText = $exception->getMessage(); 	
}
Not Available
Not Available
var achievementName:String = "Shephertz Nick"; 
var description:String = "My Game achievement";
App42API.initialize("API_KEY","SECRET_KEY");
var achievementService:AchievementService = App42API.buildAchievementService(); 
achievementService.createAchievement(achievementName, description,new callback());   
public class callback implements App42CallBack    
{    
	public function onException(exception:App42Exception):void    
    {   
	   var appErrorCode:int = exception.getAppErrorCode();    
        var httpErrorCode:int = exception.getHttpErrorCode(); 
		if(appErrorCode == 4800)
		{
			// Handle here for Bad Request (The Request parameters are invalid. Achievement by the name 'Shephertz Nick' alreary exists.)
		}
		else if(appErrorCode == 1401)
		{
			// handle here for Client is not authorized
		}
		else if(appErrorCode == 1500)
		{
			// handle here for Internal Server Error
		}
	}    
    public function onSuccess(response:Object):void    
    {    
        var achievement:Achievement = Achievement(response);
		trace("achievementName is :" + achievement.getName());
		trace("description is :" + achievement.getDescription());
    }    
} 
Not Available
String achievementName = "Shephertz Nick";
String description = "My Game achievement";
App42API.initialize("API_KEY","SECRET_KEY");
AchievementService achievementService = App42API.buildAchievementService(); 
try
{
	Achievement achievement =  achievementService.createAchievement(achievementName, description);
} 
catch(App42Exception exception)
{
	int appErrorCode = exception.getAppErrorCode();
	int httpErrorCode = exception.getHttpErrorCode();
	if(appErrorCode == 4800)
	{
		// Handle here for Bad Request (The Request parameters are invalid. Achievement by the name 'Shephertz Nick' alreary exists.)
	}
	else if(appErrorCode == 1401)
	{
		// handle here for Client is not authorized
	}
	else if(appErrorCode == 1500)
	{
		// handle here for Internal Server Error
	}
	String jsonText = exception.getMessage(); 
}
Error Codes

Functions in Achievement 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 - The client is not authorized. 1500 - INTERNAL SERVER ERROR - Internal Server Error. Please try again. 4800 - BAD REQUEST - The request parameters are invalid. Achievement with the name '@achievementName' already exists. 4801 - NOT FOUND - Achievement by the name '@achievementName' does not exist. 4802 - NOT FOUND - Game by the name '@gameName' does not exist. 4803 - NOT FOUND - User by the name '@userName' does not have any achievements. 4804 - NOT FOUND - Achievements do not exist. 4805 - BAD REQUEST - The request parameters are invalid. Achievement with the name '@achievementName' for user '@userName' already exists. 4806 - NOT FOUND - Achievement by the name '@achievementName' is not earned for the game '@gameName'.