Custom Cloud Service

Using Custom Code Service developer can deploy and run their custom code on our servers without scalability consideration. App42 Custom Code platform is intelligent enough to give the scalability to your code on the fly. App42 Custom Code platform comes with some guideline to write the custom code. Learn How to write Custom Code App42 Custom code can be used to put the validation and custom logic on your data that you want to run on the server instead of client sideCustom code can include App42 APIs inside it, and can be used to aggregate two or more services into your own custom code serviceOnce Custom code is deployed, developers can access deployed service using REST or any of supported SDKs. Deployed Custom code service are wrapped in our REST Security model hence as a developer you are free to just focus on business logic Custom Code API available Through REST and in SDKs can be used to run and deploy the custom code.

Import Statement

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
import com.shephertz.app42.paas.sdk.android.App42API;
import com.shephertz.app42.paas.sdk.android.App42Response;
import com.shephertz.app42.paas.sdk.android.App42Exception;
import com.shephertz.app42.paas.sdk.android.App42BadParameterException;
import com.shephertz.app42.paas.sdk.android.App42NotFoundException;
import com.shephertz.app42.paas.sdk.android.customcode.CustomCodeService;
using com.shephertz.app42.paas.sdk.windows;  
using com.shephertz.app42.paas.sdk.windows.customcode;   
#import "Shephertz_App42_iOS_API/Shephertz_App42_iOS_API.h"   
import com.shephertz.app42.paas.sdk.jme.App42API;
import com.shephertz.app42.paas.sdk.jme.App42Response;
import com.shephertz.app42.paas.sdk.jme.App42Exception;
import com.shephertz.app42.paas.sdk.jme.App42BadParameterException;
import com.shephertz.app42.paas.sdk.jme.App42NotFoundException;
import com.shephertz.app42.paas.sdk.jme.customcode.CustomCodeService;
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.customcode.CustomCodeService;
using com.shephertz.app42.paas.sdk.csharp;  
using com.shephertz.app42.paas.sdk.csharp.customcode;  
Not Available
local App42API = require("App42-Lua-API.App42API")
local JSON = require("App42-Lua-API.JSON") 
#include "App42API.h"
using com.shephertz.app42.paas.sdk.csharp;  
using com.shephertz.app42.paas.sdk.csharp.customcode;  
Not Available
#include "App42API.h"
Not Available
import com.shephertz.app42.paas.sdk.as3.App42CallBack;
import com.shephertz.app42.paas.sdk.as3.App42Exception;
import com.shephertz.app42.paas.sdk.as3.ServiceAPI;
import com.shephertz.app42.paas.sdk.as3.customcode.CustomCodeService;
import com.shephertz.app42.paas.sdk.as3.util.Util;
Coming Soon

Initialize

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

Required Parameters

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

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

Build Service

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

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
CustomCodeService customCodeService = App42API.buildCustomCodeService(); 
CustomCodeService customCodeService = App42API.BuildCustomCodeService();  
CustomCodeService *customCodeService = [App42API buildCustomCodeService]; 
CustomCodeService customCodeService = App42API.buildCustomCodeService(); 
CustomCodeService customCodeService = App42API.buildCustomCodeService(); 
CustomCodeService customCodeService = App42API.BuildCustomCodeService(); 
Not Available
local customCodeService = App42API:buildCustomCodeService()
CustomCodeService *customCodeService = App42API::BuildCustomCodeService();
CustomCodeService customCodeService = App42API.BuildCustomCodeService(); 
CustomCodeService *customCodeService = App42API::BuildCustomCodeService();
Not Available
Not Available
var customcodeService:CustomCodeService = api.buildCustomCodeService();
Coming Soon

Deploy Jar File

Deploys Custom code in App42 Cloud.

Required Parameters

name - Name of Custom Code Service to be deployed. jarFilePath - Custom code jar file path.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String nameOfCustomCodeService = "DEPLOYED_CUSTOM_CODE_NAME";
String jarFilePath = "JAR FILE PATH";
customCode.deployJarFile(nameOfCustomCodeService, jarFilePath,new App42CallBack() {
public void onSuccess(Object response)
{
    String  res = (String)response;      
	System.out.println("response is " + res) ;
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});
Coming Soon
Not Available
Coming Soon
String nameOfCustomCodeService = "DEPLOYED_CUSTOM_CODE_NAME";
String jarFilePath = "JAR FILE PATH";
String res = customCodeService.deployJarFile(nameOfCustomCodeService, jarFilePath);
System.out.println("response is " + res) ;
Coming Soon
Not Available
Coming Soon
Not Available
Coming Soon
Not Available
Not Available
Not Available
Coming Soon 
Coming Soon

Undeploy Jar File

Undeploy Java Code deployed in App42 Cloud.

Required Parameters

name - Name of Custom Code Service to be undeployed.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String nameOfCustomCodeService = "DEPLOYED_CUSTOM_CODE_NAME";
customCode.undeployJarFile(nameOfCustomCodeService, new App42CallBack() {
public void onSuccess(Object response) 
{
	String  res = (String)response;      
	System.out.println("response is " + res);
}
public void onException(Exception ex)
{
	System.out.println("Exception Message"+ex.getMessage());
}
});
Not Available
Not Available
Not Available
String nameOfCustomCodeService = "DEPLOYED_CUSTOM_CODE_NAME";
String res = customCodeService.undeployJarFile(nameOfCustomCodeService);
System.out.println("response is " + res);
Not Available 
Not Available
Coming Soon
Not Available
Not Available
Not Available
Not Available
Not Available
Coming Soon 
Coming Soon

Run Java Code

Run custom code deployed in the App42 Cloud.

Required Parameters

name - Name of deployed CustomCode Service. jsonBody - Request Body in JSON format.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String name = "DEPLOYED_CUSTOM_CODE_NAME";
JSONObject jsonBody = new JSONObject();
jsonBody.put("Company", "Shephertz");
customCode.runJavaCode(name,jsonBody,new App42CallBack() {
public void onSuccess(Object response) 
{
	JSONObject  res= (JSONObject)response;      
	System.out.println("response is " + res) ;
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});
String name = "DEPLOYED_CUSTOM_CODE_NAME";
JObject jsonBody = new JObject();
jsonBody.Add("Company", "Shephertz");
customCodeService.RunJavaCode(name, jsonBody, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		 JObject json = (JObject) response;     
		 String jsonResponse = json.ToString();  
    }  
} 
NSString *name = @"DEPLOYED_CUSTOM_CODE_NAME"; 
NSDictionary *requestBody = [NSDictionary dictionaryWithObjectsAndKeys:@"Company",@"Shephertz", nil];
App42Response *response = = [customCodeService runJavaCode:name requestBody:requestBody]; 
NSString *jsonResponse = [response toString];  
String name = "DEPLOYED_CUSTOM_CODE_NAME";
JSONObject jsonBody = new JSONObject();
jsonBody.put("Company", "Shephertz");
JSONObject response = customCodeService.runJavaCode(name, jsonBody);
System.out.println("response is " + response);
String name = "DEPLOYED_CUSTOM_CODE_NAME";
JSONObject jsonBody = new JSONObject();
jsonBody.put("Company", "Shephertz");
JSONObject response = customCodeService.runJavaCode(name, jsonBody);
System.out.println("response is " + response);	
String name = "DEPLOYED_CUSTOM_CODE_NAME";
JSONClass  jsonBody = new JSONClass ();
jsonBody.Add("Company", "Shephertz");
App42Log.SetDebug(true);		//Print output in your editor console
customCodeService.RunJavaCode(name, jsonBody, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		JSONClass  objecti = (JSONClass )response;
		App42Log.Console("objectName is : " + objecti["name"]);
		App42Log.Console("Success : " + response);
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
Not Available
local name = "DEPLOYED_CUSTOM_CODE_NAME"
local jsonBody = {}
jsonBody.Company = "Shephertz"
local App42CallBack = {}
customCodeService:runJavaCode(name, jsonBody,App42CallBack)
function App42CallBack:onSuccess(object)
	  print(JSON:encode(object))  
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* name = "DEPLOYED_CUSTOM_CODE_NAME";
App42Object *object = new App42Object();
object->setObject("Company", "Shephertz");
customCodeService->RunJavaCode(name, object, this, app42callfuncND_selector(Sample_Class::onCustomCodeServiceRequestCompleted));
void Sample_Class::onCustomCodeServiceRequestCompleted(App42CallBack *sender, void *response)
{
    App42CustomCodeResponse *customCodeResponse = (App42CustomCodeResponse*)response;
    if(customCodeResponse->isSuccess)
    {
        printf("\n code=%d",customCodeResponse->getCode());
        printf("\n isSuccess=%d",customCodeResponse->isSuccess);
        printf("\n Response Body=%s",customCodeResponse->getBody().c_str());
    }
    else
    {
        printf("\nerrordetails:%s",customCodeResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",customCodeResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",customCodeResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",customCodeResponse->httpErrorCode);
    }
}
String name = "DEPLOYED_CUSTOM_CODE_NAME";
JSONClass  jsonBody = new JSONClass ();
jsonBody.Add("Company", "Shephertz");
JSONClass  response = customCodeService.RunJavaCode(name, jsonBody);
Console.WriteLine("response is " + response);	
const char* name = "DEPLOYED_CUSTOM_CODE_NAME";
App42Object *object = new App42Object();
object->setObject("Company", "Shephertz");
customCodeService->RunJavaCode(name, object, this, app42callfuncND_selector(Sample_Class::onCustomCodeServiceRequestCompleted));
void Sample_Class::onCustomCodeServiceRequestCompleted(App42CallBack *sender, void *response)
{
    App42CustomCodeResponse *customCodeResponse = (App42CustomCodeResponse*)response;
    if(customCodeResponse->isSuccess)
    {
        printf("\n code=%d",customCodeResponse->getCode());
        printf("\n isSuccess=%d",customCodeResponse->isSuccess);
        printf("\n Response Body=%s",customCodeResponse->getBody().c_str());
    }
    else
    {
        printf("\nerrordetails:%s",customCodeResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",customCodeResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",customCodeResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",customCodeResponse->httpErrorCode);
    }
}
Not Available
Not Available
var name:String = "DEPLOYED_CUSTOM_CODE_NAME";  
var jsonObject:Object = new Object;
jsonObject.Company = "Shephertz";
customcodeService.runJavaCode(name,jsonObject,new callback()); 
public class callback implements App42CallBack  
{  
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}  
	public function onSuccess(response:Object):void  
	{  
		trace("Response is :" + Util.toString(response));
		trace("Object Name is:"+Util.toString(response.name));
	}  
}
Coming Soon

Exception Handling

The functions available under Custom Code API can throw some exceptions in abnormal conditions.An example of the same has been given below. For example, if you are trying to deploy the custom code with the name that already exist, you will get an appErrorCode as 1902 stating that Invalid JSON in the request body.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String name = "DEPLOYED_CUSTOM_CODE_NAME";
JSONObject jsonBody = new JSONObject();
jsonBody.put("Company", "Shephertz");
customCode.runJavaCode(name , jsonBody,new App42CallBack() {
public void onSuccess(Object response) 
{
	JSONObject  res= (JSONObject)response;      
	System.out.println("response is " + res) ;
}
public void onException(Exception ex) 
{
	App42Exception exception = (App42Exception)ex;
	int appErrorCode = exception.getAppErrorCode();
	int httpErrorCode = exception.getHttpErrorCode();
	if(exception.getAppErrorCode() == 1902) 
	{
	//Handle here for Bad Request (Invalid JSON in request body.)
	}
	else if(exception.getAppErrorCode() == 1900) 
	{
	//Handle here for Bad Request (Jar File contains the invalid content or class usage that is not allowed for deployment)
	//Example of it using System class or putting .sh/.dll file inside jar file
	}
	else if(exception.getAppErrorCode() == 1401)  
	{  
	// handle here for Client is not authorized  
	}  
	else if(exception.getAppErrorCode() == 1500)  
	{  
	// handle here for Internal Server Error  
	}  
	String jsonText = ex.getMessage(); /* returns the Exception text in JSON format. (as shown below)*/ 
	}	   
});                                        
String name = "DEPLOYED_CUSTOM_CODE_NAME";
JObject jsonBody = new JObject();
jsonBody.Add("Company", "Shephertz");
customCodeService.RunJavaCode(name, jsonBody, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
		int appErrorCode = ex.GetAppErrorCode();
		int httpErrorCode = ex.GetHttpErrorCode();
		if(ex.getAppErrorCode() == 1902) 
		{
			//Handle here for Bad Request (Invalid JSON in request body.)
		}
		else if(ex.getAppErrorCode() == 1900) 
		{
			//Handle here for Bad Request (Jar File contains the invalid content or class usage that is not allowed for deployment)
			//Example of it using System class or putting .sh/.dll file inside jar file
		}
		else if(ex.getAppErrorCode() == 1401)  
		{  
			// handle here for Client is not authorized  
		}  
		else if(ex.getAppErrorCode() == 1500)  
		{  
			// handle here for Internal Server Error  
		}  
		String jsonText = ex.GetMessage(); 
	}  
	public void OnSuccess(Object response)  
	{ 
		JObject json  = (JObject) response;
		Console.WriteLine("response is : " + json);
	} 
}  
					
NSString *name = @"DEPLOYED_CUSTOM_CODE_NAME"; 
NSDictionary *requestBody = [NSDictionary dictionaryWithObjectsAndKeys:@"John",@"name", nil];
@try
{
	App42Response *response = = [customCodeService runJavaCode:name requestBody:requestBody]; 
} @catch(App42Exception *exception) 
{
	int appErrorCode = exception.appErrorCode;
	int httpErrorCode = exception.httpErrorCode;
	if(appErrorCode == 1902)
	{
		//Handle here for Bad Request (Invalid JSON in request body.)
	}
	else if(appErrorCode == 1900) 
	{
		//Handle here for Bad Request (Jar File contains the invalid content or class usage that is not allowed for deployment)
		//Example of it using System class or putting .sh/.dll file inside jar file
	}
	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; 	
}  
String name = "DEPLOYED_CUSTOM_CODE_NAME";
JSONObject jsonBody = new JSONObject();
jsonBody.put("Company", "Shephertz");
try 
{
	customCodeService.runJavaCode(name, jsonBody);
} 
catch (App42Exception ex) {
	int appErrorCode = ex.getAppErrorCode();
	int httpErrorCode = ex.getHttpErrorCode();
	if(ex.getAppErrorCode() == 1902) 
	{
		//Handle here for Bad Request (Invalid JSON in request body.)
	}
	else if(ex.getAppErrorCode() == 1900) 
	{
		//Handle here for Bad Request (Jar File contains the invalid content or class usage that is not allowed for deployment)
		//Example of it using System class or putting .sh/.dll file inside jar file
	}
	else if(ex.getAppErrorCode() == 1401)  
    {  
        // handle here for Client is not authorized  
    }  
    else if(ex.getAppErrorCode() == 1500)  
    {  
        // handle here for Internal Server Error  
    }  
    String jsonText = ex.getMessage(); /* returns the Exception text in JSON format. (as shown below)*/ 
}	
String name = "DEPLOYED_CUSTOM_CODE_NAME";
JSONObject jsonBody = new JSONObject();
jsonBody.put("Company", "Shephertz");
try 
{
	customCodeService.runJavaCode(name, jsonBody);
} 
catch (App42Exception ex) {
	int appErrorCode = ex.getAppErrorCode();
	int httpErrorCode = ex.getHttpErrorCode();
	if(ex.getAppErrorCode() == 1902) 
	{
		//Handle here for Bad Request (Invalid JSON in request body.)
	}
	else if(ex.getAppErrorCode() == 1900) 
	{
		//Handle here for Bad Request (Jar File contains the invalid content or class usage that is not allowed for deployment)
		//Example of it using System class or putting .sh/.dll file inside jar file
	}
	else if(ex.getAppErrorCode() == 1401)  
    {  
        // handle here for Client is not authorized  
    }  
    else if(ex.getAppErrorCode() == 1500)  
    {  
        // handle here for Internal Server Error  
    }  
    String jsonText = ex.getMessage(); /* returns the Exception text in JSON format. (as shown below)*/ 
}	  
Not Available 
Not Available
local name = "DEPLOYED_CUSTOM_CODE_NAME"
local jsonBody = {}
jsonBody.Company = "Shephertz"
local App42CallBack = {}
customCodeService:runJavaCode(name, jsonBody,App42CallBack)
function App42CallBack:onSuccess(object)
	print(object)
end
function App42CallBack:onException(exception)
	if exception.getAppErrorCode() == 1902  then
		-- Handle here for Bad Request (Invalid JSON in request body.)
		elseif exception.getAppErrorCode() == 1900 then 
			-- Handle here for Bad Request (Jar File contains the invalid content or class usage that is not allowed for deployment)
			-- Example of it using System class or putting .sh/.dll file inside jar file
		elseif exception.getAppErrorCode() == 1401 then
			-- handle here for Client is not authorized  
		elseif exception.getAppErrorCode() == 1500 then
			-- handle here for Internal Server Error  
	end
end
const char* name = "DEPLOYED_CUSTOM_CODE_NAME";
App42Object *object = new App42Object();
object->setObject("Company", "Shephertz");
customCodeService->RunJavaCode(name, object, this, app42callfuncND_selector(Sample_Class::onCustomCodeServiceRequestCompleted));
void Sample_Class::onCustomCodeServiceRequestCompleted(App42CallBack *sender, void *response)
{
    App42CustomCodeResponse *customCodeResponse = (App42CustomCodeResponse*)response;
    if(customCodeResponse->isSuccess)
    {
        //Handle success response here.
    }
    else
    {
        printf("\nerrordetails:%s",customCodeResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",customCodeResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",customCodeResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",customCodeResponse->httpErrorCode);
        int appErrorCode = customCodeResponse->appErrorCode;
        if(appErrorCode == 1902) 
		{
			//Handle here for Bad Request (Invalid JSON in request body.)
		}
		else if(appErrorCode == 1900) 
		{
			//Handle here for Bad Request (Jar File contains the invalid content or class usage that is not allowed for deployment)
			//Example of it using System class or putting .sh/.dll file inside jar file
		}
		else if(appErrorCode == 1401)  
    	{  
        	// handle here for Client is not authorized  
    	}  
    	else if(appErrorCode == 1500)  
    	{  
        	// handle here for Internal Server Error  
    	}  
    }
}
  
String name = "DEPLOYED_CUSTOM_CODE_NAME";
JSONClass  jsonBody = new JSONClass ();
jsonBody.Add("Company", "Shephertz");
try 
{
	customCodeService.runJavaCode(name, jsonBody);
} 
catch (App42Exception ex) {
	int appErrorCode = ex.GetAppErrorCode();
	int httpErrorCode = ex.GetHttpErrorCode();
	if(ex.getAppErrorCode() == 1902) 
	{
		//Handle here for Bad Request (Invalid JSON in request body.)
	}
	else if(ex.getAppErrorCode() == 1900) 
	{
		//Handle here for Bad Request (Jar File contains the invalid content or class usage that is not allowed for deployment)
		//Example of it using System class or putting .sh/.dll file inside jar file
	}
	else if(ex.getAppErrorCode() == 1401)  
    {  
        // handle here for Client is not authorized  
    }  
    else if(ex.getAppErrorCode() == 1500)  
    {  
        // handle here for Internal Server Error  
    }  
    String jsonText = ex.GetMessage(); /* returns the Exception text in JSON format. (as shown below)*/ 
}	       
Not Available
Not Available
Not Available
var name:String = "DEPLOYED_CUSTOM_CODE_NAME";  
var jsonBody:Object = new Object;
jsonBody.Company = "Shephertz";
customcodeService.runJavaCode(name,jsonBody,new callback()); 
public class callback implements App42CallBack  
{
	public function onException(ex:App42Exception):void  
	{  
		var appErrorCode:int = ex.getAppErrorCode();
		var httpErrorCode:int = ex.getHttpErrorCode();
		if(ex.getAppErrorCode() == 1902) 
		{
			//Handle here for Bad Request (Invalid JSON in request body.)
		}
		else if(ex.getAppErrorCode() == 1900) 
		{
			//Handle here for Bad Request (Jar File contains the invalid content or class usage that is not allowed for deployment)
			//Example of it using System class or putting .sh/.dll file inside jar file
		}
		else if(ex.getAppErrorCode() == 1401)  
		{  
			// handle here for Client is not authorized  
		}  
		else if(ex.getAppErrorCode() == 1500)  
		{  
			// handle here for Internal Server Error  
		}  
	}  
	public function onSuccess(response:Object):void  
	{  
		trace("response is : " + response);
	}  
}  
Coming Soon

Error Codes

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

1400 - BAD REQUEST - The Request parameters are invalid. 1401 - UNAUTHORIZED - Client is not authorized. 1500 - INTERNAL SERVER ERROR - Internal Server Error. Please try again. 1902 - BAD REQUEST - Invalid JSON in request body. 1903 - BAD REQUEST - Application Exception : Will include exception coming from your deployed code. For example, java.lang.NullPointerException. 1904 - BAD REQUEST - Application Exception : Request Execution Time Exceeded.