Complete Avatar management—create, delete, update, previous avatars, etc. Operations for managing user avatars i.e. images provided by users, Facebook, web URL or through InputStream.
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.avatar.Avatar; import com.shephertz.app42.paas.sdk.android.avatar.AvatarService;using com.shephertz.app42.paas.sdk.windows; using com.shephertz.app42.paas.sdk.windows.avatar;#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.avatar.Avatar; import com.shephertz.app42.paas.sdk.java.avatar.AvatarService;using com.shephertz.app42.paas.sdk.csharp; using com.shephertz.app42.paas.sdk.csharp.avatar;<script type="text/javascript" src="App42-all-x.x.x.min.js">Coming Soon#include "App42API.h"using com.shephertz.app42.paas.sdk.csharp; using com.shephertz.app42.paas.sdk.csharp.avatar;include_once '../App42Response.php'; include_once '../App42Exception.php'; include_once '../App42BadParameterException.php'; include_once '../App42NotFoundException.php'; include_once '../AvatarService.php'; include_once '../App42Log.php';#include "App42API.h"Coming Soonimport com.shephertz.app42.paas.sdk.as3.App42Response; import com.shephertz.app42.paas.sdk.as3.App42BadParameterException; import com.shephertz.app42.paas.sdk.as3.App42NotFoundException; import com.shephertz.app42.paas.sdk.as3.App42CallBack; import com.shephertz.app42.paas.sdk.as3.App42Exception; import com.shephertz.app42.paas.sdk.as3.App42API; import com.shephertz.app42.paas.sdk.as3.avatar.Avatar; import com.shephertz.app42.paas.sdk.as3.avatar.AvatarService;Coming Soonimport 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.avatar.Avatar; import com.shephertz.app42.paas.sdk.jme.avatar.AvatarService;
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.
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 SoonApp42API.initialize("API_KEY","SECRET_KEY");
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 AvatarService, buildAvatarService() method needs to be called.
AvatarService avatarService = App42API.buildAvatarService();AvatarService avatarService = App42API.BuildAvatarService();AvatarService *avatarService = [App42API buildAvatarService];let avatarService = App42API.buildAvatarService() as? AvatarServiceAvatarService avatarService = App42API.buildAvatarService();AvatarService avatarService = App42API.BuildAvatarService();var avatarService = new App42Avatar();Coming SoonAvatarService *avatarService = App42API::BuildAvatarService();AvatarService avatarService = App42API.BuildAvatarService();$avatarService = App42API::buildAvatarService();AvatarService *avatarService = App42API::BuildAvatarService();Coming Soonvar avatarService:AvatarService = App42API.buildAvatarService();Coming SoonAvatarService avatarService = App42API.buildAvatarService();
User can create their own avatar.
Required Parameters
avatarName - Name of avatar to be created.
userName - Name of the user who is creating avatar.
filePath - The local path for the file.
description - Description of the avatar.
String avatarName = "Shephertz Nick"; String userName = "Nick"; String filePath = "Your File Path"; String description = "My Profile Pic"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); avatarService.createAvatar(avatarName,userName,filePath, description,new App42CallBack() { public void onSuccess(Object response) { Avatar avatar = (Avatar)response; System.out.println("avatarName is :" + avatar.getName()); System.out.println("url is :" + avatar.getURL()); System.out.println("tinyUrl is :" + avatar.getTinyURL()); System.out.println("createdOn is :" + avatar.getCreatedOn()); System.out.println("Description is :"+avatar.getDescription()); System.out.println("Is Current :"+avatar.isCurrent()); System.out.println("UserName is :"+avatar.getUserName()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String avatarName = "Shephertz Nick"; String userName = "Nick"; String filePath = "Your File Path"; String description = "My Profile Pic"; App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); avatarService.CreateAvatar(avatarName, userName,filePath, description,new Callback()); public class Callback : App42Callback { public void OnSuccess(Object response) { Avatar avatar = (Avatar) response; Console.WriteLine("avatarName is :" + avatar.GetName()); Console.WriteLine("url is :" + avatar.GetURL()); Console.WriteLine("tinyUrl is :" + avatar.GetTinyURL()); Console.WriteLine("createdOn is :" + avatar.GetCreatedOn()); Console.WriteLine("Description is :"+avatar.GetDescription()); Console.WriteLine("Is Current :"+avatar.IsCurrent()); Console.WriteLine("UserName is :"+avatar.GetUserName()); } public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } }NSString *avatarName = @"Shephertz Nick"; NSString *userName = @"Nick"; NSString *filePath = @"Your File Path"; NSString *description = @"My Profile Pic"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; AvatarService *avatarService = [App42API buildAvatarService]; [avatarService createAvatarWithName:avatarName userName:userName filePath:filePath description:description completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Avatar *avatar = (Avatar*)responseObj; NSLog(@"AvatarName %@",avatar.name); NSLog(@"tinyUrl is %@",avatar.tinyUrl); NSLog(@"UserName is %@",avatar.userName); NSLog(@"Is Current is %d",avatar.isCurrent); } 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 avatarName = "Shephertz Nick" let userName = "Nick" let filePath = "Your File Path" let description = "My Profile Pic" App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY") let avatarService = App42API.buildAvatarService() as? AvatarService avatarService?.createAvatarWithName(avatarName, userName: userName, filePath: filePath, description: description, completionBlock: { (success, response, exception) -> Void in if(success) { let avatar = response as! Avatar NSLog("%@",avatar.name) NSLog("%@",avatar.tinyUrl) NSLog("%@",avatar.userName) NSLog("%d",avatar.isCurrent) } else { NSLog("%@",exception.reason!) NSLog("%d",exception.httpErrorCode) NSLog("%d",exception.appErrorCode) NSLog("%@",exception.userInfo!) } })String avatarName = "Shephertz Nick"; String userName = "Nick"; String filePath = "Your File Path"; String description = "My Profile Pic"; App42API.initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); Avatar avatar = avatarService.createAvatar(avatarName, userName,filePath, description); System.out.println("avatarName is :" + avatar.getName()); System.out.println("url is :" + avatar.getURL()); System.out.println("tinyUrl is :" + avatar.getTinyURL()); System.out.println("createdOn is :" + avatar.getCreatedOn()); System.out.println("Description is :"+avatar.getDescription()); System.out.println("Is Current :"+avatar.isCurrent()); System.out.println("UserName is :"+avatar.getUserName());String avatarName = "Shephertz Nick"; String userName = "Nick"; String filePath = "Your File Path"; String description = "My Profile Pic"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); avatarService.CreateAvatar(avatarName, userName,filePath, description,new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Avatar avatar = (Avatar) response; App42Log.Console("Avatar Name is : " + avatar.GetName()); App42Log.Console("Url is : " + avatar.GetUrl()); App42Log.Console("TinyUrl is : " + avatar.GetTinyUrl()); App42Log.Console("CreatedOn is : " + avatar.GetCreatedOn()); App42Log.Console("Description is :"+avatar.GetDescription()); App42Log.Console("Is Current :"+avatar.IsCurrent()); App42Log.Console("UserName is :"+avatar.GetUserName()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var avatarName = "Shephertz Nick", userName = "Nick", filePath = document.getElementById("Your Input Type File Id"); file = filePath.files[0], description = "My Profile Pic", result; App42.initialize("API_KEY","SECRET_KEY"); var avatarService = new App42Avatar(); avatarService.createAvatar(avatarName, userName,file, description,{ success: function(object) { var avatarObj = JSON.parse(object); result = avatarObj.app42.response.avatars.avatar; console.log("avatarName is : " + result.name) console.log("url is : " + result.url) console.log("tinyUrl is : " + result.tinyUrl) console.log("createdOn is : " + result.createdOn) console.log("Description is :"+result.description); console.log("Is Current :"+result.isCurrent); console.log("UserName is :"+result.userName); }, error: function(error) { console.log("Exception is : " + error) } });Coming Soonconst char* avatarName = "Shephertz Nick"; const char* userName = "Nick"; const char* filePath = "Your File Path"; const char* description = "My Profile Pic"; App42API::Initialize("API_KEY", "SECRET_KEY"); AvatarService *avatarService = App42API::BuildAvatarService(); avatarService->CreateAvatar(avatarName, userName, filePath, description, app42callback(Sample_Class::onAvatarServiceRequestCompleted, this)); void Sample_Class::onAvatarServiceRequestCompleted(void *response) { App42AvatarResponse *app42AvatarResponse = (App42AvatarResponse*)response; if(app42AvatarResponse->isSuccess) { printf("\ncode=%d",app42AvatarResponse->getCode()); printf("\nisSuccess=%d",app42AvatarResponse->isSuccess); printf("\nResponse Body=%s",app42AvatarResponse->getBody().c_str()); for(std::vector<App42Avatar>::iterator it = app42AvatarResponse->avatars.begin(); it != app42AvatarResponse->avatars.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n AvatarName=%s\n",it->name.c_str()); printf("\n URL=%s\n",it->url.c_str()); printf("\n CreatedOn=%s\n",it->createdOn.c_str()); printf("\n Description=%s\n",it->description.c_str()); printf("\n isCurrent=%d\n",it->isCurrent); } } else { printf("\nerrordetails:%s",app42AvatarResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42AvatarResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42AvatarResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42AvatarResponse->httpErrorCode); } }String avatarName = "Shephertz Nick"; String userName = "Nick"; String filePath = "Your File Path"; String description = "My Profile Pic"; App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); Avatar avatar = avatarService.CreateAvatar(avatarName, userName,filePath, description); Console.WriteLine("avatarName is :" + avatar.GetName()); Console.WriteLine("url is :" + avatar.GetURL()); Console.WriteLine("tinyUrl is :" + avatar.GetTinyURL()); Console.WriteLine("createdOn is :" + avatar.GetCreatedOn()); Console.WriteLine("Description is :"+avatar.GetDescription()); Console.WriteLine("Is Current :"+avatar.IsCurrent()); Console.WriteLine("UserName is :"+avatar.GetUserName());$avatarName = "Shephertz Nick"; $userName = "Nick"; $filePath = "Your File Path"; $description = "My Profile Pic"; App42API::initialize("API_KEY","SECRET_KEY"); $avatarService = App42API::buildAvatarService(); $avatar = $avatarService->createAvatar($avatarName, $userName, $filePath, $description); print_r("Avatar name is : " . $avatar->getName()); print_r("userName is :" . $avatar->getUserName()); print_r("url : " . $avatar->getURL()); print_r("tiny url : " . $avatar->getTinyURL()); print_r("created on : " .$avatar->getCreatedOn()); print_r("description : " . $avatar->getDescription()); print_r("Current is : " . $avatar->isCurrent());const char* avatarName = "Shephertz Nick"; const char* userName = "Nick"; const char* filePath = "Your File Path"; const char* description = "My Profile Pic"; App42API::Initialize("API_KEY", "SECRET_KEY"); AvatarService *avatarService = App42API::BuildAvatarService(); avatarService->CreateAvatar(avatarName, userName, filePath, description, this, app42callfuncND_selector(Sample_Class::onAvatarServiceRequestCompleted)); void Sample_Class::onAvatarServiceRequestCompleted(App42CallBack *sender, void *response) { App42AvatarResponse *app42AvatarResponse = (App42AvatarResponse*)response; if(app42AvatarResponse->isSuccess) { printf("\ncode=%d",app42AvatarResponse->getCode()); printf("\nisSuccess=%d",app42AvatarResponse->isSuccess); printf("\nResponse Body=%s",app42AvatarResponse->getBody().c_str()); for(std::vector<App42Avatar>::iterator it = app42AvatarResponse->avatars.begin(); it != app42AvatarResponse->avatars.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n AvatarName=%s\n",it->name.c_str()); printf("\n URL=%s\n",it->url.c_str()); printf("\n CreatedOn=%s\n",it->createdOn.c_str()); printf("\n Description=%s\n",it->description.c_str()); printf("\n isCurrent=%d\n",it->isCurrent); } } else { printf("\nerrordetails:%s",app42AvatarResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42AvatarResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42AvatarResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42AvatarResponse->httpErrorCode); } }Coming SoonComing SoonComing SoonString avatarName = "Shephertz Nick"; String userName = "Nick"; String filePath = "Your File Path"; String description = "My Profile Pic"; App42API.initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); Avatar avatar = avatarService.createAvatar(avatarName, userName,filePath, description); System.out.println("avatarName is :" + avatar.getName()); System.out.println("url is :" + avatar.getURL()); System.out.println("tinyUrl is :" + avatar.getTinyURL()); System.out.println("createdOn is :" + avatar.getCreatedOn()); System.out.println("Description is :"+avatar.getDescription()); System.out.println("Is Current :"+avatar.isCurrent()); System.out.println("UserName is :"+avatar.getUserName());
User can create their own avatar with input stream.
Required Parameters
avatarName - Name of avatar to be created.
userName - Name of the user who is creating avatar.
inputStream - InputStream of the file to be creating avatar.
description - Description of the avatar.
fileExtension - Extention of the image. e.g:- GIF, PNG, JPG.
String avatarName = "Shephertz Nick"; String userName = "Nick"; InputStream inputStream = null; /* Get input stream from your source */ String description = "My Profile Pic"; FileExtension fileExtension = FileExtension.GIF; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); avatarService.createAvatar(avatarName,userName,filePath, description, fileExtension, new App42CallBack() { public void onSuccess(Object response) { Avatar avatar = (Avatar)response; System.out.println("avatarName is :" + avatar.getName()); System.out.println("url is :" + avatar.getURL()); System.out.println("tinyUrl is :" + avatar.getTinyURL()); System.out.println("createdOn is :" + avatar.getCreatedOn()); System.out.println("Description is :"+avatar.getDescription()); System.out.println("Is Current :"+avatar.isCurrent()); System.out.println("UserName is :"+avatar.getUserName()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });Coming SoonNSString *avatarName = @"Shephertz Nick"; NSString *userName = @"Nick"; NSString *filePath = @"Your File Path"; NSData *data = [NSData dataWithContentsOfFile:filePath]; NSString *description = @"My Profile Pic"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; AvatarService *avatarService = [App42API buildAvatarService]; [avatarService createAvatarFromFileDataWithName:avatarName userName:userName fileData:data description:description extension:PNG completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Avatar *avatar = (Avatar*)responseObj; NSLog(@"AvatarName %@",avatar.name); NSLog(@"tinyUrl is %@",avatar.tinyUrl); NSLog(@"UserName is %@",avatar.userName); NSLog(@"Is Current is %d",avatar.isCurrent); } 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 avatarName = "Shephertz Nick" let userName = "Nick" let filePath = NSBundle.mainBundle().pathForResource("Image", ofType: "png") let description = "My Profile Pic" let data = NSData(contentsOfFile:filePath!) NSLog("Data = %@", data!) App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") let avatarService = App42API.buildAvatarService() as? AvatarService avatarService?.createAvatarFromFileDataWithName(avatarName, userName: userName, fileData:data, description:description, `extension`:"png", completionBlock: { (success, response, exception) -> Void in if(success) { let avatar = response as! Avatar NSLog("%@",avatar.name) NSLog("%@",avatar.tinyUrl) NSLog("%@",avatar.userName) NSLog("%d",avatar.isCurrent) } else { NSLog("%@",exception.reason!) NSLog("%d",exception.httpErrorCode) NSLog("%d",exception.appErrorCode) NSLog("%@",exception.userInfo!) } })String avatarName = "Shephertz Nick"; String userName = "Nick"; InputStream inputStream = null; /* Get input stream from your source */ String description = "My Profile Pic"; FileExtension fileExtension = FileExtension.GIF; App42API.initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); Avatar avatar = avatarService.createAvatar(avatarName, userName,inputStream, description,fileExtension); System.out.println("avatarName is :" + avatar.getName()); System.out.println("url is :" + avatar.getURL()); System.out.println("tinyUrl is :" + avatar.getTinyURL()); System.out.println("createdOn is :" + avatar.getCreatedOn()); System.out.println("Description is :"+avatar.getDescription()); System.out.println("Is Current :"+avatar.isCurrent()); System.out.println("UserName is :"+avatar.getUserName());String avatarName = "Shephertz Nick"; String userName = "Nick"; String filePath = "Your File Path"; String description = "My Profile Pic"; String extension = "Avatar file extension"; // e.g "jpg","png". Stream stream = new FileStream(filePath, FileMode.Open); App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); avatarService.CreateAvatar(avatarName, userName, stream, description, extension, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Avatar avatar = (Avatar) response; App42Log.Console("Avatar Name is : " + avatar.GetName()); App42Log.Console("Url is : " + avatar.GetUrl()); App42Log.Console("CreatedOn is : " + avatar.GetCreatedOn()); App42Log.Console("Description is :"+avatar.GetDescription()); App42Log.Console("Is Current :"+avatar.IsCurrent()); App42Log.Console("UserName is :"+avatar.GetUserName()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Coming SoonComing Soonconst char* avatarName = "Shephertz Nick"; const char* userName = "Nick"; const char* description = "My Profile Pic"; unsigned char* inputStream = nullptr; /* Get input stream from your source */ int inputStreamSize = <input_stream_size>; FileExtension fileExtension = PNG; App42API::Initialize("API_KEY", "SECRET_KEY"); AvatarService *avatarService = App42API::BuildAvatarService(); avatarService->CreateAvatar(avatarName, userName, inputStream, fileDataLength, description, fileExtension, app42callback(Sample_Class::onAvatarServiceRequestCompleted, this)); void Sample_Class::onAvatarServiceRequestCompleted(void *response) { App42AvatarResponse *app42AvatarResponse = (App42AvatarResponse*)response; if(app42AvatarResponse->isSuccess) { printf("\ncode=%d",app42AvatarResponse->getCode()); printf("\nisSuccess=%d",app42AvatarResponse->isSuccess); printf("\nResponse Body=%s",app42AvatarResponse->getBody().c_str()); for(std::vector<App42Avatar>::iterator it = app42AvatarResponse->avatars.begin(); it != app42AvatarResponse->avatars.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n AvatarName=%s\n",it->name.c_str()); printf("\n URL=%s\n",it->url.c_str()); printf("\n CreatedOn=%s\n",it->createdOn.c_str()); printf("\n Description=%s\n",it->description.c_str()); printf("\n isCurrent=%d\n",it->isCurrent); } } else { printf("\nerrordetails:%s",app42AvatarResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42AvatarResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42AvatarResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42AvatarResponse->httpErrorCode); } }String avatarName = "Shephertz Nick"; String userName = "Nick"; String filePath = "Your File Path"; String description = "My Profile Pic"; String fileExtension = FileExtension.GIF; App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); Avatar avatar = avatarService.CreateAvatar(avatarName, userName,filePath, description,fileExtension); Console.WriteLine("avatarName is :" + avatar.GetName()); Console.WriteLine("url is :" + avatar.GetURL()); Console.WriteLine("tinyUrl is :" + avatar.GetTinyURL()); Console.WriteLine("createdOn is :" + avatar.GetCreatedOn()); Console.WriteLine("Description is :"+avatar.GetDescription()); Console.WriteLine("Is Current :"+avatar.IsCurrent()); Console.WriteLine("UserName is :"+avatar.GetUserName());Not Availableconst char* avatarName = "Shephertz Nick"; const char* userName = "Nick"; const char* description = "My Profile Pic"; unsigned char* inputStream = nullptr; /* Get input stream from your source */ int inputStreamSize = <input_stream_size>; FileExtension fileExtension = PNG; App42API::Initialize("API_KEY", "SECRET_KEY"); AvatarService *avatarService = App42API::BuildAvatarService(); avatarService->CreateAvatar(avatarName, userName, inputStream, fileDataLength, description, fileExtension, this, app42callfuncND_selector(Sample_Class::onAvatarServiceRequestCompleted)); void Sample_Class::onAvatarServiceRequestCompleted(App42CallBack *sender, void *response) { App42AvatarResponse *app42AvatarResponse = (App42AvatarResponse*)response; if(app42AvatarResponse->isSuccess) { printf("\ncode=%d",app42AvatarResponse->getCode()); printf("\nisSuccess=%d",app42AvatarResponse->isSuccess); printf("\nResponse Body=%s",app42AvatarResponse->getBody().c_str()); for(std::vector<App42Avatar>::iterator it = app42AvatarResponse->avatars.begin(); it != app42AvatarResponse->avatars.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n AvatarName=%s\n",it->name.c_str()); printf("\n URL=%s\n",it->url.c_str()); printf("\n CreatedOn=%s\n",it->createdOn.c_str()); printf("\n Description=%s\n",it->description.c_str()); printf("\n isCurrent=%d\n",it->isCurrent); } } else { printf("\nerrordetails:%s",app42AvatarResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42AvatarResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42AvatarResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42AvatarResponse->httpErrorCode); } }Coming SoonComing SoonComing SoonComing Soon
User can import their avatar from Facebook based on giving access token.
Required Parameters
avatarName - Name of avatar to be created.
userName - Name of the user who is creating an avatar.
accessToken - Facebook Access Token that has been received after authorization.
description - Description of the avatar.
String avatarName = "Shephertz Nick"; String userName = "Nick"; String accessToken = "<Enter Your Facebook Access Token>"; String description = "My Profile Pic"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); avatarService.createAvatarFromFacebook(avatarName, userName, accessToken, description,new App42CallBack() { public void onSuccess(Object response) { Avatar avatar = (Avatar)response; System.out.println("avatarName is :" + avatar.getName()); System.out.println("url is :" + avatar.getURL()); System.out.println("tinyUrl is :" + avatar.getTinyURL()); System.out.println("createdOn is :" + avatar.getCreatedOn()); System.out.println("Description is :"+avatar.getDescription()); System.out.println("Is Current :"+avatar.isCurrent()); System.out.println("UserName is :"+avatar.getUserName()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String avatarName = "Shephertz Nick"; String userName = "Nick"; String accessToken = "<Enter Your Facebook Access Token>"; String description = "My Profile Pic"; App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); avatarService.CreateAvatarFromFacebook(avatarName, userName,accessToken, description,new Callback()); public class Callback : App42Callback { public void OnSuccess(Object response) { Avatar avatar = (Avatar) response; Console.WriteLine("avatarName is :" + avatar.GetName()); Console.WriteLine("url is :" + avatar.GetURL()); Console.WriteLine("tinyUrl is :" + avatar.GetTinyURL()); Console.WriteLine("createdOn is :" + avatar.GetCreatedOn()); Console.WriteLine("Description is :"+avatar.GetDescription()); Console.WriteLine("Is Current :"+avatar.IsCurrent()); Console.WriteLine("UserName is :"+avatar.GetUserName()); } public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } }NSString *avatarName = @"Shephertz Nick"; NSString *userName = @"Nick"; NSString *accessToken = @"<Enter Your Facebook Access Token>"; NSString *description = @"My Profile Pic"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; AvatarService *avatarService = [App42API buildAvatarService]; [avatarService createAvatarFromFacebookWithName:avatarName userName:userName accessToken:accessToken description:description completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Avatar *avatar = (Avatar*)responseObj; NSLog(@"AvatarName %@",avatar.name); NSLog(@"tinyUrl is %@",avatar.tinyUrl); NSLog(@"UserName is %@",avatar.userName); NSLog(@"Is Current is %d",avatar.isCurrent); } 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 avatarName = "Shephertz Nick" let userName = "Nick" let accessToken = "<Enter Your Facebook Access Token>" let description = "My Profile Pic" App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") let avatarService = App42API.buildAvatarService() as? AvatarService avatarService?.createAvatarFromFacebookWithName(avatarName, userName: userName, accessToken:accessToken, description: description, completionBlock: { (success, response, exception) -> Void in if (success) { let avatar = response as! Avatar NSLog("%@",avatar.name) NSLog("%@",avatar.tinyUrl) NSLog("%@",avatar.userName) NSLog("%d",avatar.isCurrent) } else { NSLog("%@",exception.reason!) NSLog("%d",exception.httpErrorCode) NSLog("%d",exception.appErrorCode) NSLog("%@",exception.userInfo!) } })String avatarName = "Shephertz Nick"; String userName = "Nick"; String accessToken = "<Enter Your Facebook Access Token>"; String description = "My Profile Pic"; App42API.initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); Avatar avatar = avatarService.createAvatarFromFacebook(avatarName, userName,accessToken, description); System.out.println("avatarName is :" + avatar.getName()); System.out.println("url is :" + avatar.getURL()); System.out.println("tinyUrl is :" + avatar.getTinyURL()); System.out.println("createdOn is :" + avatar.getCreatedOn()); System.out.println("Description is :"+avatar.getDescription()); System.out.println("Is Current :"+avatar.isCurrent()); System.out.println("UserName is :"+avatar.getUserName());String avatarName = "Shephertz Nick"; String userName = "Nick"; String accessToken = "<Enter Your Facebook Access Token>"; String description = "My Profile Pic"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); avatarService.CreateAvatarFromFacebook(avatarName, userName,accessToken, description,new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Avatar avatar = (Avatar) response; App42Log.Console("Avatar Name is : " + avatar.GetName()); App42Log.Console("Url is : " + avatar.GetUrl()); App42Log.Console("TinyUrl is : " + avatar.GetTinyUrl()); App42Log.Console("CreatedOn is : " + avatar.GetCreatedOn()); App42Log.Console("Description is : " + avatar.GetDescription()); App42Log.Console("Is Current :"+avatar.IsCurrent()); App42Log.Console("UserName is :"+avatar.GetUserName()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var avatarName = "Shephertz Nick", userName = "Nick", accessToken = "<Enter Your Facebook Access Token>", description = "My Profile Pic", result; App42.initialize("API_KEY","SECRET_KEY"); var avatarService = new App42Avatar(); avatarService.createAvatarFromFacebook(avatarName, userName,accessToken, description,{ success: function(object) { var avatarObj = JSON.parse(object); result = avatarObj.app42.response.avatars.avatar; console.log("avatarName is : " + result.name) console.log("url is : " + result.url) console.log("tinyUrl is : " + result.tinyUrl) console.log("createdOn is : " + result.createdOn) console.log("Description is :"+result.description); console.log("Is Current :"+result.isCurrent); console.log("UserName is :"+result.userName); }, error: function(error) { console.log("Exception is : " + error) } });Coming Soonconst char* avatarName = "Shephertz Nick"; const char* userName = "Nick"; const char* description = "My Profile Pic"; const char* accessToken = "<Enter Your Facebook Access Token>"; App42API::Initialize("API_KEY", "SECRET_KEY"); AvatarService *avatarService = App42API::BuildAvatarService(); avatarService->CreateAvatarFromFacebook(avatarName, userName, accessToken, description, app42callback(Sample_Class::onAvatarServiceRequestCompleted, this)); void Sample_Class::onAvatarServiceRequestCompleted(void *response) { App42AvatarResponse *app42AvatarResponse = (App42AvatarResponse*)response; if(app42AvatarResponse->isSuccess) { printf("\ncode=%d",app42AvatarResponse->getCode()); printf("\nisSuccess=%d",app42AvatarResponse->isSuccess); printf("\nResponse Body=%s",app42AvatarResponse->getBody().c_str()); for(std::vector<App42Avatar>::iterator it = app42AvatarResponse->avatars.begin(); it != app42AvatarResponse->avatars.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n AvatarName=%s\n",it->name.c_str()); printf("\n URL=%s\n",it->url.c_str()); printf("\n CreatedOn=%s\n",it->createdOn.c_str()); printf("\n Description=%s\n",it->description.c_str()); printf("\n isCurrent=%d\n",it->isCurrent); } } else { printf("\nerrordetails:%s",app42AvatarResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42AvatarResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42AvatarResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42AvatarResponse->httpErrorCode); } }String avatarName = "Shephertz Nick"; String userName = "Nick"; String accessToken = "<Enter Your Facebook Access Token>"; String description = "My Profile Pic"; App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); Avatar avatar = avatarService.CreateAvatarFromFacebook(avatarName, userName,accessToken, description); Console.WriteLine("avatarName is :" + avatar.GetName()); Console.WriteLine("url is :" + avatar.GetURL()); Console.WriteLine("tinyUrl is :" + avatar.GetTinyURL()); Console.WriteLine("createdOn is :" + avatar.GetCreatedOn()); Console.WriteLine("Description is :"+avatar.GetDescription()); Console.WriteLine("Is Current :"+avatar.IsCurrent()); Console.WriteLine("UserName is :"+avatar.GetUserName());$avatarName = "Shephertz Nick"; $userName = "Nick"; $accessToken = "<Enter Your Facebook Access Token>"; $description = "My Profile Pic"; App42API::initialize("API_KEY","SECRET_KEY"); $avatarService = App42API::buildAvatarService(); $avatar = $avatarService->createAvatarFromFacebook($avatarName, $userName, $accessToken, $description); print_r("Avatar name is : " . $avatar->getName()); print_r("userName is :" . $avatar->getUserName()); print_r("url : " . $avatar->getURL()); print_r("tiny url : " . $avatar->getTinyURL()); print_r("created on : " .$avatar->getCreatedOn()); print_r("description : " . $avatar->getDescription()); print_r("Current is : " . $avatar->isCurrent());const char* avatarName = "Shephertz Nick"; const char* userName = "Nick"; const char* description = "My Profile Pic"; const char* accessToken = "<Enter Your Facebook Access Token>"; App42API::Initialize("API_KEY", "SECRET_KEY"); AvatarService *avatarService = App42API::BuildAvatarService(); avatarService->CreateAvatarFromFacebook(avatarName, userName, accessToken, description, this, app42callfuncND_selector(Sample_Class::onAvatarServiceRequestCompleted)); void Sample_Class::onAvatarServiceRequestCompleted(App42CallBack *sender, void *response) { App42AvatarResponse *app42AvatarResponse = (App42AvatarResponse*)response; if(app42AvatarResponse->isSuccess) { printf("\ncode=%d",app42AvatarResponse->getCode()); printf("\nisSuccess=%d",app42AvatarResponse->isSuccess); printf("\nResponse Body=%s",app42AvatarResponse->getBody().c_str()); for(std::vector<App42Avatar>::iterator it = app42AvatarResponse->avatars.begin(); it != app42AvatarResponse->avatars.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n AvatarName=%s\n",it->name.c_str()); printf("\n URL=%s\n",it->url.c_str()); printf("\n CreatedOn=%s\n",it->createdOn.c_str()); printf("\n Description=%s\n",it->description.c_str()); printf("\n isCurrent=%d\n",it->isCurrent); } } else { printf("\nerrordetails:%s",app42AvatarResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42AvatarResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42AvatarResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42AvatarResponse->httpErrorCode); } }Coming Soonvar avatarName:String = "Shephertz Nick"; var userName:String = "Nick"; var accessToken:String = "<Enter Your Facebook Access Token>"; var description:String = "My Profile Pic"; App42API.initialize("API_KEY","SECRET_KEY"); var avatarService:AvatarService = App42API.buildAvatarService(); avatarService.createAvatarFromFacebook(avatarName,userName, accessToken, description,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var avatar:Avatar = Avatar(response); trace("Avatar success is : "+response) trace("Created On :"+avatar.getCreatedOn()); trace("Description is :"+avatar.getDescription()); trace("Avatar Name is:"+avatar.getName()); trace("Tiny url :"+avatar.getTinyURL()); trace("Is Current :"+avatar.IsCurrent()); trace("UserName is :"+avatar.getUserName()); trace("Url is :"+avatar.getURL()); } }Coming SoonString avatarName = "Shephertz Nick"; String userName = "Nick"; String accessToken = "<Enter Your Facebook Access Token>"; String description = "My Profile Pic"; App42API.initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); Avatar avatar = avatarService.createAvatarFromFacebook(avatarName, userName,accessToken, description); System.out.println("avatarName is :" + avatar.getName()); System.out.println("url is :" + avatar.getURL()); System.out.println("tinyUrl is :" + avatar.getTinyURL()); System.out.println("createdOn is :" + avatar.getCreatedOn()); System.out.println("Description is :"+avatar.getDescription()); System.out.println("Is Current :"+avatar.isCurrent()); System.out.println("UserName is :"+avatar.getUserName());
Create an avatar from any web media using a URL.
Required Parameters
avatarName - Name of avatar to be created.
userName - Name of the user who is creating an avatar.
webURL - Web URL of the photo which you want to create.
description - Description of the avatar.
String avatarName = "Shephertz Nick"; String userName = "Nick"; String webURL = "<Enter the WebURL>"; String description = "My Profile Pic"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); avatarService.createAvatarFromWebURL(avatarName, userName, webURL, description, new App42CallBack() { public void onSuccess(Object response) { Avatar avatar = (Avatar)response; System.out.println("avatarName is :" + avatar.getName()); System.out.println("url is :" + avatar.getURL()); System.out.println("tinyUrl is :" + avatar.getTinyURL()); System.out.println("createdOn is :" + avatar.getCreatedOn()); System.out.println("Description is :"+avatar.getDescription()); System.out.println("Is Current :"+avatar.isCurrent()); System.out.println("UserName is :"+avatar.getUserName()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String avatarName = "Shephertz Nick"; String userName = "Nick"; String webURL = "<Enter the WebURL>"; String description = "My Profile Pic"; App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); avatarService.CreateAvatarFromWebURL(avatarName, userName,webURL, description,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Avatar avatar = (Avatar) response; Console.WriteLine("avatarName is :" + avatar.GetName()); Console.WriteLine("url is :" + avatar.GetURL()); Console.WriteLine("tinyUrl is :" + avatar.GetTinyURL()); Console.WriteLine("createdOn is :" + avatar.GetCreatedOn()); Console.WriteLine("Description is :"+avatar.GetDescription()); Console.WriteLine("Is Current :"+avatar.IsCurrent()); Console.WriteLine("UserName is :"+avatar.GetUserName()); } }NSString *avatarName = @"Shephertz Nick"; NSString *userName = @"Nick"; NSString *webUrl = @"<Enter the WebURL>"; NSString *description = @"My Profile Pic"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; AvatarService *avatarService = [App42API buildAvatarService]; [avatarService createAvatarFromWebURLWithName:avatarName userName:userName webUrl:webUrl description:description completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Avatar *avatar = (Avatar*)responseObj; NSLog(@"AvatarName %@",avatar.name); NSLog(@"tinyUrl is %@",avatar.tinyUrl); NSLog(@"UserName is %@",avatar.userName); NSLog(@"Is Current is %d",avatar.isCurrent); } 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 avatarName = "Shephertz Nick" let userName = "Nick" let webUrl = "<Enter the WebURL>" let description = "My Profile Pic" App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") let avatarService = App42API.buildAvatarService() as? AvatarService avatarService?.createAvatarFromWebURLWithName(avatarName, userName:userName, webUrl:webUrl, description:description, completionBlock:{ (success, response, exception) -> Void in if (success) { let avatar = response as! Avatar NSLog("%@",avatar.name) NSLog("%@",avatar.tinyUrl) NSLog("%@",avatar.userName) NSLog("%d",avatar.isCurrent) } else { NSLog("%@",exception.reason!) NSLog("%d",exception.httpErrorCode) NSLog("%d",exception.appErrorCode) NSLog("%@",exception.userInfo!) } })String avatarName = "Shephertz Nick"; String userName = "Nick"; String webURL = "<Enter the WebURL>"; String description = "My Profile Pic"; App42API.initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); Avatar avatar = avatarService.createAvatarFromWebURL(avatarName, userName,webURL, description); System.out.println("avatarName is :" + avatar.getName()); System.out.println("url is :" + avatar.getURL()); System.out.println("tinyUrl is :" + avatar.getTinyURL()); System.out.println("createdOn is :" + avatar.getCreatedOn()); System.out.println("Description is :"+avatar.getDescription()); System.out.println("Is Current :"+avatar.isCurrent()); System.out.println("UserName is :"+avatar.getUserName());String avatarName = "Shephertz Nick"; String userName = "Nick"; String webURL = "<Enter the WebURL>"; String description = "My Profile Pic"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); avatarService.CreateAvatarFromWebURL(avatarName, userName, webURL, description,new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Avatar avatar = (Avatar) response; App42Log.Console("Avatar Name is : " + avatar.GetName()); App42Log.Console("Url is : " + avatar.GetUrl()); App42Log.Console("TinyUrl is : " + avatar.GetTinyUrl()); App42Log.Console("CreatedOn is : " + avatar.GetCreatedOn()); App42Log.Console("Description is : " + avatar.GetDescription()); App42Log.Console("Is Current :"+avatar.IsCurrent()); App42Log.Console("UserName is :"+avatar.GetUserName()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var avatarName = "Shephertz Nick", userName = "Nick", webURL = "<Enter the WebURL>", description = "My Profile Pic", result; App42.initialize("API_KEY","SECRET_KEY"); var avatarService = new App42Avatar(); avatarService.createAvatarFromWebURL(avatarName, userName,webURL, description,{ success: function(object) { var avatarObj = JSON.parse(object); result = avatarObj.app42.response.avatars.avatar; console.log("avatarName is : " + result.name) console.log("url is : " + result.url) console.log("tinyUrl is : " + result.tinyUrl) console.log("createdOn is : " + result.createdOn) console.log("Description is :"+result.description); console.log("Is Current :"+result.isCurrent); console.log("UserName is :"+result.userName); }, error: function(error) { console.log("Exception is : " + error) } });Coming Soonconst char* avatarName = "Shephertz Nick"; const char* userName = "Nick"; const char* description = "My Profile Pic"; const char* webUrl = "<Enter the WebURL>"; App42API::Initialize("API_KEY", "SECRET_KEY"); AvatarService *avatarService = App42API::BuildAvatarService(); avatarService->CreateAvatarFromWebURL(avatarName, userName, webUrl,description,app42callback(Sample_Class::onAvatarServiceRequestCompleted, this)); void Sample_Class::onAvatarServiceRequestCompleted(void *response) { App42AvatarResponse *app42AvatarResponse = (App42AvatarResponse*)response; if(app42AvatarResponse->isSuccess) { printf("\ncode=%d",app42AvatarResponse->getCode()); printf("\nisSuccess=%d",app42AvatarResponse->isSuccess); printf("\nResponse Body=%s",app42AvatarResponse->getBody().c_str()); for(std::vector<App42Avatar>::iterator it = app42AvatarResponse->avatars.begin(); it != app42AvatarResponse->avatars.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n AvatarName=%s\n",it->name.c_str()); printf("\n URL=%s\n",it->url.c_str()); printf("\n CreatedOn=%s\n",it->createdOn.c_str()); printf("\n Description=%s\n",it->description.c_str()); printf("\n isCurrent=%d\n",it->isCurrent); } } else { printf("\nerrordetails:%s",app42AvatarResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42AvatarResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42AvatarResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42AvatarResponse->httpErrorCode); } }String avatarName = "Shephertz Nick"; String userName = "Nick"; String webURL = "<Enter the WebURL>"; String description = "My Profile Pic"; App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); Avatar avatar = avatarService.CreateAvatarFromWebURL(avatarName, userName,webURL, description); Console.WriteLine("avatarName is :" + avatar.GetName()); Console.WriteLine("url is :" + avatar.GetURL()); Console.WriteLine("tinyUrl is :" + avatar.GetTinyURL()); Console.WriteLine("createdOn is :" + avatar.GetCreatedOn()); Console.WriteLine("Description is :"+avatar.GetDescription()); Console.WriteLine("Is Current :"+avatar.IsCurrent()); Console.WriteLine("UserName is :"+avatar.GetUserName());$avatarName = "Shephertz Nick"; $userName = "Nick"; $webURL = "<Enter the WebURL>"; $description = "My Profile Pic"; App42API::initialize("API_KEY","SECRET_KEY"); $avatarService = App42API::buildAvatarService(); $avatar = $avatarService->createAvatar($avatarName, $userName, $webURL, $description); print_r("Avatar name is : " . $avatar->getName()); print_r("userName is :" . $avatar->getUserName()); print_r("url : " . $avatar->getURL()); print_r("tiny url : " . $avatar->getTinyURL()); print_r("created on : " .$avatar->getCreatedOn()); print_r("description : " . $avatar->getDescription()); print_r("Current is : " . $avatar->isCurrent());const char* avatarName = "Shephertz Nick"; const char* userName = "Nick"; const char* description = "My Profile Pic"; const char* webUrl = "<Enter the WebURL>"; App42API::Initialize("API_KEY", "SECRET_KEY"); AvatarService *avatarService = App42API::BuildAvatarService(); avatarService->CreateAvatarFromWebURL(avatarName, userName, webUrl, description, this, app42callfuncND_selector(Sample_Class::onAvatarServiceRequestCompleted)); void Sample_Class::onAvatarServiceRequestCompleted(App42CallBack *sender, void *response) { App42AvatarResponse *app42AvatarResponse = (App42AvatarResponse*)response; if(app42AvatarResponse->isSuccess) { printf("\ncode=%d",app42AvatarResponse->getCode()); printf("\nisSuccess=%d",app42AvatarResponse->isSuccess); printf("\nResponse Body=%s",app42AvatarResponse->getBody().c_str()); for(std::vector<App42Avatar>::iterator it = app42AvatarResponse->avatars.begin(); it != app42AvatarResponse->avatars.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n AvatarName=%s\n",it->name.c_str()); printf("\n URL=%s\n",it->url.c_str()); printf("\n CreatedOn=%s\n",it->createdOn.c_str()); printf("\n Description=%s\n",it->description.c_str()); printf("\n isCurrent=%d\n",it->isCurrent); } } else { printf("\nerrordetails:%s",app42AvatarResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42AvatarResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42AvatarResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42AvatarResponse->httpErrorCode); } }Coming Soonvar avatarName:String = "Shephertz Nick"; var userName:String = "Nick"; var webURL:String = "<Enter the WebURL>"; var description:String = "My Profile Pic"; App42API.initialize("API_KEY","SECRET_KEY"); var avatarService:AvatarService = App42API.buildAvatarService(); avatarService.createAvatarFromWebURL(avatarName,userName,webUrl,description,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var avatar:Avatar = Avatar(response); trace("Avatar success is : "+response) trace("Created On :"+avatar.getCreatedOn()); trace("Description is :"+avatar.getDescription()); trace("Avatar Name is:"+avatar.getName()); trace("Tiny url :"+avatar.getTinyURL()); trace("Is Current :"+avatar.IsCurrent()); trace("UserName is :"+avatar.getUserName()); trace("Url is :"+avatar.getURL()); } }Coming SoonString avatarName = "Shephertz Nick"; String userName = "Nick"; String webURL = "<Enter the WebURL>"; String description = "My Profile Pic"; App42API.initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); Avatar avatar = avatarService.createAvatarFromWebURL(avatarName, userName,webURL, description); System.out.println("avatarName is :" + avatar.getName()); System.out.println("url is :" + avatar.getURL()); System.out.println("tinyUrl is :" + avatar.getTinyURL()); System.out.println("createdOn is :" + avatar.getCreatedOn()); System.out.println("Description is :"+avatar.getDescription()); System.out.println("Is Current :"+avatar.isCurrent()); System.out.println("UserName is :"+avatar.getUserName());
Get detail description of the avatar.
Required Parameters
avatarName - Name of the avatar which is to be fetched.
userName - Name of the user whose avatar is to be fetched.
String avatarName = "Shephertz Nick"; String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); avatarService.getAvatarByName(avatarName,userName,new App42CallBack() { public void onSuccess(Object response) { Avatar avatar = (Avatar)response; System.out.println("avatarName is :" + avatar.getName()); System.out.println("url is :" + avatar.getURL()); System.out.println("tinyUrl is :" + avatar.getTinyURL()); System.out.println("createdOn is :" + avatar.getCreatedOn()); System.out.println("Description is :"+avatar.getDescription()); System.out.println("Is Current :"+avatar.isCurrent()); System.out.println("UserName is :"+avatar.getUserName()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String avatarName = "Shephertz Nick"; String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); avatarService.GetAvatarByName(avatarName, userName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Avatar avatar = (Avatar) response; Console.WriteLine("avatarName is :" + avatar.GetName()); Console.WriteLine("url is :" + avatar.GetURL()); Console.WriteLine("tinyUrl is :" + avatar.GetTinyURL()); Console.WriteLine("createdOn is :" + avatar.GetCreatedOn()); Console.WriteLine("Description is :"+avatar.GetDescription()); Console.WriteLine("Is Current :"+avatar.IsCurrent()); Console.WriteLine("UserName is :"+avatar.GetUserName()); } }NSString *avatarName = @"Shephertz Nick"; NSString *userName = @"Nick"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; AvatarService *avatarService = [App42API buildAvatarService]; [avatarService getAvatarByName:avatarName userName:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Avatar *avatar = (Avatar*)responseObj; NSLog(@"AvatarName %@",avatar.name); NSLog(@"tinyUrl is %@",avatar.tinyUrl); NSLog(@"UserName is %@",avatar.userName); NSLog(@"Is Current is %d",avatar.isCurrent); } 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 avatarName = "Shephertz Nick" let userName = "Nick" App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") let avatarService = App42API.buildAvatarService() as? AvatarService avatarService?.getAvatarByName(avatarName, userName: userName, completionBlock:{ (success, response, exception) -> Void in if (success) { let avatar = response as! Avatar NSLog("%@",avatar.name) NSLog("%@",avatar.tinyUrl) NSLog("%@",avatar.userName) NSLog("%d",avatar.isCurrent) } else { NSLog("%@",exception.reason!) NSLog("%d",exception.httpErrorCode) NSLog("%d",exception.appErrorCode) NSLog("%@",exception.userInfo!) } )}String avatarName = "Shephertz Nick"; String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); Avatar avatar = avatarService.getAvatarByName(avatarName, userName); System.out.println("avatarName is :" + avatar.getName()); System.out.println("url is :" + avatar.getURL()); System.out.println("tinyUrl is :" + avatar.getTinyURL()); System.out.println("createdOn is :" + avatar.getCreatedOn()); System.out.println("Description is :"+avatar.getDescription()); System.out.println("Is Current :"+avatar.isCurrent()); System.out.println("UserName is :"+avatar.getUserName());String avatarName = "Shephertz Nick"; String userName = "Nick"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); avatarService.GetAvatarByName(avatarName, userName,new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Avatar avatar = (Avatar) response; App42Log.Console("Avatar Name is : " + avatar.GetName()); App42Log.Console("Url is : " + avatar.GetUrl()); App42Log.Console("TinyUrl is : " + avatar.GetTinyUrl()); App42Log.Console("CreatedOn is : " + avatar.GetCreatedOn()); App42Log.Console("Description is : " + avatar.GetDescription()); App42Log.Console("Is Current :"+avatar.IsCurrent()); App42Log.Console("UserName is :"+avatar.GetUserName()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var avatarName = "Shephertz Nick", userName = "Nick", result; App42.initialize("API_KEY","SECRET_KEY"); var avatarService = new App42Avatar(); avatarService.getAvatarByName(avatarName, userName,{ success: function(object) { var avatarObj = JSON.parse(object); result = avatarObj.app42.response.avatars.avatar; console.log("avatarName is : " + result.name) console.log("url is : " + result.url) console.log("tinyUrl is : " + result.tinyUrl) console.log("createdOn is : " + result.createdOn) console.log("Description is :"+result.description); console.log("Is Current :"+result.isCurrent); console.log("UserName is :"+result.userName); }, error: function(error) { console.log("Exception is : " + error) } });Coming Soonconst char* avatarName = "Shephertz Nick"; const char* userName = "Nick"; App42API::Initialize("API_KEY", "SECRET_KEY"); AvatarService *avatarService = App42API::BuildAvatarService(); avatarService->GetAvatarByName(avatarName, userName, app42callback(Sample_Class::onAvatarServiceRequestCompleted, this)); void Sample_Class::onAvatarServiceRequestCompleted(void *response) { App42AvatarResponse *app42AvatarResponse = (App42AvatarResponse*)response; if(app42AvatarResponse->isSuccess) { printf("\ncode=%d",app42AvatarResponse->getCode()); printf("\nisSuccess=%d",app42AvatarResponse->isSuccess); printf("\nResponse Body=%s",app42AvatarResponse->getBody().c_str()); for(std::vector<App42Avatar>::iterator it = app42AvatarResponse->avatars.begin(); it != app42AvatarResponse->avatars.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n AvatarName=%s\n",it->name.c_str()); printf("\n URL=%s\n",it->url.c_str()); printf("\n CreatedOn=%s\n",it->createdOn.c_str()); printf("\n Description=%s\n",it->description.c_str()); printf("\n isCurrent=%d\n",it->isCurrent); } } else { printf("\nerrordetails:%s",app42AvatarResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42AvatarResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42AvatarResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42AvatarResponse->httpErrorCode); } }String avatarName = "Shephertz Nick"; String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); Avatar avatar = avatarService.GetAvatarByName(avatarName, userName); Console.WriteLine("avatarName is :" + avatar.GetName()); Console.WriteLine("url is :" + avatar.GetURL()); Console.WriteLine("tinyUrl is :" + avatar.GetTinyURL()); Console.WriteLine("createdOn is :" + avatar.GetCreatedOn()); Console.WriteLine("Description is :"+avatar.GetDescription()); Console.WriteLine("Is Current :"+avatar.IsCurrent()); Console.WriteLine("UserName is :"+avatar.GetUserName());$avatarName = "Shephertz Nick"; $userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $avatarService = App42API::buildAvatarService(); $avatar = $avatarService->getAvatarByName($avatarName, $userName); print_r("Avatar name is : " . $avatar->getName()); print_r("userName is :" . $avatar->getUserName()); print_r("url : " . $avatar->getURL()); print_r("tiny url : " . $avatar->getTinyURL()); print_r("created on : " .$avatar->getCreatedOn()); print_r("description : " . $avatar->getDescription()); print_r("Current is : " . $avatar->isCurrent());const char* avatarName = "Shephertz Nick"; const char* userName = "Nick"; App42API::Initialize("API_KEY", "SECRET_KEY"); AvatarService *avatarService = App42API::BuildAvatarService(); avatarService->GetAvatarByName(avatarName, userName, this, app42callfuncND_selector(Sample_Class::onAvatarServiceRequestCompleted)); void Sample_Class::onAvatarServiceRequestCompleted(App42CallBack *sender, void *response) { App42AvatarResponse *app42AvatarResponse = (App42AvatarResponse*)response; if(app42AvatarResponse->isSuccess) { printf("\ncode=%d",app42AvatarResponse->getCode()); printf("\nisSuccess=%d",app42AvatarResponse->isSuccess); printf("\nResponse Body=%s",app42AvatarResponse->getBody().c_str()); for(std::vector<App42Avatar>::iterator it = app42AvatarResponse->avatars.begin(); it != app42AvatarResponse->avatars.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n AvatarName=%s\n",it->name.c_str()); printf("\n URL=%s\n",it->url.c_str()); printf("\n CreatedOn=%s\n",it->createdOn.c_str()); printf("\n Description=%s\n",it->description.c_str()); printf("\n isCurrent=%d\n",it->isCurrent); } } else { printf("\nerrordetails:%s",app42AvatarResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42AvatarResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42AvatarResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42AvatarResponse->httpErrorCode); } }Coming Soonvar avatarName:String = "Shephertz Nick"; var userName:String = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); var avatarService:AvatarService = App42API.buildAvatarService(); avatarService.getAvatarByName(avatarName,userName,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var avatar:Avatar = Avatar(response); trace("Avatar success is : "+response) trace("Created On :"+avatar.getCreatedOn()); trace("Description is :"+avatar.getDescription()); trace("Avatar Name is:"+avatar.getName()); trace("Tiny url :"+avatar.getTinyURL()); trace("Is Current :"+avatar.IsCurrent()); trace("UserName is :"+avatar.getUserName()); trace("Url is :"+avatar.getURL()); } }Coming SoonString avatarName = "Shephertz Nick"; String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); Avatar avatar = avatarService.getAvatarByName(avatarName, userName); System.out.println("avatarName is :" + avatar.getName()); System.out.println("url is :" + avatar.getURL()); System.out.println("tinyUrl is :" + avatar.getTinyURL()); System.out.println("createdOn is :" + avatar.getCreatedOn()); System.out.println("Description is :"+avatar.getDescription()); System.out.println("Is Current :"+avatar.isCurrent()); System.out.println("UserName is :"+avatar.getUserName());
User can view all their avatars.
Required Parameters
userName - Name of the user who wants to get all his avatars.
String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); avatarService.getAllAvatars(userName, new App42CallBack() { public void onSuccess(Object response) { ArrayList<Avatar> avatar = (ArrayList<Avatar>)response; for(int i=0;i<avatar.size();i++) { System.out.println("avatarName is :" + avatar.get(i).getName()); System.out.println("url is :" + avatar.get(i).getURL()); System.out.println("tinyUrl is :" + avatar.get(i).getTinyURL()); System.out.println("createdOn is :" + avatar.get(i).getCreatedOn()); System.out.println("Description is :"+avatar.get(i).getDescription()); System.out.println("Is Current :"+avatar.get(i).isCurrent()); System.out.println("UserName is :"+avatar.get(i).getUserName()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); avatarService.GetAllAvatars(userName,new Callback()); public class Callback : App42Callback { public void OnSuccess(Object response) { IList<Avatar> avatar = (List<Avatar>) response; for (int i = 0; i < avatar.Count; i++) { Console.WriteLine("avatarName is :" + avatar[i].GetName()); Console.WriteLine("url is :" + avatar[i].GetURL()); Console.WriteLine("tinyUrl is :" + avatar[i].GetTinyURL()); Console.WriteLine("createdOn is :" + avatar[i].GetCreatedOn()); Console.WriteLine("Description is :"+avatar[i].getDescription()); Console.WriteLine("Is Current :"+avatar[i].isCurrent()); Console.WriteLine("UserName is :"+avatar[i].getUserName()); } } public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } }NSString *userName = @"Nick"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; AvatarService *avatarService = [App42API buildAvatarService]; [avatarService getAllAvatarsForUser:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { NSArray *avatarArray = (NSArray*)responseObj; for(Avatar *avatar in avatarArray) { NSLog(@"AvatarName %@",avatar.name); NSLog(@"tinyUrl is %@",avatar.tinyUrl); NSLog(@"UserName is %@",avatar.userName); NSLog(@"Is Current is %d",avatar.isCurrent); } } 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 avatarService = App42API.buildAvatarService() as? AvatarService avatarService?.getAllAvatarsForUser(userName, completionBlock: { (success, response, exception) -> Void in if (success) { let avatarArray = response as! NSArray for avatar in avatarArray { NSLog("%@",avatar.name) NSLog("%@",avatar.tinyUrl) NSLog("%@",avatar.userName) NSLog("%d",avatar.isCurrent) } } else { NSLog("%@",exception.reason!) NSLog("%d",exception.httpErrorCode) NSLog("%d",exception.appErrorCode) NSLog("%@",exception.userInfo!) } })String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); ArrayList<Avatar> avatar = avatarService.getAllAvatars(userName); for(int i=0;i<avatar.size();i++) { System.out.println("avatarName is :" + avatar.get(i).getName()); System.out.println("url is :" + avatar.get(i).getURL()); System.out.println("tinyUrl is :" + avatar.get(i).getTinyURL()); System.out.println("createdOn is :" + avatar.get(i).getCreatedOn()); System.out.println("Description is :"+avatar.get(i).getDescription()); System.out.println("Is Current :"+avatar.get(i).isCurrent()); System.out.println("UserName is :"+avatar.get(i).getUserName()); }String userName = "Nick"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); avatarService.GetAllAvatars(userName,new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { IList<Avatar> avatarList = (IList<Avatar>) response; for(int i=0; i < avatarList.Count; i++) { App42Log.Console("avatarName is :" + avatar[i].GetName()); App42Log.Console("url is :" + avatar[i].GetURL()); App42Log.Console("tinyUrl is :" + avatar[i].GetTinyURL()); App42Log.Console("createdOn is :" + avatar[i].GetCreatedOn()); App42Log.Console("Description is :"+avatar[i].getDescription()); App42Log.Console("Is Current :"+avatar[i].isCurrent()); App42Log.Console("UserName is :"+avatar[i].getUserName()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", result; App42.initialize("API_KEY","SECRET_KEY"); var avatarService = new App42Avatar(); avatarService.getAllAvatars(userName,{ success: function(object) { var avatarObj = JSON.parse(object); result = avatarObj.app42.response.avatars.avatar; if(result instanceof Array) { for(var i = 0;i<result.length;i++){ console.log("avatarName is : " + result[i].name) console.log("url is : " + result[i].url) console.log("tinyUrl is : " + result[i].tinyUrl) console.log("createdOn is : " + result[i].createdOn) console.log("Description is :"+result[i].description); console.log("Is Current :"+result[i].isCurrent); console.log("UserName is :"+result[i].userName); } } else{ console.log("avatarName is : " + result.name) console.log("url is : " + result.url) console.log("tinyUrl is : " + result.tinyUrl) console.log("createdOn is : " + result.createdOn) console.log("Description is :"+result.description); console.log("Is Current :"+result.isCurrent); console.log("UserName is :"+result.userName); } }, error: function(error) { console.log("Exception is : " + error) } });Coming Soonconst char* userName = "Nick"; App42API::Initialize("API_KEY", "SECRET_KEY"); AvatarService *avatarService = App42API::BuildAvatarService(); avatarService->GetAllAvatars(userName, app42callback(Sample_Class::onAvatarServiceRequestCompleted, this)); void Sample_Class::onAvatarServiceRequestCompleted(void *response) { App42AvatarResponse *app42AvatarResponse = (App42AvatarResponse*)response; if(app42AvatarResponse->isSuccess) { printf("\ncode=%d",app42AvatarResponse->getCode()); printf("\nisSuccess=%d",app42AvatarResponse->isSuccess); printf("\nResponse Body=%s",app42AvatarResponse->getBody().c_str()); for(std::vector<App42Avatar>::iterator it = app42AvatarResponse->avatars.begin(); it != app42AvatarResponse->avatars.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n AvatarName=%s\n",it->name.c_str()); printf("\n URL=%s\n",it->url.c_str()); printf("\n CreatedOn=%s\n",it->createdOn.c_str()); printf("\n Description=%s\n",it->description.c_str()); printf("\n isCurrent=%d\n",it->isCurrent); } } else { printf("\nerrordetails:%s",app42AvatarResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42AvatarResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42AvatarResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42AvatarResponse->httpErrorCode); } }String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); IList<Avatar> avatar = avatarService.GetAllAvatars(userName); for (int i = 0; i < avatar.Count; i++) { Console.WriteLine("avatarName is :" + avatar[i].GetName()); Console.WriteLine("url is :" + avatar[i].GetURL()); Console.WriteLine("tinyUrl is :" + avatar[i].GetTinyURL()); Console.WriteLine("createdOn is :" + avatar[i].GetCreatedOn()); Console.WriteLine("Description is :"+avatar[i].getDescription()); Console.WriteLine("Is Current :"+avatar[i].isCurrent()); Console.WriteLine("UserName is :"+avatar[i].getUserName()); }$userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $avatarService = App42API::buildAvatarService(); $avatar = $avatarService->getAllAvatars($userName); foreach($avatar as $avatarList) { print_r("Avatar name is : " . $avatarList->getName()); print_r("userName : " . $avatarList->getUserName()); print_r("url : " . $avatarList->getURL()); print_r("tiny url : " . $avatarList->getTinyURL()); print_r("created on : " .$avatarList->getCreatedOn()); print_r("description : " . $avatarList->getDescription()); print_r("Current is : " . $avatarList->isCurrent()); }const char* userName = "Nick"; App42API::Initialize("API_KEY", "SECRET_KEY"); AvatarService *avatarService = App42API::BuildAvatarService(); avatarService->GetAllAvatars(userName, this, app42callfuncND_selector(Sample_Class::onAvatarServiceRequestCompleted)); void Sample_Class::onAvatarServiceRequestCompleted(App42CallBack *sender, void *response) { App42AvatarResponse *app42AvatarResponse = (App42AvatarResponse*)response; if(app42AvatarResponse->isSuccess) { printf("\ncode=%d",app42AvatarResponse->getCode()); printf("\nisSuccess=%d",app42AvatarResponse->isSuccess); printf("\nResponse Body=%s",app42AvatarResponse->getBody().c_str()); for(std::vector<App42Avatar>::iterator it = app42AvatarResponse->avatars.begin(); it != app42AvatarResponse->avatars.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n AvatarName=%s\n",it->name.c_str()); printf("\n URL=%s\n",it->url.c_str()); printf("\n CreatedOn=%s\n",it->createdOn.c_str()); printf("\n Description=%s\n",it->description.c_str()); printf("\n isCurrent=%d\n",it->isCurrent); } } else { printf("\nerrordetails:%s",app42AvatarResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42AvatarResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42AvatarResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42AvatarResponse->httpErrorCode); } }Coming Soonvar userName:String = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); var avatarService:AvatarService = App42API.buildAvatarService(); avatarService.getAllAvatars(userName,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { if(response is Array) { trace("Avatar success is Array : "+response) for(var i:int = 0;i < response.length;i++) { var avatar:Avatar = Avatar(response[i]) trace("Created On"+avatar.getCreatedOn()); trace("Description :"+avatar.getDescription()); trace("Avatar Name"+avatar.getName()); trace("Tiny url :"+avatar.getTinyURL()); trace("Is Current :"+avatar.IsCurrent()); trace("UserName "+avatar.getUserName()); trace("URL is"+avatar.getURL()); } } } }Coming SoonString userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); Vector avatarList = avatarService.getAllAvatars(userName); for(int i=0;i< avatarList.size();i++) { Avatar avatar = (Avatar) avatarList.elementAt(i); System.out.println("avatarName is :" + avatar.getName()); System.out.println("url is :" + avatar.getURL()); System.out.println("tinyUrl is :" + avatar.getTinyURL()); System.out.println("createdOn is :" + avatar.getCreatedOn()); System.out.println("Description is :"+avatar.getDescription()); System.out.println("Is Current :"+avatar.isCurrent()); System.out.println("UserName is :"+avatar.getUserName()); }
User can view the latest avatar uploaded by user.
Required Parameters
userName - Name of the user for which current avatar is to be fetched.
String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); avatarService.getCurrentAvatar(userName, new App42CallBack() { public void onSuccess(Object response) { Avatar avatar = (Avatar)response; System.out.println("avatarName is :" + avatar.getName()); System.out.println("url is :" + avatar.getURL()); System.out.println("tinyUrl is :" + avatar.getTinyURL()); System.out.println("createdOn is :" + avatar.getCreatedOn()); System.out.println("Description is :"+avatar.getDescription()); System.out.println("Is Current :"+avatar.isCurrent()); System.out.println("UserName is :"+avatar.getUserName()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); avatarService.GetCurrentAvatar(userName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Avatar avatar = (Avatar) response; Console.WriteLine("avatarName is :" + avatar.GetName()); Console.WriteLine("url is :" + avatar.GetURL()); Console.WriteLine("tinyUrl is :" + avatar.GetTinyURL()); Console.WriteLine("createdOn is :" + avatar.GetCreatedOn()); Console.WriteLine("Description is :"+avatar.GetDescription()); Console.WriteLine("Is Current :"+avatar.IsCurrent()); Console.WriteLine("UserName is :"+avatar.GetUserName()); } }NSString *userName = @"Nick"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; AvatarService *avatarService = [App42API buildAvatarService]; [avatarService getCurrentAvatar:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Avatar *avatar = (Avatar*)responseObj; NSLog(@"AvatarName %@",avatar.name); NSLog(@"tinyUrl is %@",avatar.tinyUrl); NSLog(@"UserName is %@",avatar.userName); NSLog(@"Is Current is %d",avatar.isCurrent); } 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 avatarService = App42API.buildAvatarService() as? AvatarService avatarService?.getCurrentAvatar(userName, completionBlock: { (success, response, exception) -> Void in if (success) { let avatar = response as! Avatar NSLog("%@",avatar.name) NSLog("%@",avatar.tinyUrl) NSLog("%@",avatar.userName) NSLog("%d",avatar.isCurrent) } else { NSLog("%@",exception.reason!) NSLog("%d",exception.httpErrorCode) NSLog("%d",exception.appErrorCode) NSLog("%@",exception.userInfo!) } })String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); Avatar avatar = avatarService.getCurrentAvatar(userName); System.out.println("avatarName is :" + avatar.getName()); System.out.println("url is :" + avatar.getURL()); System.out.println("tinyUrl is :" + avatar.getTinyURL()); System.out.println("createdOn is :" + avatar.getCreatedOn()); System.out.println("Description is :"+avatar.getDescription()); System.out.println("Is Current :"+avatar.isCurrent()); System.out.println("UserName is :"+avatar.getUserName());String userName = "Nick"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); avatarService.GetCurrentAvatar(userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Avatar avatar = (Avatar) response; App42Log.Console("Avatar Name is : " + avatar.GetName()); App42Log.Console("Url is : " + avatar.GetUrl()); App42Log.Console("TinyUrl is : " + avatar.GetTinyUrl()); App42Log.Console("CreatedOn is : " + avatar.GetCreatedOn()); App42Log.Console("Description is : " + avatar.GetDescription()); App42Log.Console("Is Current :"+avatar.IsCurrent()); App42Log.Console("UserName is :"+avatar.GetUserName()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", result; App42.initialize("API_KEY","SECRET_KEY"); var avatarService = new App42Avatar(); avatarService.getCurrentAvatar(userName,{ success: function(object) { var avatarObj = JSON.parse(object); result = avatarObj.app42.response.avatars.avatar; console.log("avatarName is : " + result.name) console.log("url is : " + result.url) console.log("tinyUrl is : " + result.tinyUrl) console.log("createdOn is : " + result.createdOn) console.log("Description is :"+result.description); console.log("Is Current :"+result.isCurrent); console.log("UserName is :"+result.userName); }, error: function(error) { console.log("Exception is : " + error) } });Coming Soonconst char* userName = "Nick"; App42API::Initialize("API_KEY", "SECRET_KEY"); AvatarService *avatarService = App42API::BuildAvatarService(); avatarService->GetCurrentAvatar(userName, app42callback(Sample_Class::onAvatarServiceRequestCompleted, this)); void Sample_Class::onAvatarServiceRequestCompleted(void *response) { App42AvatarResponse *app42AvatarResponse = (App42AvatarResponse*)response; if(app42AvatarResponse->isSuccess) { printf("\ncode=%d",app42AvatarResponse->getCode()); printf("\nisSuccess=%d",app42AvatarResponse->isSuccess); printf("\nResponse Body=%s",app42AvatarResponse->getBody().c_str()); for(std::vector<App42Avatar>::iterator it = app42AvatarResponse->avatars.begin(); it != app42AvatarResponse->avatars.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n AvatarName=%s\n",it->name.c_str()); printf("\n URL=%s\n",it->url.c_str()); printf("\n CreatedOn=%s\n",it->createdOn.c_str()); printf("\n Description=%s\n",it->description.c_str()); printf("\n isCurrent=%d\n",it->isCurrent); } } else { printf("\nerrordetails:%s",app42AvatarResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42AvatarResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42AvatarResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42AvatarResponse->httpErrorCode); } }String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); Avatar avatar = avatarService.GetCurrentAvatar(userName); Console.WriteLine("avatarName is :" + avatar.GetName()); Console.WriteLine("url is :" + avatar.GetURL()); Console.WriteLine("tinyUrl is :" + avatar.GetTinyURL()); Console.WriteLine("createdOn is :" + avatar.GetCreatedOn()); Console.WriteLine("Description is :"+avatar.GetDescription()); Console.WriteLine("Is Current :"+avatar.IsCurrent()); Console.WriteLine("UserName is :"+avatar.GetUserName());$userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $avatarService = App42API::buildAvatarService(); $avatar = $avatarService->getCurrentAvatar($userName); print_r("Avatar name is : " . $avatar->getName()); print_r("userName is :" . $avatar->getUserName()); print_r("url : " . $avatar->getURL()); print_r("tiny url : " . $avatar->getTinyURL()); print_r("created on : " .$avatar->getCreatedOn()); print_r("description : " . $avatar->getDescription()); print_r("Current is : " . $avatar->isCurrent());const char* userName = "Nick"; App42API::Initialize("API_KEY", "SECRET_KEY"); AvatarService *avatarService = App42API::BuildAvatarService(); avatarService->GetCurrentAvatar(userName, this, app42callfuncND_selector(Sample_Class::onAvatarServiceRequestCompleted)); void Sample_Class::onAvatarServiceRequestCompleted(App42CallBack *sender, void *response) { App42AvatarResponse *app42AvatarResponse = (App42AvatarResponse*)response; if(app42AvatarResponse->isSuccess) { printf("\ncode=%d",app42AvatarResponse->getCode()); printf("\nisSuccess=%d",app42AvatarResponse->isSuccess); printf("\nResponse Body=%s",app42AvatarResponse->getBody().c_str()); for(std::vector<App42Avatar>::iterator it = app42AvatarResponse->avatars.begin(); it != app42AvatarResponse->avatars.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n AvatarName=%s\n",it->name.c_str()); printf("\n URL=%s\n",it->url.c_str()); printf("\n CreatedOn=%s\n",it->createdOn.c_str()); printf("\n Description=%s\n",it->description.c_str()); printf("\n isCurrent=%d\n",it->isCurrent); } } else { printf("\nerrordetails:%s",app42AvatarResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42AvatarResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42AvatarResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42AvatarResponse->httpErrorCode); } }Coming Soonvar userName:String = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); var avatarService:AvatarService = App42API.buildAvatarService(); avatarService.getCurrentAvatar(userName,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var avatar:Avatar = Avatar(response); trace("Avatar success is : "+response) trace("Created On :"+avatar.getCreatedOn()); trace("Description is :"+avatar.getDescription()); trace("Avatar Name is:"+avatar.getName()); trace("Tiny url :"+avatar.getTinyURL()); trace("Is Current :"+avatar.IsCurrent()); trace("UserName is :"+avatar.getUserName()); trace("Url is :"+avatar.getURL()); } }Coming SoonString userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); Avatar avatar = avatarService.getCurrentAvatar(userName); System.out.println("avatarName is :" + avatar.getName()); System.out.println("url is :" + avatar.getURL()); System.out.println("tinyUrl is :" + avatar.getTinyURL()); System.out.println("createdOn is :" + avatar.getCreatedOn()); System.out.println("Description is :"+avatar.getDescription()); System.out.println("Is Current :"+avatar.isCurrent()); System.out.println("UserName is :"+avatar.getUserName());
Change your current avatar from existing avatars in app.
Required Parameters
userName - Name of the user whose avatar is to be updated.
avatarName - Name of the avatar to be updated.
String avatarName = "Shephertz Nick"; String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); avatarService.changeCurrentAvatar(userName,avatarName, new App42CallBack() { public void onSuccess(Object response) { Avatar avatar = (Avatar)response; System.out.println("avatarName is :" + avatar.getName()); System.out.println("url is :" + avatar.getURL()); System.out.println("tinyUrl is :" + avatar.getTinyURL()); System.out.println("createdOn is :" + avatar.getCreatedOn()); System.out.println("Description is :"+avatar.getDescription()); System.out.println("Is Current :"+avatar.isCurrent()); System.out.println("UserName is :"+avatar.getUserName()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String avatarName = "Shephertz Nick"; String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); avatarService.ChangeCurrentAvatar(userName,avatarName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Avatar avatar = (Avatar) response; Console.WriteLine("avatarName is :" + avatar.GetName()); Console.WriteLine("url is :" + avatar.GetURL()); Console.WriteLine("tinyUrl is :" + avatar.GetTinyURL()); Console.WriteLine("createdOn is :" + avatar.GetCreatedOn()); Console.WriteLine("Description is :"+avatar.GetDescription()); Console.WriteLine("Is Current :"+avatar.IsCurrent()); Console.WriteLine("UserName is :"+avatar.GetUserName()); } }NSString *avatarName = @"Shephertz Nick"; NSString *userName = @"Nick"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; AvatarService *avatarService = [App42API buildAvatarService]; [avatarService changeCurrentAvatarWithName:avatarName forUser:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Avatar *avatar = (Avatar*)responseObj; NSLog(@"AvatarName %@",avatar.name); NSLog(@"tinyUrl is %@",avatar.tinyUrl); NSLog(@"UserName is %@",avatar.userName); NSLog(@"Is Current is %d",avatar.isCurrent); } 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 avatarName = "Shephertz Nick" let userName = "Nick" App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") let avatarService = App42API.buildAvatarService() as? AvatarService avatarService?.changeCurrentAvatarWithName(avatarName, forUser: userName, completionBlock: { (success, response, exception) -> Void in if (success) { let avatar = response as! Avatar NSLog("%@",avatar.name) NSLog("%@",avatar.tinyUrl) NSLog("%@",avatar.userName) NSLog("%d",avatar.isCurrent) } else { NSLog("%@",exception.reason!) NSLog("%d",exception.httpErrorCode) NSLog("%d",exception.appErrorCode) NSLog("%@",exception.userInfo!) } })String avatarName = "Shephertz Nick"; String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); Avatar avatar = avatarService.changeCurrentAvatar(userName,avatarName); System.out.println("avatarName is :" + avatar.getName()); System.out.println("url is :" + avatar.getURL()); System.out.println("tinyUrl is :" + avatar.getTinyURL()); System.out.println("createdOn is :" + avatar.getCreatedOn()); System.out.println("Description is :"+avatar.getDescription()); System.out.println("Is Current :"+avatar.isCurrent()); System.out.println("UserName is :"+avatar.getUserName());String userName = "Nick"; String avatarName = "Shephertz Nick"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); avatarService.ChangeCurrentAvatar(userName,avatarName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Avatar avatar = (Avatar) response; App42Log.Console("Avatar Name is : " + avatar.GetName()); App42Log.Console("Url is : " + avatar.GetUrl()); App42Log.Console("TinyUrl is : " + avatar.GetTinyUrl()); App42Log.Console("CreatedOn is : " + avatar.GetCreatedOn()); App42Log.Console("Description is : " + avatar.GetDescription()); App42Log.Console("Is Current :"+avatar.IsCurrent()); App42Log.Console("UserName is :"+avatar.GetUserName()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var avatarName = "Shephertz Nick", userName = "Nick", result; App42.initialize("API_KEY","SECRET_KEY"); var avatarService = new App42Avatar(); avatarService.changeCurrentAvatar(userName,avatarName,{ success: function(object) { var avatarObj = JSON.parse(object); result = avatarObj.app42.response.avatars.avatar; console.log("avatarName is : " + result.name) console.log("url is : " + result.url) console.log("tinyUrl is : " + result.tinyUrl) console.log("createdOn is : " + result.createdOn) console.log("Description is :"+result.description); console.log("Is Current :"+result.isCurrent); console.log("UserName is :"+result.userName); }, error: function(error) { console.log("Exception is : " + error) } });Coming Soonconst char* avatarName = "Shephertz Nick"; const char* userName = "Nick"; App42API::Initialize("API_KEY", "SECRET_KEY"); AvatarService *avatarService = App42API::BuildAvatarService(); avatarService->ChangeCurrentAvatar(avatarName, userName, app42callback(Sample_Class::onAvatarServiceRequestCompleted, this)); void Sample_Class::onAvatarServiceRequestCompleted(void *response) { App42AvatarResponse *app42AvatarResponse = (App42AvatarResponse*)response; if(app42AvatarResponse->isSuccess) { printf("\ncode=%d",app42AvatarResponse->getCode()); printf("\nisSuccess=%d",app42AvatarResponse->isSuccess); printf("\nResponse Body=%s",app42AvatarResponse->getBody().c_str()); for(std::vector<App42Avatar>::iterator it = app42AvatarResponse->avatars.begin(); it != app42AvatarResponse->avatars.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n AvatarName=%s\n",it->name.c_str()); printf("\n URL=%s\n",it->url.c_str()); printf("\n CreatedOn=%s\n",it->createdOn.c_str()); printf("\n Description=%s\n",it->description.c_str()); printf("\n isCurrent=%d\n",it->isCurrent); } } else { printf("\nerrordetails:%s",app42AvatarResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42AvatarResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42AvatarResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42AvatarResponse->httpErrorCode); } }String avatarName = "Shephertz Nick"; String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); Avatar avatar = avatarService.ChangeCurrentAvatar(userName,avatarName); Console.WriteLine("avatarName is :" + avatar.GetName()); Console.WriteLine("url is :" + avatar.GetURL()); Console.WriteLine("tinyUrl is :" + avatar.GetTinyURL()); Console.WriteLine("createdOn is :" + avatar.GetCreatedOn()); Console.WriteLine("Description is :"+avatar.GetDescription()); Console.WriteLine("Is Current :"+avatar.IsCurrent()); Console.WriteLine("UserName is :"+avatar.GetUserName());$avatarName = "Shephertz Nick"; $userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $avatarService = App42API::buildAvatarService(); $avatar = $avatarService->changeCurrentAvatar($userName,$avatarName); print_r("Avatar name is : " . $avatar->getName()); print_r("userName is :" . $avatar->getUserName()); print_r("url : " . $avatar->getURL()); print_r("tiny url : " . $avatar->getTinyURL()); print_r("created on : " .$avatar->getCreatedOn()); print_r("description : " . $avatar->getDescription()); print_r("Current is : " . $avatar->isCurrent());const char* avatarName = "Shephertz Nick"; const char* userName = "Nick"; App42API::Initialize("API_KEY", "SECRET_KEY"); AvatarService *avatarService = App42API::BuildAvatarService(); avatarService->ChangeCurrentAvatar(avatarName, userName, this, app42callfuncND_selector(Sample_Class::onAvatarServiceRequestCompleted)); void Sample_Class::onAvatarServiceRequestCompleted(App42CallBack *sender, void *response) { App42AvatarResponse *app42AvatarResponse = (App42AvatarResponse*)response; if(app42AvatarResponse->isSuccess) { printf("\ncode=%d",app42AvatarResponse->getCode()); printf("\nisSuccess=%d",app42AvatarResponse->isSuccess); printf("\nResponse Body=%s",app42AvatarResponse->getBody().c_str()); for(std::vector<App42Avatar>::iterator it = app42AvatarResponse->avatars.begin(); it != app42AvatarResponse->avatars.end(); ++it) { printf("\n UserName=%s",it->userName.c_str()); printf("\n AvatarName=%s\n",it->name.c_str()); printf("\n URL=%s\n",it->url.c_str()); printf("\n CreatedOn=%s\n",it->createdOn.c_str()); printf("\n Description=%s\n",it->description.c_str()); printf("\n isCurrent=%d\n",it->isCurrent); } } else { printf("\nerrordetails:%s",app42AvatarResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42AvatarResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42AvatarResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42AvatarResponse->httpErrorCode); } }Coming Soonvar avatarName:String = "Shephertz Nick"; var userName:String = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); var avatarService:AvatarService = App42API.buildAvatarService(); avatarService.changeCurrentAvatar(userName,avatarName,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var avatar:Avatar = Avatar(response); trace("Avatar success is : "+response) trace("Created On :"+avatar.getCreatedOn()); trace("Description is :"+avatar.getDescription()); trace("Avatar Name is:"+avatar.getName()); trace("Tiny url :"+avatar.getTinyURL()); trace("Is Current :"+avatar.IsCurrent()); trace("UserName is :"+avatar.getUserName()); trace("Url is :"+avatar.getURL()); } }Coming SoonString avatarName = "Shephertz Nick"; String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); Avatar avatar = avatarService.changeCurrentAvatar(userName,avatarName); System.out.println("avatarName is :" + avatar.getName()); System.out.println("url is :" + avatar.getURL()); System.out.println("tinyUrl is :" + avatar.getTinyURL()); System.out.println("createdOn is :" + avatar.getCreatedOn()); System.out.println("Description is :"+avatar.getDescription()); System.out.println("Is Current :"+avatar.isCurrent()); System.out.println("UserName is :"+avatar.getUserName());
Update avatar name and description of existing avatars from app.
Required Parameters
avatarName - Name of the avatar for which you want to update.
userName - Name of the user who wants to update his avatar.
newAvatarName - Name of the new avatar.
description - Add new description about the avatar or put null to remain old.
String avatarName = "Shephertz Nick"; String userName = "Nick"; String newAvatarName = "Nick Avatar"; String description = "Description about the avatar"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); avatarService.updateAvatar(avatarName, userName,newAvatarName, description,new App42CallBack() { public void onSuccess(Object response) { Avatar avatar = (Avatar)response; System.out.println("avatarName is :" + avatar.getName()); System.out.println("url is :" + avatar.getURL()); System.out.println("tinyUrl is :" + avatar.getTinyURL()); System.out.println("createdOn is :" + avatar.getCreatedOn()); System.out.println("Description is :"+avatar.getDescription()); System.out.println("Is Current :"+avatar.isCurrent()); System.out.println("UserName is :"+avatar.getUserName()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String avatarName = "Shephertz Nick"; String userName = "Nick"; String newAvatarName = "Nick Avatar"; String description = "Description about the avatar"; App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); avatarService.UpdateAvatar(avatarName, userName, newAvatarName, description, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Avatar avatar = (Avatar) response; Console.WriteLine("avatarName is :" + avatar.GetName()); Console.WriteLine("URL is :" + avatar.GetURL()); Console.WriteLine("tinyUrl is :" + avatar.GetTinyURL()); Console.WriteLine("createdOn is :" + avatar.GetCreatedOn()); Console.WriteLine("Description is :"+avatar.GetDescription()); Console.WriteLine("Is Current :"+avatar.IsCurrent()); Console.WriteLine("UserName is :"+avatar.GetUserName()); } }Not AvailableNot AvailableString avatarName = "Shephertz Nick"; String userName = "Nick"; String newAvatarName = "Nick Avatar"; String description = "Description about the avatar"; App42API.initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); Avatar avatar = avatarService.updateAvatar(avatarName, userName,newAvatarName, description); System.out.println("avatarName is :" + avatar.getName()); System.out.println("url is :" + avatar.getURL()); System.out.println("tinyUrl is :" + avatar.getTinyURL()); System.out.println("createdOn is :" + avatar.getCreatedOn()); System.out.println("Description is :"+avatar.getDescription()); System.out.println("Is Current :"+avatar.isCurrent()); System.out.println("UserName is :"+avatar.getUserName());String avatarName = "Shephertz Nick"; String userName = "Nick"; String newAvatarName = "Nick Avatar"; String description = "Description about the avatar"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); avatarService.UpdateAvatar(avatarName, userName, newAvatarName, description, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Avatar avatar = (Avatar) response; App42Log.Console("Avatar Name is : " + avatar.GetName()); App42Log.Console("URL is : " + avatar.GetUrl()); App42Log.Console("TinyUrl is : " + avatar.GetTinyUrl()); App42Log.Console("CreatedOn is : " + avatar.GetCreatedOn()); App42Log.Console("Description is : " + avatar.GetDescription()); App42Log.Console("Is Current :"+avatar.IsCurrent()); App42Log.Console("UserName is :"+avatar.GetUserName()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var avatarName = "Shephertz Nick", userName = "Nick", newAvatarName = "Nick Avatar", description = "Description about the avatar", result; App42API.initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); avatarService.updateAvatar(avatarName, userName, newAvatarName, descriptiopn,{ success: function(object) { var avatarObj = JSON.parse(object); result = avatarObj.app42.response.avatars.avatar; console.log("avatarName is : " + result.name) console.log("url is : " + result.url) console.log("tinyUrl is : " + result.tinyUrl) console.log("createdOn is : " + result.createdOn) console.log("Description is :"+result.description); console.log("Is Current :"+result.isCurrent); console.log("UserName is :"+result.userName); }, error: function(error) { } });Coming SoonNot AvailableString avatarName = "Shephertz Nick"; String userName = "Nick"; String newAvatarName = "Nick Avatar"; String description = "Description about the avatar"; App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); Avatar avatar = avatarService.UpdateAvatar(avatarName, userName, newAvatarName, description); Console.WriteLine("avatarName is : " + avatar.GetName()); Console.WriteLine("URL is : " + avatar.GetURL()); Console.WriteLine("tinyUrl is : " + avatar.GetTinyURL()); Console.WriteLine("createdOn is : " + avatar.GetCreatedOn()); Console.WriteLine("Description is : "+avatar.GetDescription()); Console.WriteLine("Is Current :"+avatar.IsCurrent()); Console.WriteLine("UserName is : "+avatar.GetUserName());$avatarName = "Shephertz Nick"; $userName = "Nick"; $newAvatarName = "Nick Avatar"; $description = "Description about the avatar"; App42API::initialize("API_KEY","SECRET_KEY"); $avatarService = App42API::buildAvatarService(); $avatar = $avatarService->updateAvatar($avatarName , $userName, $newAvatarName,$description); print_r("Avatar name is : " . $avatar->getName()); print_r("userName is :" . $avatar->getUserName()); print_r("url : " . $avatar->getURL()); print_r("tiny url : " . $avatar->getTinyURL()); print_r("created on : " .$avatar->getCreatedOn()); print_r("description : " . $avatar->getDescription()); print_r("Current is : " . $avatar->isCurrent());Not AvailableNot Availablevar avatarName:String = "Shephertz Nick"; var userName:String = "Nick"; var newAvatarName:String = "Nick Avatar"; var description:String = "Description about the avatar"; App42API.initialize("API_KEY","SECRET_KEY"); var avatarService:AvatarService = App42API.buildAvatarService(); avatarService.updateAvatar(avatarName,userName,newAvatarName,description,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var avatar:Avatar = Avatar(response); trace("Avatar success is : "+response) trace("Created On :"+avatar.getCreatedOn()); trace("Description is :"+avatar.getDescription()); trace("Avatar Name is:"+avatar.getName()); trace("Tiny url :"+avatar.getTinyURL()); trace("Is Current :"+avatar.IsCurrent()); trace("UserName is :"+avatar.getUserName()); trace("Url is :"+avatar.getURL()); } }Not AvailableNot Available
Delete a particular avatar based on name.
Required Parameters
userName - Name of the user who wants to delete his/her avatar.
avatarName - Name of the avatar to be deleted.
String userName = "Nick"; String avatarName = "Shephertz Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); avatarService.deleteAvatarByName(userName,avatarName,new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("response is " + app42response) ; } public void onException(Exception ex) { System.out.println("Exception Message " + ex.getMessage()); } });String userName = "Nick"; String avatarName = "Shephertz Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); avatarService.DeleteAvatarByName(userName, avatarName, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { App42Response app42Response = (App42Response) response; Console.WriteLine("App42Response is : "+app42Response.ToString()); } }Not AvailableNot AvailableString userName = "Nick"; String avatarName = "Shephertz Nick"; App42API.initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); App42Response app42Response = avatarService.deleteAvatarByName(userName,avatarName); System.out.println("Resposne is : "+ app42Response);String userName = "Nick"; String avatarName = "Shephertz Nick"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); avatarService.DeleteAvatarByName(userName, avatarName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response app42Response = (App42Response) response; App42Log.Console("App42Response is : "+app42Response.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", avatarName = "Shephertz Nick", result; App42API.initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); avatarService.deleteAvatarByName(userName, avatarName,{ success: function(object) { var avatarObj = JSON.parse(object); result = avatarObj.app42.response.success; console.log("Response is "+result) }, error: function(error) { } });Coming SoonNot AvailableString userName = "Nick"; String avatarName = "Shephertz Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); App42Response app42Response = avatarService.DeleteAvatarByName(userName, avatarName); Console.WriteLine("App42Response is : "+app42Response.ToString());$userName = "Nick"; $avatarName = "Shephertz Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $avatarService = App42API::buildAvatarService(); $response = $avatarService->deleteAvatarByName($userName,$avatarName); print_r("Response is : ".$response->toString()); $success = $response->isResponseSuccess(); $jsonResponse = $response->toString();Not AvailableNot AvailableString userName = "Nick"; String avatarName = "Shephertz Nick"; App42API.initialize("API_KEY","SECRET_KEY"); var avatarService:AvatarService = App42API.buildAvatarService(); avatarService.deleteAvatarByName(userName, avatarName, new callback()); public class callback implements App42CallBack { public function onSuccess(response:Object):void { var app42response :App42Response= App42Response(response); trace("response is " + app42response) } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Not AvailableNot Available
Delete all avatars of a particular user.
Required Parameters
userName - Name of the user who wants to delete his/her all avatars.
String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); avatarService.deleteAllAvatars(userName,new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("response is " + app42response) ; } public void onException(Exception ex) { System.out.println("Exception Message " + ex.getMessage()); } });String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); avatarService.DeleteAllAvatars(userName, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { App42Response app42Response = (App42Response) response; Console.WriteLine("App42Response is : "+app42Response.ToString()); } }Not AvailableNot AvailableString userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); App42Response app42Response = avatarService.deleteAllAvatars(userName); System.out.println("Resposne is : "+ app42Response);String userName = "Nick"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); avatarService.DeleteAllAvatars(userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response app42Response = (App42Response) response; App42Log.Console("App42Response is : "+app42Response.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); }var userName = "Nick", result; App42API.initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); avatarService.deleteAllAvatars(userName,{ success: function(object) { var avatarObj = JSON.parse(object); result = avatarObj.app42.response.success; console.log("Response is "+result) }, error: function(error) { } });Coming SoonNot AvailableString userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); App42Response app42Response = avatarService.DeleteAllAvatars(userName); Console.WriteLine("App42Response is : "+app42Response.ToString());$userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $avatarService = App42API::buildAvatarService(); $response = $avatarService->deleteAllAvatars($userName); print_r("Response is : ".$response->toString()); $success = $response->isResponseSuccess(); $jsonResponse = $response->toString();Not AvailableNot AvailableString userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); var avatarService:AvatarService = App42API.buildAvatarService(); avatarService.deleteAllAvatars(userName, new callback()); public class callback implements App42CallBack { public function onSuccess(response:Object):void { var app42response :App42Response= App42Response(response); trace("response is " + app42response) } public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } }Not AvailableNot Available
The functions available under Avatar API can throw some exceptions in abnormal conditions. For example, if a developer is creating the avatar name that already exist in the database, the function will throw the App42Exception (as shown below) with the message as “Bad Request” and the appErrorCode as “4701” and the details as “The Request parameters are invalid. Avatar by the name ‘Shephertz Nick’ already exists.”.
String avatarName = "Shephertz Nick"; String userName = "Nick"; String filePath = "Your File Path"; String description = "My Profile Pic"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); avatarService.createAvatar(avatarName,userName,filePath, description, new App42CallBack() { public void onSuccess(Object response) { Avatar avatar = (Avatar)response; System.out.println("avatarName is :" + avatar.getName()); System.out.println("url is :" + avatar.getURL()); System.out.println("tinyUrl is :" + avatar.getTinyURL()); System.out.println("createdOn is :" + avatar.getCreatedOn()); System.out.println("Description is :"+avatar.getDescription()); System.out.println("Is Current :"+avatar.isCurrent()); System.out.println("UserName is :"+avatar.getUserName()); } public void onException(Exception ex) { App42Exception exception = (App42Exception)ex; int appErrorCode = exception.getAppErrorCode(); int httpErrorCode = exception.getHttpErrorCode(); if(appErrorCode == 4701) { // Handle here for Bad Request (The Request parameters are invalid. Avatar by the name 'Shephertz Nick' already exists.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.getMessage(); } });String avatarName = "Shephertz Nick"; String userName = "Nick"; String filePath = "Your File Path"; String description = "My Profile Pic"; App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); avatarService.CreateAvatar(avatarName, userName,filePath, 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 == 4701) { // Handle here for Bad Request (The Request parameters are invalid. Avatar by the name 'Shephertz Nick' already exists.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.GetMessage(); } public void OnSuccess(Object response) { Avatar avatar = (Avatar) response; String jsonResponse = avatar.ToString(); } }NSString *avatarName = @"Shephertz Nick"; NSString *userName = @"Nick"; NSString *filePath = @"Your File Path"; NSString *description = @"My Profile Pic"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; AvatarService *avatarService = [App42API buildAvatarService]; [avatarService createAvatarWithName:avatarName userName:userName filePath:filePath description:description completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Avatar *avatar = (Avatar*)responseObj; } else { int appErrorCode = exception.appErrorCode; int httpErrorCode = exception.httpErrorCode; if(appErrorCode == 4701) { // Handle here for Bad Request (The Request parameters are invalid. Avatar by the name 'Shephertz Nick' already exists.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } NSString *jsonText = exception.reason; } }];Coming SoonString avatarName = "Shephertz Nick"; String userName = "Nick"; String filePath = "Your File Path"; String description = "My Profile Pic"; App42API.initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); try { Avatar avatar = avatarService.createAvatar(avatarName, userName,filePath, description); } catch(App42Exception exception) { int appErrorCode = exception.getAppErrorCode(); int httpErrorCode = exception.getHttpErrorCode(); if(appErrorCode == 4701) { // Handle here for Bad Request (The Request parameters are invalid. Avatar by the name 'Shephertz Nick' already exists.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.getMessage(); }String avatarName = "Shephertz Nick"; String userName = "Nick"; String filePath = "Your File Path"; String description = "My Profile Pic"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); avatarService.CreateAvatar(avatarName, userName, filePath, 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 == 4701) { // Handle here for Bad Request (The Request parameters are invalid. Avatar by the name 'Shephertz Nick' already exists.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.GetMessage(); } public void OnSuccess(object response) { Avatar avatar = (Avatar) response; String jsonResponse = avatar.ToString(); } }var avatarName = "Shephertz Nick", userName = "Nick", filePath = "Your File Path", description = "My Profile Pic", appErrorCode; App42API.initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); avatarService.createAvatar(avatarName,userName,filePath, description,{ success: function(object) { }, error: function(error) { var avatarObj = JSON.parse(error); appErrorCode = avatarObj.app42Fault.appErrorCode; if(appErrorCode == 4701) { // Handle here for Bad Request (The Request parameters are invalid. Avatar by the name 'Shephertz Nick' already exists.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } } });Coming Soonconst char* avatarName = "Shephertz Nick"; const char* userName = "Nick"; const char* filePath = "Your File Path"; const char* description = "My Profile Pic"; App42API::Initialize("API_KEY", "SECRET_KEY"); AvatarService *avatarService = App42API::BuildAvatarService(); avatarService->CreateAvatar(avatarName, userName, filePath, description,app42callback(Sample_Class::onAvatarServiceRequestCompleted, this)); void Sample_Class::onAvatarServiceRequestCompleted(void *response) { App42AvatarResponse *app42AvatarResponse = (App42AvatarResponse*)response; if(app42AvatarResponse->isSuccess) { //Handle your success response here. } else { printf("\nerrordetails:%s",app42AvatarResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42AvatarResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42AvatarResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42AvatarResponse->httpErrorCode); int appErrorCode = app42AvatarResponse->appErrorCode; int httpErrorCode = app42AvatarResponse->httpErrorCode; if(appErrorCode == 4701) { // Handle here for Bad Request (The Request parameters are invalid. Avatar by the name 'Shephertz Nick' already exists.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } } }String avatarName = "Shephertz Nick"; String userName = "Nick"; String filePath = "Your File Path"; String description = "My Profile Pic"; App42API.Initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.BuildAvatarService(); try { Avatar avatar = avatarService.CreateAvatar(avatarName, userName,filePath, description); } catch(App42Exception exception) { int appErrorCode = exception.GetAppErrorCode(); int httpErrorCode = exception.GetHttpErrorCode(); if(appErrorCode == 4701) { // Handle here for Bad Request (The Request parameters are invalid. Avatar by the name 'Shephertz Nick' already exists.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.GetMessage(); }$avatarName = "Shephertz Nick"; $userName = "Nick"; $filePath = "Your File Path"; $description = "My Profile Pic"; App42API::initialize("API_KEY","SECRET_KEY"); $avatarService = App42API::buildAvatarService(); try { $response = $avatarService->createAvatar($avatarName, $userName,$filePath, $description); } catch(App42Exception $ex) { $appErrorCode = $ex->getAppErrorCode(); $httpErrorCode = $ex->getHttpErrorCode(); if($appErrorCode == 4701) { // Handle here for Bad Request (The Request parameters are invalid. Avatar by the name 'Shephertz Nick' already exists.) } 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* avatarName = "Shephertz Nick"; const char* userName = "Nick"; const char* filePath = "Your File Path"; const char* description = "My Profile Pic"; App42API::Initialize("API_KEY", "SECRET_KEY"); AvatarService *avatarService = App42API::BuildAvatarService(); avatarService->CreateAvatar(avatarName, userName, filePath, description, this, app42callfuncND_selector(Sample_Class::onAvatarServiceRequestCompleted)); void Sample_Class::onAvatarServiceRequestCompleted(App42CallBack *sender, void *response) { App42AvatarResponse *app42AvatarResponse = (App42AvatarResponse*)response; if(app42AvatarResponse->isSuccess) { //Handle your success response here. } else { printf("\nerrordetails:%s",app42AvatarResponse->errorDetails.c_str()); printf("\nerrorMessage:%s",app42AvatarResponse->errorMessage.c_str()); printf("\nappErrorCode:%d",app42AvatarResponse->appErrorCode); printf("\nhttpErrorCode:%d",app42AvatarResponse->httpErrorCode); int appErrorCode = app42AvatarResponse->appErrorCode; int httpErrorCode = app42AvatarResponse->httpErrorCode; if(appErrorCode == 4701) { // Handle here for Bad Request (The Request parameters are invalid. Avatar by the name 'Shephertz Nick' already exists.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } } }Coming Soonvar avatarName:String = "Shephertz Nick"; var userName:String = "Nick"; var accessToken:String = "<Enter Your Facebook Access Token>"; var description:String = "My Profile Pic"; App42API.initialize("API_KEY","SECRET_KEY"); var avatarService:AvatarService = App42API.buildAvatarService(); avatarService.createAvatarFromFacebook(avatarName,userName, accessToken, description,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { var appErrorCode:int = exception.getAppErrorCode(); var httpErrorCode:int = exception.getHttpErrorCode(); if(appErrorCode == 4701) { // Handle here for Bad Request (The Request parameters are invalid. Avatar by the name 'Shephertz Nick' already 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 avatar:Avatar = Avatar(response); trace("resonse is: " + avatar) } }Coming SoonString avatarName = "Shephertz Nick"; String userName = "Nick"; String filePath = "Your File Path"; String description = "My Profile Pic"; App42API.initialize("API_KEY","SECRET_KEY"); AvatarService avatarService = App42API.buildAvatarService(); try { Avatar avatar = avatarService.createAvatar(avatarName, userName,filePath, description); } catch(App42Exception exception) { int appErrorCode = exception.getAppErrorCode(); int httpErrorCode = exception.getHttpErrorCode(); if(appErrorCode == 4701) { // Handle here for Bad Request (The Request parameters are invalid. Avatar by the name 'Shephertz Nick' already exists.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.getMessage(); }
Functions in Avatar 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.
4701 - BAD REQUEST - The Request parameters are invalid. Avatar by the name '@avatarName' already exists.
4702 - NOT FOUND - User by the name '@userName' does not have any avatar.
4703 - NOT FOUND - User by the name '@userName' avatar '@avatarName'does not exist.
4704 - BAD REQUEST - The Facebook Access Credentials are invalid. + <Received Facebook Exception Message>.
4705 - BAD REQUEST - Given URL is invalid.