NoSQL Storage Service

Storage service provides an efficient way to manage JSON documents in NoSQL database on the cloud. You can store, update, search a JSON document and can also apply mapReduce search for storing documents. For example, if you try to store a JSON document “{"Company":"Shephertz"}”, it will be stored with unique Object ID in the format: {“Company”:”Shephertz”,”_id”:{“$oid”:”4f423dcce1603b3f0bd560cf”}}. This ID can be used later to access/search the document.

Import Statement
  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
import com.shephertz.app42.paas.sdk.android.App42API;
import com.shephertz.app42.paas.sdk.android.App42Response;
import com.shephertz.app42.paas.sdk.android.App42Exception;
import com.shephertz.app42.paas.sdk.android.App42BadParameterException;
import com.shephertz.app42.paas.sdk.android.App42NotFoundException;
import com.shephertz.app42.paas.sdk.android.storage.OrderByType;
import com.shephertz.app42.paas.sdk.android.storage.Query;
import com.shephertz.app42.paas.sdk.android.storage.QueryBuilder;
import com.shephertz.app42.paas.sdk.android.storage.Storage;
import com.shephertz.app42.paas.sdk.android.storage.StorageService;
import com.shephertz.app42.paas.sdk.android.storage.QueryBuilder.Operator;
using com.shephertz.app42.paas.sdk.windows;  
using com.shephertz.app42.paas.sdk.windows.storage;   
#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.storage.OrderByType;
import com.shephertz.app42.paas.sdk.java.storage.Query;
import com.shephertz.app42.paas.sdk.java.storage.QueryBuilder;
import com.shephertz.app42.paas.sdk.java.storage.Storage;
import com.shephertz.app42.paas.sdk.java.storage.StorageService;
import com.shephertz.app42.paas.sdk.java.storage.QueryBuilder.Operator;
using com.shephertz.app42.paas.sdk.csharp;  
using com.shephertz.app42.paas.sdk.csharp.storage;
<script type="text/javascript" src="App42-all-x.x.x.min.js"></script>
require("App42-Lua-API.Operator")
require("App42-Lua-API.Permission")
require("App42-Lua-API.GeoOperator")
require("App42-Lua-API.OrderByType")
require("App42-Lua-API.Operator")
local JSON = require("App42-Lua-API.JSON") 
local queryBuilder = require("App42-Lua-API.QueryBuilder")
local App42API = require("App42-Lua-API.App42API")
local ACL = require("App42-Lua-API.ACL")
#include "App42API.h"
using com.shephertz.app42.paas.sdk.csharp;  
using com.shephertz.app42.paas.sdk.csharp.storage;  
 
include_once '../App42Response.php';  
include_once '../App42Exception.php';  
include_once '../App42BadParameterException.php';  
include_once '../App42NotFoundException.php';  
include_once '../OrderByType.php';  
include_once '../Query.php';  
include_once '../QueryBuilder.php';  
include_once '../StorageService.php';  
#include "App42API.h"
Coming Soon
import com.shephertz.app42.paas.sdk.as3.App42API;
import com.shephertz.app42.paas.sdk.as3.App42Response;
import com.shephertz.app42.paas.sdk.as3.App42Exception;
import com.shephertz.app42.paas.sdk.as3.App42BadParameterException;
import com.shephertz.app42.paas.sdk.as3.App42NotFoundException;
import com.shephertz.app42.paas.sdk.as3.storage.Storage;
import com.shephertz.app42.paas.sdk.as3.storage.StorageService;
import com.shephertz.app42.paas.sdk.as3.storage.JSONDocument;
import com.shephertz.app42.paas.sdk.as3.storage.GeoOperator;
import com.shephertz.app42.paas.sdk.as3.storage.GeoQuery;
import com.shephertz.app42.paas.sdk.as3.storage.GeoTag;
import com.shephertz.app42.paas.sdk.as3.storage.Operator;
import com.shephertz.app42.paas.sdk.as3.storage.OrderByType;
import com.shephertz.app42.paas.sdk.as3.storage.Query;
import com.shephertz.app42.paas.sdk.as3.storage.QueryBuilder;
import com.shephertz.app42.paas.sdk.as3.util.Util;
Coming Soon
import com.shephertz.app42.paas.sdk.jme.App42API;
import com.shephertz.app42.paas.sdk.jme.App42Response;
import com.shephertz.app42.paas.sdk.jme.App42Exception;
import com.shephertz.app42.paas.sdk.jme.App42BadParameterException;
import com.shephertz.app42.paas.sdk.jme.App42NotFoundException;
import com.shephertz.app42.paas.sdk.jme.storage.OrderByType;
import com.shephertz.app42.paas.sdk.jme.storage.Query;
import com.shephertz.app42.paas.sdk.jme.storage.QueryBuilder;
import com.shephertz.app42.paas.sdk.jme.storage.Storage;
import com.shephertz.app42.paas.sdk.jme.storage.StorageService;
import com.shephertz.app42.paas.sdk.jme.storage.QueryBuilder.Operator;
Initialize

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

Required Parameters

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

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

After initialization, the developer will have to call the buildXXXService method on App42API to get the instance of the particular API that they wish to build. For example, to build an instance of StorageService, buildStorageService() method needs to be called.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
StorageService storageService = App42API.buildStorageService(); 
StorageService storageService = App42API.BuildStorageService();  
StorageService *storageService = [App42API buildStorageService]; 
let storageService = App42API.buildStorageService() as? StorageService 
StorageService storageService = App42API.buildStorageService(); 
StorageService storageService = App42API.BuildStorageService(); 
var storageService  = new App42Storage();
local storageService = App42API:buildStorageService()
StorageService *storageService = App42API::BuildStorageService();
StorageService storageService = App42API.BuildStorageService(); 
$storageService = App42API::buildStorageService(); 
StorageService *storageService = App42API::BuildStorageService();
Coming Soon 
var storageService:StorageService = App42API.buildStorageService(); 
Coming Soon
StorageService storageService = App42API.buildStorageService(); 
Insert JSON Document

Save the JSON document in giving database name and collection name.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc has to be saved. json - Target JSON document to be saved.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String json = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.insertJSONDocument(dbName, collectionName, json,new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();          
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
		System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
	}  
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String json = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.InsertJSONDocument(dbName,collectionName,json, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			Console.WriteLine("DocId is : " + jsonDocList[i].GetDocId());
			Console.WriteLine("JSONDoc is : " + jsonDocList[i].GetJsonDoc());
			Console.WriteLine("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			Console.WriteLine("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
		}  
	}  
}  
NSString *dbName = @"<Your_DataBase_Name>";
NSString *collectionName = @"<Your_Collection_Name>"; 
NSString *json = @"{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService insertJSONDocument:dbName  collectionName:collectionName json:json completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Storage *storage =  (Storage*)responseObj;
		NSLog(@"dbName is %@" , storage.dbName);
		NSLog(@"collectionNameId is %@" ,  storage.collectionName);
		NSMutableArray *jsonDocArray = storage.jsonDocArray;               
		for(JSONDocument *jsonDoc in jsonDocArray) 
		{  
			NSLog(@"objectId is = %@ " , jsonDoc.docId);  
			NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); 
		}  
	}
	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 dbName = "<Your_DataBase_Name>"
let collectionName = "<Your_Collection_Name>"
let jsonString = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}"
App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY")    
let storageService = App42API.buildStorageService() as? StorageService 
storageService?.insertJSONDocument(dbName, collectionName: collectionName, json:jsonString, completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let storage = response as! Storage
		NSLog("dbName is : %@", storage.dbName)
		NSLog("collectionName is : %@", storage.collectionName)
		let jsonDocList = storage.jsonDocArray
		for jsonDoc in jsonDocList {
			NSLog("Docid is : %@",jsonDoc.docId)
			NSLog("CreatedAt is : %@",jsonDoc.createdAt)
			NSLog("UpdatedAt is : %@",jsonDoc.updatedAt)
			NSLog("JsonDoc is : %@",jsonDoc.jsonDoc)
		}
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String json = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.insertJSONDocument(dbName,collectionName,json);  
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();          
for(int i=0;i<jsonDocList.size();i++)
{
	System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
	System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
}  
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String json = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.InsertJSONDocument(dbName, collectionName, json, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			App42Log.Console("objectId is " + jsonDocList[i].GetDocId());
		}  
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var dbName = "<Your_DataBase_Name>",
collectionName = "<Your_Collection_Name>",
json = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
var response ;  
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.insertJSONDocument(dbName, collectionName, json,{  
	success: function(object) 
	{  
		var storageObj = JSON.parse(object);  
		response = storageObj.app42.response.storage;
		console.log("dbName is " + response.dbName)
		console.log("objectId is " + response.jsonDoc._id.$oid)
	},  
	error: function(error) {  
	}  
}); 
local dbName  = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local json = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}"
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:insertJSONDocument(dbName, collectionName, json,App42CallBack)
function App42CallBack:onSuccess(object)
	print("dbName is "..object:getDbName())
	print("collectionName is "..object:getCollectionName())
	print("DocId is "..object:getJsonDocList():getDocId())
	print("Created At is "..object:getJsonDocList():getCreatedAt())
	print("Updated At is "..object:getJsonDocList():getUpdatedAt())
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* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
string json = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->InsertJsonDocument(dbName, collectionName, jsonDoc, app42callback(Sample_Class::onStorageRequestCompleted, this));
void Sample_Class::onStorageRequestCompleted(void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String json = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
Storage storage = storageService.InsertJSONDocument(dbName,collectionName,json);  
Console.WriteLine("dbName is " + storage.GetDbName());
Console.WriteLine("collectionName is " + storage.GetCollectionName());
IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
for(int i=0;i <jsonDocList.Count;i++)
{   
	Console.WriteLine("objectId is " + jsonDocList[i].GetDocId());
	Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc());
}  
$dbName = "<Your_DataBase_Name>";
$collectionName = "<Your_Collection_Name>"; 
$json = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$storage = $storageService->insertJSONDocument($dbName, $collectionName, $json); 
print_r("dbName is " . $storage->getDbName());
print_r("collectionName is " . $storage->getCollectionName());
$jsonDocList = $storage->getJsonDocList();
foreach( $jsonDocList as $jsonDoc )
{
	print_r("docId is : " . $jsonDoc->getDocId());
	print_r("jsonDocs is : " . $jsonDoc->getJsonDoc());
	print_r("updated at is : " . $jsonDoc->getUpdatedAt());
	print_r("created At is : " . $jsonDoc->getCreatedAt());
}
$jsonResponse = $storage->toString(); 
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
string json = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->InsertJsonDocument(dbName, collectionName, jsonDoc, this, app42callfuncND_selector(Sample_Class::onStorageRequestCompleted));
void Sample_Class::onStorageRequestCompleted(App42CallBack *sender, void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
Coming Soon
var dbName:String = "<Your_DataBase_Name>";
var collectionName:String = "<Your_Collection_Name>"; 
var json:String = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
App42API.initialize("API_KEY","SECRET_KEY");
var storageService:StorageService = App42API.buildStorageService(); 
storageService.insertJSONDocument(dbName,collectionName,json, new callback());  
public class callback implements App42CallBack  
{  
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
	public function onSuccess(response:Object):void  
	{  
		var storage:Storage = Storage(response);
		trace("dbName is : " + storage.getDbName());
		trace("collectionName is : " + storage.getCollectionName());
		var jsonDocsList:Array = storage.getJsonDocList();
		for(var i:int=0; i < jsonDocsList.length;i++)
		{
			jsonDoc = JSONDocument(jsonDocsList[i]);
			trace("Docid is : " + jsonDoc.getDocId());
			trace("CreatedAt is : " + jsonDoc.getCreatedAt());
			trace("UpdatedAt is :  " + jsonDoc.getUpdatedAt());
			trace("JsonDoc is :  " + jsonDoc.getJsonDoc());
		}
	}  
}  
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String json = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
Storage storage = storageService.insertJSONDocument(dbName,collectionName,json);  
System.out.println("dbName is " + storage.getDbName());
System.out.println("Collection Name is " + storage.getCollectionName());
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Vector JsonDocList = storage.getJsonDocList();   
for(int i=0;i < JsonDocList.size();i++)  
{ 
	Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i);  
	System.out.println("objectId is " + jsonDoc.getDocId());  
	System.out.println("CreatedAt is " + jsonDoc.getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDoc.getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDoc.getJsonDoc());
}         
Insert JSON Using Object

Save the JSON document in giving database name and collection name.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc has to be saved. json - Target JSON document to be saved.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
JSONObject json = new JSONObject();
json.put("name","Nick");
json.put("age",30);
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.insertJSONDocument(dbName, collectionName, json, new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
		System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
	} 
}
public void onException(Exception ex)
{
	System.out.println("Exception Message"+ex.getMessage());
}
}); 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
JObject json = new JObject();
json.Add("name","Nick");
json.Add("age",30);
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.InsertJSONDocument(dbName,collectionName,json, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			Console.WriteLine("DocId is : " + jsonDocList[i].GetDocId());
			Console.WriteLine("JSONDoc is : " + jsonDocList[i].GetJsonDoc());
			Console.WriteLine("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			Console.WriteLine("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
		}    
	}  
}  
NSString *dbName = @"<Your_DataBase_Name>";
NSString *collectionName = @"<Your_Collection_Name>"; 
NSString *json = @"{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService insertJSONDocument:dbName  collectionName:collectionName json:json completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Storage *storage =  (Storage*)responseObj;
		NSLog(@"dbName is %@" , storage.dbName);
		NSLog(@"collectionNameId is %@" ,  storage.collectionName);
		NSMutableArray *jsonDocArray = storage.jsonDocArray;               
		for(JSONDocument *jsonDoc in jsonDocArray) 
		{  
			NSLog(@"objectId is = %@ " , jsonDoc.docId);  
			NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); 
		}  
	}
	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 dbName = "<Your_DataBase_Name>"
let collectionName = "<Your_Collection_Name>"
let jsonDictionary = NSDictionary(object:"Nick", forKey:"name")
App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY")    
let storageService = App42API.buildStorageService() as? StorageService 
storageService?.insertJSONDocument(dbName, collectionName: collectionName, dataDict:jsonDictionary as [NSObject : AnyObject], completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let storage = response as! Storage
		NSLog("dbName is : %@", storage.dbName)
		NSLog("collectionName is : %@", storage.collectionName)
		let jsonDocList = storage.jsonDocArray
		for jsonDoc in jsonDocList 
		{
			NSLog("Docid is : %@",jsonDoc.docId)
			NSLog("CreatedAt is : %@",jsonDoc.createdAt)
			NSLog("UpdatedAt is : %@",jsonDoc.updatedAt)
			NSLog("JsonDoc is : %@",jsonDoc.jsonDoc)
		}
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
JSONObject json = new JSONObject();
json.put("name","Nick");
json.put("age",30);
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.insertJSONDocument(dbName,collectionName,json);  
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
for(int i=0;i<jsonDocList.size();i++)
{
	System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
	System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
} 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
JSONClass json = new JSONClass();
json.Add("name","Nick");
json.Add("age",30);
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.InsertJSONDocument(dbName, collectionName, json, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			App42Log.Console("objectId is " + jsonDocList[i].GetDocId());
		}  
	}	
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var dbName = "<Your_DataBase_Name>",
collectionName = "<Your_Collection_Name>";
var json = new Object();
json.name = "Nick";
json.type = "30";
var response ;  
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.insertJSONDocument(dbName, collectionName, json,{  
	success: function(object) 
	{  
		var storageObj = JSON.parse(object);  
		response = storageObj.app42.response.storage;
		console.log("dbName is " + response.dbName)
		console.log("objectId is " + response.jsonDoc._id.$oid)
		console.log("Created At is "+response.jsonDoc._$createdAt)
		console.log("Updated At is "+response.jsonDoc._$updatedAt)
	},  
	error: function(error) {  
	}  
});
local dbName  = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local json = {}
json.name = "Nick"
json.age = 30
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:insertJSONDocument(dbName, collectionName, json,App42CallBack)
function App42CallBack:onSuccess(object)
	print("dbName is "..object:getDbName())
	print("collectionName is "..object:getCollectionName())
	print("DocId is "..object:getJsonDocList():getDocId())
	print("Created At is "..object:getJsonDocList():getCreatedAt())
	print("Updated At is "..object:getJsonDocList():getUpdatedAt())
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* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
App42Object *object = new App42Object();
object->setObject("name", "Nick");
object->setObject("age", 30);
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->InsertJsonDocument(dbName, collectionName, object, app42callback(Sample_Class::onStorageRequestCompleted, this));

void Sample_Class::onStorageRequestCompleted(void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
JSONClass json = new JSONClass();
json.Add("name","Nick");
json.Add("age","30");
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
Storage storage = storageService.InsertJSONDocument(dbName,collectionName,json);  
Console.WriteLine("dbName is " + storage.GetDbName());
Console.WriteLine("collectionName is " + storage.GetCollectionName());
IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
for(int i=0;i <jsonDocList.Count;i++)
{   
	Console.WriteLine("objectId is " + jsonDocList[i].GetDocId());
	Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc());
}  
$dbName = "<Your_DataBase_Name>";
$collectionName = "<Your_Collection_Name>"; 
$json = new JSONObject();
$json.put("name","Nick");
$json.put("age",30);
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$storage = $storageService->insertJSONDocument($dbName, $collectionName, $json); 
print_r("dbName is " . $storage->getDbName());
print_r("collectionName is " . $storage->getCollectionName());
$jsonDocList = $storage->getJsonDocList();
foreach( $jsonDocList as $jsonDoc )
{
	print_r("docId is : " . $jsonDoc->getDocId());
	print_r("jsonDocs is : " . $jsonDoc->getJsonDoc());
	print_r("updated at is : " . $jsonDoc->getUpdatedAt());
	print_r("created At is : " . $jsonDoc->getCreatedAt());
}
$jsonResponse = $storage->toString(); 
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
App42Object *object = new App42Object();
object->setObject("name", "Nick");
object->setObject("age", 30);
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->InsertJsonDocument(dbName, collectionName, object, this, app42callfuncND_selector(Sample_Class::onStorageRequestCompleted));

void Sample_Class::onStorageRequestCompleted(App42CallBack *sender, void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
Coming Soon
var dbName:String = "<Your_DataBase_Name>";
var collectionName:String = "<Your_Collection_Name>"; 
var json:Object  = new Object();
json.name = "Nick"; 
json.age = 30; 
App42API.initialize("API_KEY","SECRET_KEY");
var storageService:StorageService = App42API.buildStorageService(); 
storageService.insertJSONDocument(dbName,collectionName,json, new callback());  
public class callback implements App42CallBack  
{  
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
	public function onSuccess(response:Object):void  
	{  
		var storage:Storage = Storage(response);
		trace("dbName is : " + storage.getDbName());
		trace("collectionName is : " + storage.getCollectionName());
		var jsonDocsList:Array = storage.getJsonDocList();
		for(var i:int=0; i < jsonDocsList.length;i++)
		{
			jsonDoc = JSONDocument(jsonDocsList[i]);
			trace("Docid is : " + jsonDoc.getDocId());
			trace("CreatedAt is : " + jsonDoc.getCreatedAt());
			trace("UpdatedAt is :  " + jsonDoc.getUpdatedAt());
			trace("JsonDoc is :  " + jsonDoc.getJsonDoc());
		}
	}  
}  
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
JSONObject json = new JSONObject();
json.put("name","Nick");
json.put("age",30);
Storage storage = storageService.insertJSONDocument(dbName,collectionName,json);  
System.out.println("dbName is " + storage.getDbName());
System.out.println("Collection Name is " + storage.getCollectionName());
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Vector JsonDocList = storage.getJsonDocList();   
for(int i=0;i < JsonDocList.size();i++)  
{ 
	Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i);  
	System.out.println("objectId is " + jsonDoc.getDocId());  
	System.out.println("CreatedAt is " + jsonDoc.getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDoc.getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDoc.getJsonDoc());
}         
Find All Collections

Find all collections stored in given database.

Required Parameters

dbName - Unique handler for storage name.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.findAllCollections(dbName, new App42CallBack() {
public void onSuccess(Object response)
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("Collection Name is " + storage.getCollectionName());
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());	
}
});
String dbName = "<Your_DataBase_Name>";
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.FindAllCollections(dbName, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Storage storage = (Storage) response;      
		Console.WriteLine("dbName is " + storage.GetDbName());
		Console.WriteLine("collectionName is " + storage.GetCollectionName());
	}  
}  
NSString *dbName = @"<Your_DataBase_Name>"; 
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService findAllCollections:dbName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Storage *storage =  (Storage*)responseObj;
		NSLog(@"dbName is %@" , storage.dbName);
		NSLog(@"collectionNameId is %@" ,  storage.collectionName);
	}
	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 dbName = "<Your_DataBase_Name>"
App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY")    
let storageService = App42API.buildStorageService() as? StorageService 
storageService?.findAllCollections(dbName, completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let app42Response = response as! App42Response
		NSLog("app42Response is %@", app42Response.strResponse)
		NSLog("totalRecords %d", app42Response.totalRecords)
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String dbName = "<Your_DataBase_Name>";
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.findAllCollections(dbName);  
System.out.println("dbName is " + storage.getDbName());
System.out.println("Collection Name is " + storage.getCollectionName());
String dbName = "<Your_DataBase_Name>";
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.FindAllCollections(dbName, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Storage storage = (Storage) response;      
		App42Log.Console("dbName is " + storage.GetDbName());
		App42Log.Console("collectionName is " + storage.GetCollectionName());
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var dbName = "<Your_DataBase_Name>",
response ;  
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.findAllCollections(dbName,{  
	success: function(object) 
	{  
		var storageObj = JSON.parse(object);  
		response = storageObj.app42.response.storage;
		console.log("dbName is : " + response.dbName)
		console.log("collectionName is : " + response.collectionName)
	},  
	error: function(error) {  
	}  
}); 
local dbName  = "<Your_DataBase_Name>"
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:findAllCollections(dbName,App42CallBack)
function App42CallBack:onSuccess(object)
	print("dbName is "..object:getDbName())
	print("collectionName is "..object:getCollectionName())
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* dbName = "<Your_DataBase_Name>";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->FindAllCollections(dbName, app42callback(Sample_Class::onStorageRequestCompleted, this));
void Sample_Class::onStorageRequestCompleted(void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());
            printf("\n RecordCount=%lf\n",it->recordCount);
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
String dbName = "<Your_DataBase_Name>";
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
Storage storage = storageService.FindAllCollections(dbName);  
Console.WriteLine("dbName is " + storage.GetDbName());
Console.WriteLine("collectionName is " + storage.GetCollectionName());  
$dbName = "<Your_DataBase_Name>";
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$storage = $storageService->findAllCollections($dbName); 
print_r("dbName is " . $storage->getDbName());
print_r("collectionName is " . $storage->getCollectionName());
const char* dbName = "<Your_DataBase_Name>";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->FindAllCollections(dbName, this, app42callfuncND_selector(Sample_Class::onStorageRequestCompleted));
void Sample_Class::onStorageRequestCompleted(App42CallBack *sender, void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());
            printf("\n RecordCount=%lf\n",it->recordCount);
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
Coming Soon
var dbName:String = "<Your_DataBase_Name>";
App42API.initialize("API_KEY","SECRET_KEY");
var storageService:StorageService = App42API.buildStorageService(); 
storageService.findAllCollections(dbName,new callback()); 
public class callback implements App42CallBack  
{  
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
	public function onSuccess(response:Object):void  
	{  
		var storage:Storage = Storage(response);  
		trace("dbName is " + storage.getDbName());   
		trace("collectionName is " + storage.getCollectionName());  
	}  
}  
Coming Soon 
String dbName = "<Your_DataBase_Name>";
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.findAllCollections(dbName);  
System.out.println("dbName is " + storage.getDbName());
System.out.println("Collection Name is " + storage.getCollectionName());
Find All Documents

Find all documents stored in the given database and collection.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc has to be saved.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.findAllDocuments(dbName, collectionName, new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
		System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
	} 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});   
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.FindAllDocuments(dbName,collectionName, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			Console.WriteLine("DocId is : " + jsonDocList[i].GetDocId());
			Console.WriteLine("JSONDoc is : " + jsonDocList[i].GetJsonDoc());
			Console.WriteLine("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			Console.WriteLine("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
		}  
	}  
}  
NSString *dbName = @"<Your_DataBase_Name>";
NSString *collectionName = @"<Your_Collection_Name>"; 
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService findAllDocuments:dbName collectionName:collectionName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Storage *storage =  (Storage*)responseObj;
		NSLog(@"dbName is %@" , storage.dbName);
		NSLog(@"collectionNameId is %@" ,  storage.collectionName);
		NSMutableArray *jsonDocArray = storage.jsonDocArray;               
		for(JSONDocument *jsonDoc in jsonDocArray) 
		{  
			NSLog(@"objectId is = %@ " , jsonDoc.docId);  
			NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); 
		}  
	}
	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 dbName = "<Your_DataBase_Name>"
let collectionName = "<Your_Collection_Name>"
App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY")    
let storageService = App42API.buildStorageService() as? StorageService 
storageService?.findAllDocuments(dbName, collectionName: collectionName, completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let storage = response as! Storage
		NSLog("dbName is : %@", storage.dbName)
		NSLog("collectionName is : %@", storage.collectionName)
		let jsonDocList = storage.jsonDocArray
		for jsonDoc in jsonDocList {
			NSLog("Docid is : %@",jsonDoc.docId)
			NSLog("CreatedAt is : %@",jsonDoc.createdAt)
			NSLog("UpdatedAt is : %@",jsonDoc.updatedAt)
			NSLog("JsonDoc is : %@",jsonDoc.jsonDoc)
		}
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.findAllDocuments(dbName,collectionName);  
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
for(int i=0;i<jsonDocList.size();i++)
{
	System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
	System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
}   
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.FindAllDocuments(dbName,collectionName, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			App42Log.Console("objectId is " + jsonDocList[i].GetDocId());
			App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc());
		}  
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var dbName = "<Your_DataBase_Name>",
collectionName = "<Your_Collection_Name>",
response ;  
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.findAllDocuments(dbName,collectionName,{  
	success: function(object) 
	{  
		var storageObj = JSON.parse(object);
		console.log(storageObj)
		response = storageObj.app42.response.storage.jsonDoc;
		if(response.length == undefined)  
		{			
			console.log(response._id.$oid)
			console.log(response._$createdAt)
			console.log(response._$updatedAt)
		}
	   for(var i=0;i<response.length;i++)  
	   {
			console.log(response[i])
			console.log(response[i]._id.$oid)
			console.log(response[i]._$createdAt)
			console.log(response[i]._$updatedAt)
	   }
	},  
	error: function(error) {  
	}  
}); 

local dbName  = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:findAllDocuments(dbName, collectionName, App42CallBack)
function App42CallBack:onSuccess(object)
	print("dbName is "..object:getDbName())
	for i=1,table.getn(object:getJsonDocList()) do
		print("DocId is "..object:getJsonDocList()[i]:getDocId())
		print("CreatedAt is "..object:getJsonDocList()[i]:getCreatedAt())
	end
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->FindAllDocuments(dbName, collectionName,app42callback(Sample_Class::onStorageRequestCompleted, this));
void Sample_Class::onStorageRequestCompleted(void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());
            printf("\n RecordCount=%lf\n",it->recordCount);
            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
            	printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
Storage storage = storageService.FindAllDocuments(dbName,collectionName);  
Console.WriteLine("dbName is " + storage.GetDbName());
IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
for(int i=0;i <jsonDocList.Count;i++)
{   
	Console.WriteLine("objectId is " + jsonDocList[i].GetDocId());
	Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc());
}  
$dbName = "<Your_DataBase_Name>";
$collectionName = "<Your_Collection_Name>"; 
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$storage = $storageService->findAllDocuments($dbName,$collectionName); 
print_r("dbName is :" . $storage->getDbName());
 print_r("Collection Name is :".$storage->getCollectionName());
$jsonDocList = $storage->getJsonDocList();
foreach( $jsonDocList as $jsonDoc )
{
	print_r("docId is : " . $jsonDoc->getDocId());
	print_r("jsonDocs is : " . $jsonDoc->getJsonDoc());
	print_r("updated at is : " . $jsonDoc->getUpdatedAt());
	print_r("created At is : " . $jsonDoc->getCreatedAt());
}
$jsonResponse = $storage->toString(); 
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->FindAllDocuments(dbName, collectionName,this, app42callfuncND_selector(Sample_Class::onStorageRequestCompleted));
void Sample_Class::onStorageRequestCompleted(App42CallBack *sender, void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());
            printf("\n RecordCount=%lf\n",it->recordCount);
            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
            	printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
Coming Soon
var dbName:String = "<Your_DataBase_Name>";
var collectionName:String = "<Your_Collection_Name>"; 
App42API.initialize("API_KEY","SECRET_KEY");
var storageService:StorageService = App42API.buildStorageService(); 
storageService.findAllDocuments(dbName,collectionName, new callback());  
public class callback implements App42CallBack  
{  
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
	public function onSuccess(response:Object):void  
	{ 
		var storage:Storage = Storage(response);
		trace("dbName is : " + storage.getDbName());
		trace("collectionName is : " + storage.getCollectionName());
		var jsonDoc:JSONDocument = new JSONDocument(); 
		for(var i:int  = 0; i<storage.getJsonDocList().length;i++)
		{						
			jsonDoc = JSONDocument(storage.getJsonDocList()[i]);
			trace("objectId is :  " + jsonDoc.getDocId());
			trace("jsonDoc is :  " + jsonDoc.getJsonDoc());
		}
	}  
}  
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.findAllDocuments(dbName,collectionName);  
System.out.println("dbName is " + storage.getDbName());
Vector JsonDocList = storage.getJsonDocList();   
for(int i=0;i < JsonDocList.size();i++)  
{ 
	Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i);  
	System.out.println("objectId is " + jsonDoc.getDocId());
	System.out.println("CreatedAt is " + jsonDoc.getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDoc.getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDoc.getJsonDoc()); 
}         
Find All Documents Count

Gets the count of all documents stored in the given database and collection.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc needs to be searched.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.findAllDocumentsCount(dbName, collectionName, new App42CallBack() {
public void onSuccess(Object response) 
{
	App42Response app42response = (App42Response)response;      
	System.out.println("Total Records : " + app42response.getTotalRecords()) ;
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());	
}
});
String dbName = "<Enter_the_dbName>"; 
String collectionName = "<Your_Collection_Name>";  
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.FindAllDocumentsCount(dbName,collectionName, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
	 App42Response success = (App42Response) response;      
	 Console.WriteLine("Total Records : " + success.GetTotalRecords()) ;     
	 String jsonResponse = success.ToString();  
    }  
}  
NSString *dbName = @"<Enter_the_dbName>"; 
NSString *collectionName = @"<Your_Collection_Name>";  
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService findAllDocumentsCount:dbName collectionName:collectionName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{	
	if (success)
	{
		App42Response *response = (App42Response*)responseObj;
		NSString *success = response.isResponseSuccess;
		NSString *jsonResponse = [response toString];        
	}
	else
	{
		NSLog(@"Exception = %@",[exception reason]);
		NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
		NSLog(@"App Error Code = %d",[exception appErrorCode]);
		NSLog(@"User Info = %@",[exception userInfo]);
	}
}];
let dbName = "<Your_DataBase_Name>"
let collectionName = "<Your_Collection_Name>"
App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY")    
let storageService = App42API.buildStorageService() as? StorageService 
storageService?.findAllDocumentsCount(dbName, collectionName: collectionName, completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let app42Response = response as! App42Response
		NSLog("app42Response is %@", app42Response.strResponse)
		NSLog("totalRecords %d", app42Response.totalRecords)
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
App42Response app42response = storageService.findAllDocumentsCount(dbName,collectionName);
System.out.println("Total Records : " + app42response.getTotalRecords()) ; 
boolean  success = app42response.isResponseSuccess();
String jsonResponse = app42response.toString(); 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.FindAllDocumentsCount(dbName, collectionName, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		App42Response success = (App42Response) response;    
		App42Log.Console("TotalRecords : " + success.GetTotalRecords());
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var dbName = "<Your_DataBase_Name>",
collectionName = "<Your_Collection_Name>",
response ;  
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.findAllDocumentsCount(dbName,collectionName,{  
	success: function(object) 
	{  
		var storageObj = JSON.parse(object);  
		response = storageObj.app42.response;
		console.log("totalRecords is " + response.totalRecords)
	},  
	error: function(error) {  
	}  
}); 
local dbName  = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:findAllDocumentsCount(dbName, collectionName,App42CallBack)
function App42CallBack:onSuccess(object)
	print("Total Record is : "..object:getTotalRecords())
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* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->FindAllDocumentsCount(dbName, collectionName,app42callback(Sample_Class::onStorageRequestCompleted, this));

void Sample_Class::onStorageRequestCompleted(void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        printf("\nTotalRecords=%d",storageResponse->getTotalRecords());
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
App42Response response = storageService.FindAllDocumentsCount(dbName,collectionName); 
Boolean  success = response.IsResponseSuccess();
String jsonResponse = response.ToString(); 
$dbName = "<Your_DataBase_Name>";
$collectionName = "<Your_Collection_Name>"; 
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$storage = $storageService->findAllDocumentsCount($dbName,$collectionName); 
print_r("Total Records is : ".$storage->getTotalRecords());
$success = $storage->isResponseSuccess();
$jsonResponse = $storage->toString(); 
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->FindAllDocumentsCount(dbName, collectionName,this, app42callfuncND_selector(Sample_Class::onStorageRequestCompleted));

void Sample_Class::onStorageRequestCompleted(App42CallBack *sender, void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        printf("\nTotalRecords=%d",storageResponse->getTotalRecords());
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
Coming Soon
var dbName:String = "<Your_DataBase_Name>";
var collectionName:String = "<Your_Collection_Name>"; 
App42API.initialize("API_KEY","SECRET_KEY");
var storageService:StorageService = App42API.buildStorageService(); 
storageService.findAllDocumentsCount(dbName,collectionName, new callback());  
public class callback implements App42CallBack  
{  
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
	public function onSuccess(response:Object):void  
	{  
		var storage:Storage = Storage(response); 
		trace("response is : " + storage);
	}  
}  
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
App42Response response = storageService.findAllDocumentsCount(dbName,collectionName);
System.out.println("Total Records : " + response.getTotalRecords()) ;  
boolean  success = response.isResponseSuccess();
String jsonResponse = response.toString(); 
Find All Documents Paging

Find all documents stored in the given database and collection by paging.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc needs to be searched. max - Maximum number of records to be fetched. offset - From where the records are to be fetched.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
int max = 1;
int offset = 0 ;
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.findAllDocuments(dbName, collectionName, max, offset, new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
		System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
	} 
}
public void onException(Exception ex) 
{
System.out.println("Exception Message"+ex.getMessage());	
}
});   
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
int max = 1;
int offset = 0 ;
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.FindAllDocuments(dbName,collectionName,max,offset, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			Console.WriteLine("DocId is : " + jsonDocList[i].GetDocId());
			Console.WriteLine("JSONDoc is : " + jsonDocList[i].GetJsonDoc());
			Console.WriteLine("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			Console.WriteLine("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
		}  
	}  
}  
NSString *dbName = @"<Your_DataBase_Name>";
NSString *collectionName = @"<Your_Collection_Name>"; 
int max = 1;
int offset = 0 ;
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService findAllDocuments:dbName collectionName:collectionName max:max offset:offset completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Storage *storage =  (Storage*)responseObj;
		NSLog(@"dbName is %@" , storage.dbName);
		NSLog(@"collectionNameId is %@" ,  storage.collectionName);
		NSMutableArray *jsonDocArray = storage.jsonDocArray;               
		for(JSONDocument *jsonDoc in jsonDocArray) 
		{  
			NSLog(@"objectId is = %@ " , jsonDoc.docId);  
			NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); 
		}  
	}
	else
	{
		NSLog(@"Exception = %@",[exception reason]);
		NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
		NSLog(@"App Error Code = %d",[exception appErrorCode]);
		NSLog(@"User Info = %@",[exception userInfo]);
	}
}];
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
int max = 1;
int offset = 0 ;
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.findAllDocuments(dbName,collectionName,max,offset);  
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
for(int i=0;i<jsonDocList.size();i++)
{
	System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
	System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
}   
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
int max = 1;
int offset = 0 ;
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.FindAllDocuments(dbName, collectionName, max, offset, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			App42Log.Console("objectId is " + jsonDocList[i].GetDocId());
			App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc());
		}  
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var dbName = "<Your_DataBase_Name>",
collectionName = "<Your_Collection_Name>",
max = 1,
offset = 0,
response ;  
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.findAllDocumentsByPaging(dbName,collectionName,max,offset,{  
	success: function(object) 
	{  
		var storageObj = JSON.parse(object);  
		response = storageObj.app42.response.storage;
		console.log("dbName is " + response.dbName)
	},  
	error: function(error) {  
	}  
}); 
local dbName  = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local max = 5
local offset = 0
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:findAllDocumentsByPaging(dbName, collectionName,max,offset,App42CallBack)
function App42CallBack:onSuccess(object)
	print("dbName is "..object:getDbName())
	for i=1,table.getn(object:getJsonDocList()) do
		print("DocId is "..object:getJsonDocList()[i]:getDocId())
		print("CreatedAt is "..object:getJsonDocList()[i]:getCreatedAt())
	end
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
int max = 2;
int offset = 0;
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->FindAllDocuments(dbName, collectionName,max,offset,app42callback(Sample_Class::onStorageRequestCompleted, this));
void Sample_Class::onStorageRequestCompleted(void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());
            printf("\n RecordCount=%lf\n",it->recordCount);
            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
            	printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
int max = 1;
int offset = 0 ;
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
Storage storage = storageService.FindAllDocuments(dbName,collectionName,max,offset);  
Console.WriteLine("dbName is " + storage.GetDbName());
IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
for(int i=0;i <jsonDocList.Count;i++)
{   
	Console.WriteLine("objectId is " + jsonDocList[i].GetDocId());
	Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc());
}     
$dbName = "<Your_DataBase_Name>";
$collectionName = "<Your_Collection_Name>"; 
$max = 1;
$offset = 0 ;
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$storage = $storageService->findAllDocuments($dbName,$collectionName,$max,$offset); 
print_r("dbName is " . $storage->getDbName());
print_r("Collection Name is :".$storage->getCollectionName());
$jsonDocList = $storage->getJsonDocList();
foreach( $jsonDocList as $jsonDoc )
{
	print_r("docId is : " . $jsonDoc->getDocId());
	print_r("jsonDocs is : " . $jsonDoc->getJsonDoc());
	print_r("updated at is : " . $jsonDoc->getUpdatedAt());
	print_r("created At is : " . $jsonDoc->getCreatedAt());
}
$jsonResponse = $storage->toString(); 
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
int max = 2;
int offset = 0;
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->FindAllDocuments(dbName, collectionName,max,offset,this, app42callfuncND_selector(Sample_Class::onStorageRequestCompleted));
void Sample_Class::onStorageRequestCompleted(App42CallBack *sender, void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());
            printf("\n RecordCount=%lf\n",it->recordCount);
            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
            	printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
Coming Soon
var dbName:String = "<Your_DataBase_Name>";
var collectionName:String = "<Your_Collection_Name>"; 
var max:int = 1;
var offset:int = 0 ;
App42API.initialize("API_KEY","SECRET_KEY");
var storageService:StorageService = App42API.buildStorageService(); 
storageService.findAllDocumentsByPaging(dbName,collectionName,max,offset, new callback());  
public class callback implements App42CallBack  
{  
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
	public function onSuccess(response:Object):void  
	{
		var storage:Storage = Storage(response);
		trace("dbName is : " + storage.getDbName());
		trace("collectionName is : " + storage.getCollectionName());
		var jsonDoc:JSONDocument = new JSONDocument(); 
		for(var i:int  = 0; i<storage.getJsonDocList().length;i++)
		{						
			jsonDoc = JSONDocument(storage.getJsonDocList()[i]);
			trace("objectId is :  " + jsonDoc.getDocId());
			trace("jsonDoc is :  " + jsonDoc.getJsonDoc());
		}
	}  
}  
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
Integer max = new Integer(1);
Integer offset = new Integer(0);  
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.findAllDocuments(dbName,collectionName,max,offset);  
System.out.println("dbName is " + storage.getDbName());
Vector JsonDocList = storage.getJsonDocList();   
for(int i=0;i < JsonDocList.size();i++)  
{ 
	Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i);  
	System.out.println("objectId is " + jsonDoc.getDocId());  
	System.out.println("CreatedAt is " + jsonDoc.getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDoc.getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDoc.getJsonDoc());
}         
Find Document By ID

Find a target document by giving unique object ID.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc needs to be searched. docId - Unique Object ID handler.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.findDocumentById(dbName, collectionName, docId, new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
		System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
	} 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());		
}
});  
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.FindDocumentById(dbName,collectionName,docId, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			Console.WriteLine("DocId is : " + jsonDocList[i].GetDocId());
			Console.WriteLine("JSONDoc is : " + jsonDocList[i].GetJsonDoc());
			Console.WriteLine("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			Console.WriteLine("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
		} 
	}  
}  
NSString *dbName = @"<Your_DataBase_Name>";
NSString *collectionName = @"<Your_Collection_Name>"; 
NSString *docId = @"docId";
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService findDocumentById:dbName collectionName:collectionName docId:docId completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Storage *storage =  (Storage*)responseObj;
		NSLog(@"dbName is %@" , storage.dbName);
		NSLog(@"collectionNameId is %@" ,  storage.collectionName);
		NSMutableArray *jsonDocArray = storage.jsonDocArray;               
		for(JSONDocument *jsonDoc in jsonDocArray) 
		{  
			NSLog(@"objectId is = %@ " , jsonDoc.docId);  
			NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); 
		}  
	}
	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 dbName = "<Your_DataBase_Name>"
let collectionName = "<Your_Collection_Name>"
let docId = "docId"
App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY")    
let storageService = App42API.buildStorageService() as? StorageService 
storageService?.findDocumentById(dbName, collectionName: collectionName, docId:docId as String, completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let storage = response as! Storage
		NSLog("dbName is : %@", storage.dbName)
		NSLog("collectionName is : %@", storage.collectionName)
		let jsonDocList = storage.jsonDocArray
		for jsonDoc in jsonDocList {
			NSLog("Docid is : %@",jsonDoc.docId)
			NSLog("CreatedAt is : %@",jsonDoc.createdAt)
			NSLog("UpdatedAt is : %@",jsonDoc.updatedAt)
			NSLog("JsonDoc is : %@",jsonDoc.jsonDoc)
		}
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.findDocumentById(dbName,collectionName,docId);  
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
for(int i=0;i<jsonDocList.size();i++)
{
	System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
	System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
}    
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.FindDocumentById(dbName,collectionName,docId, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			App42Log.Console("objectId is " + jsonDocList[i].GetDocId());
			App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc());
		}  
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var dbName = "<Your_DataBase_Name>",
collectionName = "<Your_Collection_Name>",
docId = "docId",
response ;  
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.findDocumentById(dbName,collectionName,docId,{  
	success: function(object) 
	{  
		var storageObj = JSON.parse(object);  
		response = storageObj.app42.response.storage;
		console.log("dbName is " + response.dbName)
	},  
	error: function(error) {  
	}  
}); 
local dbName  = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local docId = "docId"
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:findDocumentById(dbName, collectionName,docId,App42CallBack)
function App42CallBack:onSuccess(object)
	print("dbName is "..object:getDbName())
	print("DocId is "..object:getJsonDocList():getDocId())
	print("CreatedAt is "..object:getJsonDocList():getCreatedAt())
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* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";    
const char* docId = "docId";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->FindDocumentById(dbName, collectionName, docId, app42callback(Sample_Class::onStorageRequestCompleted, this));
void Sample_Class::onStorageRequestCompleted(void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
Storage storage = storageService.FindDocumentById(dbName,collectionName,docId);  
Console.WriteLine("dbName is " + storage.GetDbName());
IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
for(int i=0;i <jsonDocList.Count;i++)
{   
	Console.WriteLine("objectId is " + jsonDocList[i].GetDocId());
	Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc());
}
$dbName = "<Your_DataBase_Name>";
$collectionName = "<Your_Collection_Name>"; 
$docId = "docId";
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$storage = $storageService->findDocumentById($dbName,$collectionName,$docId); 
print_r("dbName is " . $storage->getDbName());
print_r("Collection Name is :".$storage->getCollectionName());
$jsonDocList = $storage->getJsonDocList();
foreach( $jsonDocList as $jsonDoc )
{
	print_r("docId is : " . $jsonDoc->getDocId());
	print_r("jsonDocs is : " . $jsonDoc->getJsonDoc());
	print_r("updated at is : " . $jsonDoc->getUpdatedAt());
	print_r("created At is : " . $jsonDoc->getCreatedAt());
}
$jsonResponse = $storage->toString(); 
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";    
const char* docId = "docId";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->FindDocumentById(dbName, collectionName, docId, this, app42callfuncND_selector(Sample_Class::onStorageRequestCompleted));
void Sample_Class::onStorageRequestCompleted(App42CallBack *sender, void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
Coming Soon
var dbName:String = "<Your_DataBase_Name>";
var collectionName:String = "<Your_Collection_Name>"; 
var docId:String = "docId";
App42API.initialize("API_KEY","SECRET_KEY");
var storageService:StorageService = App42API.buildStorageService(); 
storageService.findDocumentById(dbName,collectionName,docId, new callback());  
public class callback implements App42CallBack  
{  
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
	public function onSuccess(response:Object):void  
	{  
		var storage:Storage = Storage(response);
		trace("dbName is : " + storage.getDbName());
		trace("collectionName is : " + storage.getCollectionName());
		var jsonDoc:JSONDocument = new JSONDocument(); 
		for(var i:int  = 0; i<storage.getJsonDocList().length;i++)
		{						
			jsonDoc = JSONDocument(storage.getJsonDocList()[i]);
			trace("objectId is :  " + jsonDoc.getDocId());
			trace("jsonDoc is :  " + jsonDoc.getJsonDoc());
		}
	}  
}  
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.findDocumentById(dbName,collectionName,docId);  
System.out.println("dbName is " + storage.getDbName());

Vector JsonDocList = storage.getJsonDocList();   
for(int i=0;i < JsonDocList.size();i++)  
{ 
	Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i);  
	System.out.println("objectId is " + jsonDoc.getDocId());  
	System.out.println("CreatedAt is " + jsonDoc.getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDoc.getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDoc.getJsonDoc());
}         
Find Document By Key Value

Find all documents stored in the given database and collection by using key value search parameter.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc needs to be searched. key - Key to be searched for the target JSON doc. value - Value to be searched for the target JSON doc.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.findDocumentByKeyValue(dbName, collectionName, key, value, new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
		System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
	} 
}
public void onException(Exception ex)
{
	System.out.println("Exception Message"+ex.getMessage());	
}
});  
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.FindDocumentByKeyValue(dbName,collectionName,key,value, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			Console.WriteLine("DocId is : " + jsonDocList[i].GetDocId());
			Console.WriteLine("JSONDoc is : " + jsonDocList[i].GetJsonDoc());
			Console.WriteLine("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			Console.WriteLine("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
		} 
	}  
}  
NSString *dbName = @"<Your_DataBase_Name>";
NSString *collectionName = @"<Your_Collection_Name>"; 
NSString *key = @"name"; 
NSString *value = @"Nick"; 
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService findDocumentByKeyValue:dbName collectionName:collectionName key:key value:value completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Storage *storage =  (Storage*)responseObj;
		NSLog(@"dbName is %@" , storage.dbName);
		NSLog(@"collectionNameId is %@" ,  storage.collectionName);
		NSMutableArray *jsonDocArray = storage.jsonDocArray;               
		for(JSONDocument *jsonDoc in jsonDocArray) 
		{  
			NSLog(@"objectId is = %@ " , jsonDoc.docId);  
			NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); 
		}  
	}
	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 dbName = "<Your_DataBase_Name>"
let collectionName = "<Your_Collection_Name>"
let key = "name"
let value = "Nick"
App42API.initializeWithAPIKey("API_KEY" andSecretKey:"SECRET_KEY")    
let storageService = App42API.buildStorageService() as? StorageService 
storageService?.findDocumentByKeyValue(dbName, collectionName: collectionName, key:key, value:value, completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let storage = response as! Storage
		NSLog("dbName is : %@", storage.dbName)
		NSLog("collectionName is : %@", storage.collectionName)
		let jsonDocList = storage.jsonDocArray
		for jsonDoc in jsonDocList {
			NSLog("Docid is : %@",jsonDoc.docId)
			NSLog("CreatedAt is : %@",jsonDoc.createdAt)
			NSLog("UpdatedAt is : %@",jsonDoc.updatedAt)
			NSLog("JsonDoc is : %@",jsonDoc.jsonDoc)
		}
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.findDocumentByKeyValue(dbName,collectionName,key,value);  
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
for(int i=0;i<jsonDocList.size();i++)
{
	System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
	System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
}   
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.FindDocumentByKeyValue(dbName, collectionName, key, value, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			App42Log.Console("objectId is " + jsonDocList[i].GetDocId());
			App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc());
		}  
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var dbName = "<Your_DataBase_Name>",
collectionName = "<Your_Collection_Name>",
key = "key",
value = "value",
response ;  
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.findDocumentByKeyValue(dbName,collectionName,key,value,{  
	success: function(object) 
	{  
		var storageObj = JSON.parse(object);  
		response = storageObj.app42.response.storage;
		console.log("dbName is " + response.dbName)
	},  
	error: function(error) {  
	}  
}); 
local dbName  = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local key = "name"
local value = "Nick"
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:findDocumentByKeyValue(dbName, collectionName,key,value,App42CallBack)
function App42CallBack:onSuccess(object)
	print("dbName is "..object:getDbName())
	for i=1,table.getn(object:getJsonDocList()) do
		print("DocId is "..object:getJsonDocList()[i]:getDocId())
		print("CreatedAt is "..object:getJsonDocList()[i]:getCreatedAt())
	end
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>"; 
const char* key = "name";
const char* value = "Nick";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->FindDocumentByKeyValue(dbName, collectionName,key,value,app42callback(Sample_Class::onStorageRequestCompleted, this));
void Sample_Class::onStorageRequestCompleted( void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    
    for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
    {
        printf("\n Data Base Name=%s",it->dbName.c_str());
        printf("\n Collection Name=%s\n",it->collectionName.c_str());
    }
    
    for(std::vector<JSONDocument>::iterator it = storageResponse->documents.begin(); it != storageResponse->documents.end(); ++it)
    {
        printf("\n DocId=%s",it->docId.c_str());
        printf("\n Json =%s\n",it->jsonDoc.c_str());
    }
}
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
Storage storage = storageService.FindDocumentByKeyValue(dbName,collectionName,key,value);  
Console.WriteLine("dbName is " + storage.GetDbName());
IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
for(int i=0;i <jsonDocList.Count;i++)
{   
	Console.WriteLine("objectId is " + jsonDocList[i].GetDocId());
	Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc());
}
$dbName = "<Your_DataBase_Name>";
$collectionName = "<Your_Collection_Name>";
$key = "name"; 
$value = "Nick"; 
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$storage = $storageService->findDocumentByKeyValue($dbName,$collectionName,$key,$value); 
print_r("dbName is " . $storage->getDbName());
print_r("Collection Name is :".$storage->getCollectionName());
$jsonDocList = $storage->getJsonDocList();
foreach( $jsonDocList as $jsonDoc )
{
	print_r("docId is : " . $jsonDoc->getDocId());
	print_r("jsonDocs is : " . $jsonDoc->getJsonDoc());
	print_r("updated at is : " . $jsonDoc->getUpdatedAt());
	print_r("created At is : " . $jsonDoc->getCreatedAt());
}
$jsonResponse = $storage->toString(); 
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>"; 
const char* key = "name";
const char* value = "Nick";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->FindDocumentByKeyValue(dbName, collectionName,key,value,this, app42callfuncND_selector(Sample_Class::onStorageRequestCompleted));
void Sample_Class::onStorageRequestCompleted(cocos2d::CCNode *sender, void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    
    for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
    {
        printf("\n Data Base Name=%s",it->dbName.c_str());
        printf("\n Collection Name=%s\n",it->collectionName.c_str());
    }
    
    for(std::vector<JSONDocument>::iterator it = storageResponse->documents.begin(); it != storageResponse->documents.end(); ++it)
    {
        printf("\n DocId=%s",it->docId.c_str());
        printf("\n Json =%s\n",it->jsonDoc.c_str());
    }
}
Coming Soon
var dbName:String = "<Your_DataBase_Name>";
var collectionName:String = "<Your_Collection_Name>"; 
var key:String = "name"; 
var value:String = "Nick"; 
App42API.initialize("API_KEY","SECRET_KEY");
var storageService:StorageService = App42API.buildStorageService(); 
storageService.findDocumentByKeyValue(dbName,collectionName,key,value,new callback());  
public class callback implements App42CallBack  
{  
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
	public function onSuccess(response:Object):void  
	{  
		var storage:Storage = Storage(response);
		trace("dbName is : " + storage.getDbName());
		trace("collectionName is : " + storage.getCollectionName());
		var jsonDoc:JSONDocument = new JSONDocument(); 
		for(var i:int  = 0; i<storage.getJsonDocList().length;i++)
		{						
			jsonDoc = JSONDocument(storage.getJsonDocList()[i]);
			trace("objectId is :  " + jsonDoc.getDocId());
			trace("jsonDoc is :  " + jsonDoc.getJsonDoc());
		}
	}  
}  
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.findDocumentByKeyValue(dbName,collectionName,key,value);  
System.out.println("dbName is " + storage.getDbName());

Vector JsonDocList = storage.getJsonDocList();   
for(int i=0;i < JsonDocList.size();i++)  
{ 
	Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i);  
	System.out.println("objectId is " + jsonDoc.getDocId());  
	System.out.println("CreatedAt is " + jsonDoc.getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDoc.getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDoc.getJsonDoc());
}         
Find Document By Query

Find target documents using custom query.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc needs to be searched. query - Query Object containing custom query for searching docs.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Enter_the_dbName>";  
String collectionName = "<Your_Collection_Name>";   
String key1 = "name";   
String value1 = "Nick";  
String key2 = "age";      
int value2 = 30;    
Query q1 = QueryBuilder.build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick
Query q2 = QueryBuilder.build(key2, value2, Operator.GREATER_THAN);	// Build query q2 for key2 equal to age and value2 equal to 30	 
Query query = QueryBuilder.compoundOperator(q1, Operator.OR, q2);   	
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object.   
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.findDocumentsByQuery(dbName, collectionName, query, new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
		System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
	} 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());	
}
});  
String dbName = "<Enter_the_dbName>";  
String collectionName = "<Your_Collection_Name>";   
String key1 = "name";   
String value1 = "Nick";   
String key2 = "age";     
int value2 = 30;    
Query q1 = QueryBuilder.Build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick
Query q2 = QueryBuilder.Build(key2, value2, Operator.GREATER_THAN);	// Build query q2 for key2 equal to age and value2 equal to 30	 
Query query = QueryBuilder.CompoundOperator(q1, Operator.OR, q2);   
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object.	   
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.FindDocumentsByQuery(dbName, collectionName, query,new Callback());
//This will return JSONObject list, there might be single or multiple objects if more than one object found
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			Console.WriteLine("DocId is : " + jsonDocList[i].GetDocId());
			Console.WriteLine("JSONDoc is : " + jsonDocList[i].GetJsonDoc());
			Console.WriteLine("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			Console.WriteLine("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
		}  
	}  
}  
NSString *dbName = @"<Your_DataBase_Name>";
NSString *collectionName = @"<Your_Collection_Name>"; 
NSString *key1 = @"name"; 
NSString *value1 = @"Nick"; 
NSString *key2 = @"age"; 
NSNumber *value2= [NSNumber numberWithInt:30];
Query *q1 = [QueryBuilder buildQueryWithKey:key1 value:value1 andOperator:APP42_OP_EQUALS]; // Build query q1 for key1 equal to name and value1 equal to Nick
Query *q2 = [QueryBuilder buildQueryWithKey:key2 value:value2 andOperator:APP42_OP_GREATER_THAN]; // Build query q2 for key2 equal to age and value2 equal to 30	 
Query *query = [QueryBuilder combineQuery:q1 withQuery:q2 usingOperator:APP42_OP_OR]; 
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService findDocumentsByQuery:query dbName:dbName collectionName:collectionName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Storage *storage =  (Storage*)responseObj;
		NSLog(@"dbName is %@" , storage.dbName);
		NSLog(@"collectionNameId is %@" ,  storage.collectionName);
		NSMutableArray *jsonDocArray = storage.jsonDocArray;               
		for(JSONDocument *jsonDoc in jsonDocArray) 
		{  
			NSLog(@"objectId is = %@ " , jsonDoc.docId);  
			NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); 
		}  
	}
	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 dbName = "<Your_DataBase_Name>"
let collectionName = "<Your_Collection_Name>"
let key = "name"
let value = "Nick"
App42API.initializeWithAPIKey("API_KEY" andSecretKey: "SECRET_KEY")    
let storageService = App42API.buildStorageService() as? StorageService 
let query = QueryBuilder.buildQueryWithKey(key, value: value, andOperator:APP42_OP_EQUALS)
storageService?.findDocumentsByQuery(query, dbName: dbName, collectionName: collectionName, completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let storage = response as! Storage
		NSLog("dbName is : %@", storage.dbName)
		NSLog("collectionName is : %@", storage.collectionName)
		let jsonDocList = storage.jsonDocArray
		for jsonDoc in jsonDocList {
			NSLog("Docid is : %@",jsonDoc.docId)
			NSLog("CreatedAt is : %@",jsonDoc.createdAt)
			NSLog("UpdatedAt is : %@",jsonDoc.updatedAt)
			NSLog("JsonDoc is : %@",jsonDoc.jsonDoc)
		}
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String dbName = "<Enter_the_dbName>";  
String collectionName = "<Your_Collection_Name>";   
String key1 = "name";   
String value1 = "Nick";     
String key2 = "age";   
int value2 = 30;    
Query q1 = QueryBuilder.build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick
Query q2 = QueryBuilder.build(key2, value2, Operator.GREATER_THAN);	// Build query q2 for key2 equal to age and value2 equal to 30	 
Query query = QueryBuilder.compoundOperator(q1, Operator.OR, q2);   	
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object.   
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.findDocumentsByQuery(dbName,collectionName,query);
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
for(int i=0;i<jsonDocList.size();i++)
{
	System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
	System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
}    
String dbName = "<Enter_the_dbName>";  
String collectionName = "<Your_Collection_Name>";   
String key1 = "name";   
String value1 = "Nick";      
String key2 = "age";  
int value2 = 30;    
Query q1 = QueryBuilder.Build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick
Query q2 = QueryBuilder.Build(key2, value2, Operator.GREATER_THAN);	// Build query q2 for key2 equal to age and value2 equal to 30	 
Query query = QueryBuilder.CompoundOperator(q1, Operator.OR, q2);   	 
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object.  
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.FindDocumentsByQuery(dbName,collectionName,query, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			App42Log.Console("objectId is " + jsonDocList[i].GetDocId());
			App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc());
		}  
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var dbName = "<Your_DataBase_Name>",
collectionName = "<Your_Collection_Name>",
key1 = "name",  
value1 = "Nick",   
key2 = "age",
value2 = 30,  
response ;
var queryBuilder = new QueryBuilder();
var q1= queryBuilder.build(key1, value1, Operator.EQUALS);    
var q2 = queryBuilder.build(key2, value2, Operator.GREATER_THAN);		
var query = queryBuilder.compoundOperator(q1,Operator.OR, q2);   	
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.findDocumentsByQuery(dbName, collectionName, query,{
	success: function(object) 
	{  
		var storageObj = JSON.parse(object);  
		response = storageObj.app42.response.storage;
		console.log("dbName is " + response.dbName)
	},  
	error: function(error) {  
	}  
});         
local dbName  = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local key = "name"
local value = "Nick"
local key1 = "age"
local value1 = 30
local q1 = queryBuilder:build(key, value, Operator.EQUALS)   
local q2 = queryBuilder:build(key1, value1, Operator.GREATER_THAN)		
local query = queryBuilder:compoundOperator(q1,Operator.OR, q2)
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:findDocumentsByQuery(dbName, collectionName,query,App42CallBack)
function App42CallBack:onSuccess(object)
	print("dbName is "..object:getDbName())
		for i=1,table.getn(object:getJsonDocList()) do
			print("DocId is "..object:getJsonDocList()[i]:getDocId())
			print("CreatedAt is "..object:getJsonDocList()[i]:getCreatedAt())
		end
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>"; 
const char* key1 = "name";
const char* value1 = "Nick";
const char* key2 = "age";
const char* value2 = "30";
Query *query1 = QueryBuilder::BuildQuery(key1, value1, APP42_OP_EQUALS);
Query *query2 = QueryBuilder::BuildQuery(key2, value2, APP42_OP_GREATER_THAN_EQUALTO);
Query *query3 = QueryBuilder::CompoundOperator(query1, APP42_OP_OR, query2);
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->FindDocumentByQuery(dbName, collectionName,query3,app42callback(Sample_Class::onStorageRequestCompleted, this));

void Sample_Class::onStorageRequestCompleted(void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Event=%s",iit->getEvent().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
String dbName = "<Enter_the_dbName>";  
String collectionName = "<Your_Collection_Name>";   
String key1 = "name";   
String value1 = "Nick";     
String key2 = "age";   
int value2 = 30;    
Query q1 = QueryBuilder.Build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick
Query q2 = QueryBuilder.Build(key2, value2, Operator.GREATER_THAN);	// Build query q2 for key2 equal to age and value2 equal to 30	 
Query query = QueryBuilder.CompoundOperator(q1, Operator.OR, q2);   	 
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object.  
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
Storage storage = storageService.FindDocumentsByQuery(dbName,collectionName,query);
Console.WriteLine("dbName is " + storage.GetDbName());
IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
for(int i=0;i <jsonDocList.Count;i++)
{   
	Console.WriteLine("objectId is " + jsonDocList[i].GetDocId());
	Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc());
}
$dbName = "<Enter_the_dbName>";  
$collectionName = "<Your_Collection_Name>";    
$key1 = "name";   
$value1 = "Nick";   
$key2 = "age";     
$value2 = 30;    
$queryBuilder = new QueryBuilder();
$q1 = $queryBuilder->build($key1, $value1, Operator::EQUALS);  // Build query q1 for key1 equal to name and value1 equal to Nick
$q2 = $queryBuilder->build($key2, $value2, Operator::GREATER_THAN);  // Build query q2 for key2 equal to age and value2 equal to 30
$query = $queryBuilder->compoundOperator($q1, Operator::ORop, $q2);  	 
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object.	
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$storage = $storageService->findDocumentsByQuery($dbName,$collectionName,$query);
print_r("dbName is " . $storage->getDbName());
print_r("Collection Name is :".$storage->getCollectionName());
$jsonDocList = $storage->getJsonDocList();
foreach( $jsonDocList as $jsonDoc )
{
	print_r("docId is : " . $jsonDoc->getDocId());
	print_r("jsonDocs is : " . $jsonDoc->getJsonDoc());
	print_r("updated at is : " . $jsonDoc->getUpdatedAt());
	print_r("created At is : " . $jsonDoc->getCreatedAt());
}
$jsonResponse = $storage->toString();
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>"; 
const char* key1 = "name";
const char* value1 = "Nick";
const char* key2 = "age";
const char* value2 = "30";
Query *query1 = QueryBuilder::BuildQuery(key1, value1, APP42_OP_EQUALS);
Query *query2 = QueryBuilder::BuildQuery(key2, value2, APP42_OP_GREATER_THAN_EQUALTO);
Query *query3 = QueryBuilder::CompoundOperator(query1, APP42_OP_OR, query2);
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->FindDocumentByQuery(dbName, collectionName,query3,this, app42callfuncND_selector(Sample_Class::onStorageRequestCompleted));

void Sample_Class::onStorageRequestCompleted(App42CallBack *sender, void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Event=%s",iit->getEvent().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
Coming Soon
var dbName:String = "<Enter_the_dbName>";
var collectionName:String = "<Your_Collection_Name>";
var key1:String = "name";
var value1:String = "Nick";
var key2:String = "age";
var value2:int = 30;
var q1:Query = QueryBuilder.build(key1, value1, Operator.EQUALS);
var q2:Query = QueryBuilder.build(key2, value2, Operator.GREATER_THAN);
var query:Query = QueryBuilder.compoundOperator(q1, Operator.OR, q2);
App42API.initialize("API_KEY","SECRET_KEY");
var storageService:StorageService = App42API.buildStorageService(); 
storageService.findDocumentsByQuery(dbName, collectionName, query,new callback());  
public class callback implements App42CallBack  
{  
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
	public function onSuccess(response:Object):void  
	{  
		var storage:Storage = Storage(response);
		trace("dbName is : " + storage.getDbName());
		trace("collectionName is : " + storage.getCollectionName());
		var jsonDoc:JSONDocument = new JSONDocument(); 
		for(var i:int  = 0; i<storage.getJsonDocList().length;i++)
		{						
			jsonDoc = JSONDocument(storage.getJsonDocList()[i]);
			trace("objectId is :  " + jsonDoc.getDocId());
			trace("jsonDoc is :  " + jsonDoc.getJsonDoc());
		}
	}  
} 
Coming Soon 
String dbName = "<Enter_the_dbName>";  
String collectionName = "<Your_Collection_Name>";   
String key1 = "name";   
String value1 = "Nick";    
String key2 = "age";    
int value2 = 30;    
Query q1 = QueryBuilder.build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick
Query q2 = QueryBuilder.build(key2, value2, Operator.GREATER_THAN);	// Build query q2 for key2 equal to age and value2 equal to 30	 
Query query = QueryBuilder.compoundOperator(q1, Operator.OR, q2);   	 
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object.  
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.findDocumentsByQuery(dbName,collectionName,query);
System.out.println("dbName is " + storage.getDbName());
Vector JsonDocList = storage.getJsonDocList();   
for(int i=0;i < JsonDocList.size();i++)  
{ 
	Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i);  
	System.out.println("objectId is " + jsonDoc.getDocId());  
	System.out.println("CreatedAt is " + jsonDoc.getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDoc.getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDoc.getJsonDoc());
}         
Find Document By Query Paging

Find target documents using custom query with paging.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc needs to be searched. query - Query Object containing custom query for searching docs. max - max result parameter. offset - offset result parameter.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Enter_the_dbName>";  
String collectionName = "<Your_Collection_Name>";   
String key1 = "name";   
String value1 = "Nick";
String key2 = "age";        
int value2 = 30;    
int max = 1;    
int offset = 0;    
Query q1 = QueryBuilder.build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick
Query q2 = QueryBuilder.build(key2, value2, Operator.GREATER_THAN);	// Build query q2 for key2 equal to age and value2 equal to 30	 
Query query = QueryBuilder.compoundOperator(q1, Operator.OR, q2);   	
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object.   
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.findDocumentsByQueryWithPaging(dbName, collectionName, query, max, offset, new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
		System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
	} 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());	
}
});   
String dbName = "<Enter_the_dbName>";  
String collectionName = "<Your_Collection_Name>";   
String key1 = "name";  
String value1 = "Nick";   
String key2 = "age";      
int value2 = 30;       
int max = 1;        
int offset = 0;       
Query q1 = QueryBuilder.Build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick
Query q2 = QueryBuilder.Build(key2, value2, Operator.GREATER_THAN);	// Build query q2 for key2 equal to age and value2 equal to 30	 
Query query = QueryBuilder.CompoundOperator(q1, Operator.OR, q2);   
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object.	   
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.FindDocumentsByQuery(dbName,collectionName,query,max,offset,new Callback());
//This will return JSONObject list, there might be single or multiple objects if more than one object found
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			Console.WriteLine("DocId is : " + jsonDocList[i].GetDocId());
			Console.WriteLine("JSONDoc is : " + jsonDocList[i].GetJsonDoc());
			Console.WriteLine("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			Console.WriteLine("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
		} 
	}  
}  
NSString *dbName = @"<Your_DataBase_Name>";
NSString *collectionName = @"<Your_Collection_Name>"; 
NSString *key1 = @"name"; 
NSString *value1 = @"Nick"; 
NSString *key2 = @"age"; 
NSNumber *value2= [NSNumber numberWithInt:30];    
int max = 1;        
int offset = 0;       
Query *q1 = [QueryBuilder buildQueryWithKey:key1 value:value1 andOperator:APP42_OP_EQUALS]; // Build query q1 for key1 equal to name and value1 equal to Nick
Query *q2 = [QueryBuilder buildQueryWithKey:key2 value:value2 andOperator:APP42_OP_GREATER_THAN]; // Build query q2 for key2 equal to age and value2 equal to 30	 
Query *query = [QueryBuilder combineQuery:q1 withQuery:q2 usingOperator:APP42_OP_OR]; 
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService findDocumentsByQueryWithPaging:dbName  collectionName:collectionName query:query max:max offset:offset completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Storage *storage =  (Storage*)responseObj;
		NSLog(@"dbName is %@" , storage.dbName);
		NSLog(@"collectionNameId is %@" ,  storage.collectionName);
		NSMutableArray *jsonDocArray = storage.jsonDocArray;               
		for(JSONDocument *jsonDoc in jsonDocArray) 
		{  
			NSLog(@"objectId is = %@ " , jsonDoc.docId);  
			NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); 
		}  
	}
	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 dbName = "<Your_DataBase_Name>"
let collectionName = "<Your_Collection_Name>"
let max:Int32 = 5
let offset:Int32 = 0
let key = "name"
let value = "Nick"
App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY")    
let storageService = App42API.buildStorageService() as? StorageService 
let query = QueryBuilder.buildQueryWithKey(key, value: value, andOperator:APP42_OP_EQUALS)
storageService?.findDocumentsByQueryWithPaging(dbName, collectionName: collectionName, query:query, max:max, offset:offset, completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let storage = response as! Storage
		NSLog("dbName is : %@", storage.dbName)
		NSLog("collectionName is : %@", storage.collectionName)
		let jsonDocList = storage.jsonDocArray
		for jsonDoc in jsonDocList {
			NSLog("Docid is : %@",jsonDoc.docId)
			NSLog("CreatedAt is : %@",jsonDoc.createdAt)
			NSLog("UpdatedAt is : %@",jsonDoc.updatedAt)
			NSLog("JsonDoc is : %@",jsonDoc.jsonDoc)
		}
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String dbName = "<Enter_the_dbName>";  
String collectionName = "<Your_Collection_Name>";   
String key1 = "name";   
String value1 = "Nick";     
String key2 = "age";   
int value2 = 30;         
int max = 1;        
int offset = 0;     
Query q1 = QueryBuilder.build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick
Query q2 = QueryBuilder.build(key2, value2, Operator.GREATER_THAN);	// Build query q2 for key2 equal to age and value2 equal to 30	 
Query query = QueryBuilder.compoundOperator(q1, Operator.OR, q2);   	
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object.   
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.findDocumentsByQuery(dbName,collectionName,query,max,offset);
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
for(int i=0;i<jsonDocList.size();i++)
{
	System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
	System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
}    
String dbName = "<Enter_the_dbName>";  
String collectionName = "<Your_Collection_Name>";   
String key1 = "name";   
String value1 = "Nick";     
String key2 = "age";   
int value2 = 30;        
int max = 1;        
int offset = 0;    
Query q1 = QueryBuilder.Build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick
Query q2 = QueryBuilder.Build(key2, value2, Operator.GREATER_THAN);	// Build query q2 for key2 equal to age and value2 equal to 30	 
Query query = QueryBuilder.CompoundOperator(q1, Operator.OR, q2);   	 
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object.  
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.FindDocumentsByQuery(dbName, collectionName, query, max, offset, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			App42Log.Console("objectId is " + jsonDocList[i].GetDocId());
			App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc());
		}  
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var dbName = "<Your_DataBase_Name>",
collectionName = "<Your_Collection_Name>",
key1 = "name",
value1 = "age",     
key2 = "Nick",
value2 = 30,        
max = 1,        
offset = 0,    
response ;
var queryBuilder = new QueryBuilder();
var q1 = queryBuilder.build(key1, value1, Operator.EQUALS);    
var q2 = queryBuilder.build(key2, value2, Operator.GREATER_THAN);		
var query = queryBuilder.compoundOperator(q1,Operator.OR, q2);   	
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.findDocumentsByQuery(dbName, collectionName, query, max, offset,{
	success: function(object) 
	{  
		var storageObj = JSON.parse(object);  
		response = storageObj.app42.response.storage;
		console.log("dbName is " + response.dbName)
	},  
	error: function(error) {  
	}  
});         
local dbName  = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local key = "name"
local value = "Nick"
local key1 = "age"
local value1 = 30
local max = 5
local offset = 0
local q1 = queryBuilder:build(key, value, Operator.EQUALS)   
local q2 = queryBuilder:build(key1, value1, Operator.GREATER_THAN)		
local query = queryBuilder:compoundOperator(q1,Operator.OR, q2)
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:findDocumentsByQueryWithPaging(dbName, collectionName,query,max,offset,App42CallBack)
function App42CallBack:onSuccess(object)
	print("dbName is "..object:getDbName())
		for i=1,table.getn(object:getJsonDocList()) do
			print("DocId is "..object:getJsonDocList()[i]:getDocId())
			print("CreatedAt is "..object:getJsonDocList()[i]:getCreatedAt())
		end
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>"; 
const char* key1 = "name";
const char* value1 = "Nick";
const char* key2 = "age";
const char* value2 = "30";

Query *query1 = QueryBuilder::BuildQuery(key1, value1, APP42_OP_EQUALS);
Query *query2 = QueryBuilder::BuildQuery(key2, value2, APP42_OP_GREATER_THAN_EQUALTO);
Query *query3 = QueryBuilder::CompoundOperator(query1, APP42_OP_OR, query2);
int max =2;
int offset = 0;
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->FindDocumentsByQueryWithPaging(dbName, collectionName,query3,max,offset,app42callback(Sample_Class::onStorageRequestCompleted, this));

void Sample_Class::onStorageRequestCompleted(void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Event=%s",iit->getEvent().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
String dbName = "<Enter_the_dbName>";  
String collectionName = "<Your_Collection_Name>";   
String key1 = "name";   
String value = "Nick";     
String key2 = "age";   
int value1 = 30;        
int max = 1;        
int offset = 0;    
Query q1 = QueryBuilder.Build(key1, value2, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick
Query q2 = QueryBuilder.Build(key2, value2, Operator.GREATER_THAN);	// Build query q2 for key2 equal to age and value2 equal to 30	 
Query query = QueryBuilder.CompoundOperator(q1, Operator.OR, q2);   	 
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object.  
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
Storage storage = storageService.FindDocumentsByQuery(dbName,collectionName, query, max, offset);
Console.WriteLine("dbName is " + storage.GetDbName());
IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
for(int i=0;i <jsonDocList.Count;i++)
{   
	Console.WriteLine("objectId is " + jsonDocList[i].GetDocId());
	Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc());
}  
$dbName = "<Enter_the_dbName>";  
$collectionName = "<Your_Collection_Name>";    
$key1 = "name";  
$value1 = "Nick";   
$key2 = "age";      
$value2 = 30;     
$max = 1;    
$offset = 30;    
$queryBuilder = new QueryBuilder();
$q1 = $queryBuilder->build($key1, $value1, Operator::EQUALS);  // Build query q1 for key1 equal to name and value1 equal to Nick
$q2 = $queryBuilder->build($key2, $value2, Operator::GREATER_THAN);  // Build query q2 for key2 equal to age and value2 equal to 30
$query = $queryBuilder->compoundOperator($q1, Operator::ORop, $q2);  	 
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object.	
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$storage = $storageService->findDocumentsByQuery($dbName,$collectionName,$query,$max,$offset);
print_r("dbName is " . $storage->getDbName());
print_r("Collection Name is :".$storage->getCollectionName());
print_r("Record Count :".$storage->getRecordCount());
$jsonDocList = $storage->getJsonDocList();
foreach( $jsonDocList as $jsonDoc )
{
	print_r("docId is : " . $jsonDoc->getDocId());
	print_r("jsonDocs is : " . $jsonDoc->getJsonDoc());
	print_r("updated at is : " . $jsonDoc->getUpdatedAt());
	print_r("created At is : " . $jsonDoc->getCreatedAt());
}
$jsonResponse = $storage->toString();
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>"; 
const char* key1 = "name";
const char* value1 = "Nick";
const char* key2 = "age";
const char* value2 = "30";

Query *query1 = QueryBuilder::BuildQuery(key1, value1, APP42_OP_EQUALS);
Query *query2 = QueryBuilder::BuildQuery(key2, value2, APP42_OP_GREATER_THAN_EQUALTO);
Query *query3 = QueryBuilder::CompoundOperator(query1, APP42_OP_OR, query2);
int max =2;
int offset = 0;
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->FindDocumentsByQueryWithPaging(dbName, collectionName,query3,max,offset,this, app42callfuncND_selector(Sample_Class::onStorageRequestCompleted));

void Sample_Class::onStorageRequestCompleted(App42CallBack *sender, void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Event=%s",iit->getEvent().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
Coming Soon
Coming Soon
Coming Soon 
String dbName = "<Enter_the_dbName>";  
String collectionName = "<Your_Collection_Name>";   
String key1 = "name";   
String value1 = "Nick";     
String key2 = "age";   
int value2 = 30;  
Integer max = new Integer(1);
Integer offset = new Integer(0);    
Query q1 = QueryBuilder.build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick
Query q2 = QueryBuilder.build(key2, value2, Operator.GREATER_THAN);	// Build query q2 for key2 equal to age and value2 equal to 30	 
Query query = QueryBuilder.compoundOperator(q1, Operator.OR, q2);   	 
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object.  
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.findDocumentsByQuery(dbName,collectionName,query,max,offset);
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
Vector JsonDocList = storage.getJsonDocList();   
for(int i=0;i < JsonDocList.size();i++)  
{ 
	Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i);  
	System.out.println("objectId is " + jsonDoc.getDocId());  
	System.out.println("CreatedAt is " + jsonDoc.getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDoc.getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDoc.getJsonDoc()); 
}          
Find Docs With Query Paging Order By

Find target documents using custom query with paging and orderby.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc needs to be searched. query - Query Object containing custom query for searching docs. max - max result parameter. offset - offset result parameter. key - Key to be searched for the target JSON doc. type - Sorts the document by its type either ASCENDING or DESCENDING.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Enter_the_dbName>";  
String collectionName = "<Your_Collection_Name>";   
String key1 = "name";   
String value1 = "Nick";
String key2 = "age";        
int value2 = 30;    
int max = 1;    
int offset = 0;    
Query q1 = QueryBuilder.build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick
Query q2 = QueryBuilder.build(key2, value2, Operator.GREATER_THAN);	// Build query q2 for key2 equal to age and value2 equal to 30	 
Query query = QueryBuilder.compoundOperator(q1, Operator.OR, q2);   	
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object.   
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.findDocsWithQueryPagingOrderBy(dbName,collectionName, query, max, offset, key1 , OrderByType.ASCENDING ,new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
		System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
	} 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());	
}
});   
String dbName = "<Enter_the_dbName>";  
String collectionName = "<Your_Collection_Name>";   
String key1 = "name";  
String value1 = "Nick"; 
String key2 = "age";        
int value2 = 30;       
int max = 1;        
int offset = 0;       
Query q1 = QueryBuilder.Build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick
Query q2 = QueryBuilder.Build(key2, value2, Operator.GREATER_THAN);	// Build query q2 for key2 equal to age and value2 equal to 30	 
Query query = QueryBuilder.CompoundOperator(q1, Operator.OR, q2);   
// Pass aggregated query  to finder method below. Similarly you can aggregate more conditions in querying object.	   
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.FindDocsWithQueryPagingOrderBy(dbName,collectionName,query,max,offset,key1,OrderByType.ASCENDING,new Callback());
//This will return JSONObject list, there might be single or multiple objects if more than one object found
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			Console.WriteLine("DocId is : " + jsonDocList[i].GetDocId());
			Console.WriteLine("JSONDoc is : " + jsonDocList[i].GetJsonDoc());
			Console.WriteLine("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			Console.WriteLine("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
		}  
	}  
}  
NSString *dbName = @"<Your_DataBase_Name>";
NSString *collectionName = @"<Your_Collection_Name>"; 
NSString *key1 = @"name"; 
NSString *value1 = @"Nick"; 
NSString *key2 = @"age"; 
NSNumber *value2 = [NSNumber numberWithInt:30];    
int max = 1;        
int offset = 0;       
Query *q1 = [QueryBuilder buildQueryWithKey:key1 value:value1 andOperator:APP42_OP_EQUALS]; // Build query q1 for key1 equal to name and value1 equal to Nick
Query *q2 = [QueryBuilder buildQueryWithKey:key2 value:value2 andOperator:APP42_OP_GREATER_THAN]; // Build query q2 for key2 equal to age and value2 equal to 30	 
Query *query = [QueryBuilder combineQuery:q1 withQuery:q2 usingOperator:APP42_OP_OR]; 
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService findDocsWithQueryPagingOrderBy:dbName  collectionName:collectionName query:query max:max offset:offset orderByKey:key1 orderByType:APP42_ORDER_ASCENDING completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Storage *storage =  (Storage*)responseObj;
		NSLog(@"dbName is %@" , storage.dbName);
		NSLog(@"collectionNameId is %@" ,  storage.collectionName);
		NSMutableArray *jsonDocArray = storage.jsonDocArray;               
		for(JSONDocument *jsonDoc in jsonDocArray) 
		{  
			NSLog(@"objectId is = %@ " , jsonDoc.docId);  
			NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); 
		}  
	}
	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 dbName = "<Your_DataBase_Name>"
let collectionName = "<Your_Collection_Name>"
let max:Int32 = 5
let offset:Int32 = 0
let key = "name"
let value = "Nick"
App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY")    
let storageService = App42API.buildStorageService() as? StorageService 
let query = QueryBuilder.buildQueryWithKey(key, value: value, andOperator:APP42_OP_EQUALS)
storageService?.findDocsWithQueryPagingOrderBy(dbName, collectionName: collectionName, query:query, max:max, offset:offset, orderByKey:key, orderByType:APP42_ORDER_ASCENDING, completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let storage = response as! Storage
		NSLog("dbName is : %@", storage.dbName)
		NSLog("collectionName is : %@", storage.collectionName)
		let jsonDocList = storage.jsonDocArray
		for jsonDoc in jsonDocList {
			NSLog("Docid is : %@",jsonDoc.docId)
			NSLog("CreatedAt is : %@",jsonDoc.createdAt)
			NSLog("UpdatedAt is : %@",jsonDoc.updatedAt)
			NSLog("JsonDoc is : %@",jsonDoc.jsonDoc)
		}
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String dbName = "<Enter_the_dbName>";  
String collectionName = "<Your_Collection_Name>";   
String key1 = "name";   
String value1 = "Nick";      
String key2 = "age";  
int value2 = 30;         
int max = 1;        
int offset = 0;     
Query q1 = QueryBuilder.build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick
Query q2 = QueryBuilder.build(key2, value2, Operator.GREATER_THAN);	// Build query q2 for key2 equal to age and value2 equal to 30	 
Query query = QueryBuilder.compoundOperator(q1, Operator.OR, q2);   	
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object.   
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.findDocsWithQueryPagingOrderBy(dbName,collectionName, query, max,offset,key1,OrderByType.ASCENDING);
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
for(int i=0;i<jsonDocList.size();i++)
{
	System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
	System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
}   
String dbName = "<Enter_the_dbName>";  
String collectionName = "<Your_Collection_Name>";   
String key1 = "name";   
String value1 = "Nick";   
String key2 = "age";     
int value2 = 30;        
int max = 1;        
int offset = 0;    
Query q1 = QueryBuilder.Build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick
Query q2 = QueryBuilder.Build(key2, value2, Operator.GREATER_THAN);	// Build query q2 for key2 equal to age and value2 equal to 30	 
Query query = QueryBuilder.CompoundOperator(q1, Operator.OR, q2);   	 
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object.  
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.FindDocsWithQueryPagingOrderBy(dbName, collectionName, query, max, offset, key1, OrderByType.ASCENDING, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			App42Log.Console("objectId is " + jsonDocList[i].GetDocId());
			App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc());
		}  
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var dbName = "<Your_DataBase_Name>",
collectionName = "<Your_Collection_Name>",
key1 = "name", 
value1 = "age", 
key2 = "Nick",   
value2 = 30,        
max = 1,        
offset = 0,    
response ;
var queryBuilder = new QueryBuilder();
var q1 = queryBuilder.build(key1, value2, Operator.EQUALS);    
var q2 = queryBuilder.build(key2, value2, Operator.GREATER_THAN);		
var query = queryBuilder.compoundOperator(q1,Operator.OR, q2);   	
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.findDocsWithQueryPagingOrderBy(dbName, collectionName, query,max,offset,key1,OrderByType.ASCENDING,{
	success: function(object) 
	{  
		var storageObj = JSON.parse(object);  
		response = storageObj.app42.response.storage;
		console.log("dbName is " + response.dbName)
	},  
	error: function(error) {  
	}  
});         
local dbName  = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local key = "name"
local value = "Nick"
local key1 = "age"
local value1 = 30
local max = 5
local offset = 0
local q1 = queryBuilder:build(key, value, Operator.EQUALS)   
local q2 = queryBuilder:build(key1, value1, Operator.GREATER_THAN)		
local query = queryBuilder:compoundOperator(q1,Operator.OR, q2)
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:findDocsWithQueryPagingOrderBy(dbName, collectionName,query,max,offset,key,OrderByType.ASCENDING,App42CallBack)
function App42CallBack:onSuccess(object)
	print("dbName is "..object:getDbName())
		for i=1,table.getn(object:getJsonDocList()) do
			print("DocId is "..object:getJsonDocList()[i]:getDocId())
			print("CreatedAt is "..object:getJsonDocList()[i]:getCreatedAt())
		end
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>"; 
const char* key1 = "name";
const char* value1 = "Nick";
const char* key2 = "age";
const char* value2 = "30";
Query *query1 = QueryBuilder::BuildQuery(key1, value1, APP42_OP_EQUALS);
Query *query2 = QueryBuilder::BuildQuery(key2, value2, APP42_OP_GREATER_THAN_EQUALTO);
Query *query3 = QueryBuilder::CompoundOperator(query1, APP42_OP_OR, query2);
int max =2;
int offset = 0;
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->FindDocsWithQueryPagingOrderBy(dbName, collectionName,query3,max,offset,key1,APP42_ORDER_ASCENDING, app42callback(Sample_Class::onStorageRequestCompleted, this));

void Sample_Class::onStorageRequestCompleted(void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
String dbName = "<Enter_the_dbName>";  
String collectionName = "<Your_Collection_Name>";   
String key1 = "name";  
String value1 = "Nick";    
String key2 = "age";     
int value2 = 30;        
int max = 1;        
int offset = 0;    
Query q1 = QueryBuilder.Build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick
Query q2 = QueryBuilder.Build(key2, value2, Operator.GREATER_THAN);	// Build query q2 for key2 equal to age and value2 equal to 30	 
Query query = QueryBuilder.CompoundOperator(q1, Operator.OR, q2);   	 
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object.  
Storage storage = App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.FindDocsWithQueryPagingOrderBy(dbName,collectionName,query,max,offset,key1,OrderByType.ASCENDING);
Console.WriteLine("dbName is " + storage.GetDbName());
IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
for(int i=0;i <jsonDocList.Count;i++)
{   
	Console.WriteLine("objectId is " + jsonDocList[i].GetDocId());
	Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc());
}
$dbName = "<Enter_the_dbName>";  
$collectionName = "<Your_Collection_Name>";    
$key1 = "name";   
$value1 = "Nick";     
$key2 = "age";   
$value2 = 30;     
$max = 1;    
$offset = 30;    
$queryBuilder = new QueryBuilder();
$q1 = $queryBuilder->build($key1, $value1, Operator::EQUALS);  // Build query q1 for key1 equal to name and value1 equal to Nick
$q2 = $queryBuilder->build($key2, $value2, Operator::GREATER_THAN);  // Build query q2 for key2 equal to age and value2 equal to 30
$query = $queryBuilder->compoundOperator($q1, Operator::ORop, $q2);  	 
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object.	
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$storage = $storageService->findDocsWithQueryPagingOrderBy($dbName,$collectionName,$query,$max,$offset,$key2,OrderByType::ASCENDING);
print_r("dbName is " . $storage->getDbName());
print_r("Collection Name is :".$storage->getCollectionName());
$jsonDocList = $storage->getJsonDocList();
foreach( $jsonDocList as $jsonDoc )
{
	print_r("docId is : " . $jsonDoc->getDocId());
	print_r("jsonDocs is : " . $jsonDoc->getJsonDoc());
	print_r("updated at is : " . $jsonDoc->getUpdatedAt());
	print_r("created At is : " . $jsonDoc->getCreatedAt());
}
$jsonResponse = $storage->toString();
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>"; 
const char* key1 = "name";
const char* value1 = "Nick";
const char* key2 = "age";
const char* value2 = "30";
Query *query1 = QueryBuilder::BuildQuery(key1, value1, APP42_OP_EQUALS);
Query *query2 = QueryBuilder::BuildQuery(key2, value2, APP42_OP_GREATER_THAN_EQUALTO);
Query *query3 = QueryBuilder::CompoundOperator(query1, APP42_OP_OR, query2);
int max =2;
int offset = 0;
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->FindDocsWithQueryPagingOrderBy(dbName, collectionName,query3,max,offset,key1,APP42_ORDER_ASCENDING,this, app42callfuncND_selector(Sample_Class::onStorageRequestCompleted));

void Sample_Class::onStorageRequestCompleted(App42CallBack *sender, void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
Coming Soon
Coming Soon
Coming Soon 
String dbName = "<Enter_the_dbName>";  
String collectionName = "<Your_Collection_Name>";   
String key1 = "name";   
String value1 = "Nick";     
String key2 = "age";   
int value2 = 30;  
Integer max = new Integer(1);
Integer offset = new Integer(0);    
Query q1 = QueryBuilder.build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick
Query q2 = QueryBuilder.build(key2, value2, Operator.GREATER_THAN);	// Build query q2 for key2 equal to age and value2 equal to 30	 
Query query = QueryBuilder.compoundOperator(q1, Operator.OR, q2);   	 
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object.  
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.findDocsWithQueryPagingOrderBy(dbName,collectionName,query,max,offset,key1,OrderByType.ASCENDING);
System.out.println("dbName is " + storage.getDbName());

Vector JsonDocList = storage.getJsonDocList();   
for(int i=0;i < JsonDocList.size();i++)  
{ 
	Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i);  
	System.out.println("objectId is " + jsonDoc.getDocId());  
	System.out.println("CreatedAt is " + jsonDoc.getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDoc.getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDoc.getJsonDoc());  
}         
Update Document By Key Value WIth JSON String

Update target document using a key value search parameter. This key value pair will be searched in the JSON doc stored in the cloud and matching doc will be updated with the new value passed. For example, if you have an existing JSON document like “{"name":"Nick Carter","Company":"Shephertz Technologies"}” and you need to update this JSON document with the name with John Carter, then will you need to pass the JSON document with updated value like “{"name":"John Carter","Company":"Shephertz Technologies"}”.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc needs to be updated. key - Key to be searched for the target JSON doc. value - Value to be searched for the target JSON doc. jsonDoc - Complete JSON document with updated value.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
String jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.updateDocumentByKeyValue(dbName, collectionName, key, value, jsonDoc, new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
		System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
	} 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());	
}
});  
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
String jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.UpdateDocumentByKeyValue(dbName,collectionName,key,value,jsonDoc, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			Console.WriteLine("DocId is : " + jsonDocList[i].GetDocId());
			Console.WriteLine("JSONDoc is : " + jsonDocList[i].GetJsonDoc());
			Console.WriteLine("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			Console.WriteLine("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
		} 
	}  
}  
NSString *dbName = @"<Your_DataBase_Name>";
NSString *collectionName = @"<Your_Collection_Name>"; 
NSString *key = @"name"; 
NSString *value = @"Nick"; 
NSString *jsonDoc = @"{\"Company\":\"Shephertz Technologies\"}";
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService updateDocumentByKeyValue:dbName collectionName:collectionName key:key value:value newJsonDoc:jsonDoc completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Storage *storage =  (Storage*)responseObj;
		NSLog(@"dbName is %@" , storage.dbName);
		NSLog(@"collectionNameId is %@" ,  storage.collectionName);
		NSMutableArray *jsonDocArray = storage.jsonDocArray;               
		for(JSONDocument *jsonDoc in jsonDocArray) 
		{  
			NSLog(@"objectId is = %@ " , jsonDoc.docId);  
			NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); 
		}  
	}
	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 dbName = "<Your_DataBase_Name>"
let collectionName = "<Your_Collection_Name>"
let key = "name"
let value = "Nick"
let newJSONDoc = "{\"Company\":\"Shephertz Technologies\"}"
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")    
let storageService = App42API.buildStorageService() as? StorageService 
storageService?.updateDocumentByKeyValue(dbName, collectionName: collectionName, key: key, value: value, newJsonDoc: newJSONDoc, completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let storage = response as! Storage
		NSLog("dbName is : %@", storage.dbName)
		NSLog("collectionName is : %@", storage.collectionName)
		let jsonDocList = storage.jsonDocArray
		for jsonDoc in jsonDocList {
			NSLog("Docid is : %@",jsonDoc.docId)
			NSLog("CreatedAt is : %@",jsonDoc.createdAt)
			NSLog("UpdatedAt is : %@",jsonDoc.updatedAt)
			NSLog("JsonDoc is : %@",jsonDoc.jsonDoc)
		}
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
String jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.updateDocumentByKeyValue(dbName,collectionName,key,value,jsonDoc);  
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
for(int i=0;i<jsonDocList.size();i++)
{
	System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
	System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
}   
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
String jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.UpdateDocumentByKeyValue(dbName,collectionName,key,value,jsonDoc, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			App42Log.Console("objectId is " + jsonDocList[i].GetDocId());
			App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc());
		}  
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var dbName = "<Your_DataBase_Name>",
collectionName = "<Your_Collection_Name>",
key = "name",
value = "Nick",
jsonDoc = "{\"Company\":\"Shephertz Technologies\"}",
response ;  
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.updateDocumentByKeyValue(dbName,collectionName,key,value,jsonDoc,{  
	success: function(object) 
	{  
		var storageObj = JSON.parse(object);  
		response = storageObj.app42.response.storage;
		console.log("dbName is " + response.dbName)
	},  
	error: function(error) {  
	}  
}); 
local dbName  = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local key = "name"
local value = "Nick"
local jsonDoc = "{\"Company\":\"Shephertz Technologies\"}"
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:updateDocumentByKeyValue(dbName,collectionName,key,value,jsonDoc,App42CallBack)
function App42CallBack:onSuccess(object)
	print("dbName is "..object:getDbName())
		for i=1,table.getn(object:getJsonDocList()) do
			print("DocId is "..object:getJsonDocList()[i]:getDocId())
			print("CreatedAt is "..object:getJsonDocList()[i]:getCreatedAt())
		end
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>"; 
const char* key = "name";
const char* value = "Nick";
const char* jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->UpdateDocumentByKeyValue(dbName, collectionName, key, value, jsonDoc, app42callback(Sample_Class::onStorageRequestCompleted, this));

void Sample_Class::onStorageRequestCompleted(void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
String jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
Storage storage = storageService.UpdateDocumentByKeyValue(dbName,collectionName,key,value,jsonDoc);  
Console.WriteLine("dbName is " + storage.GetDbName());
IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
for(int i=0;i <jsonDocList.Count;i++)
{   
	Console.WriteLine("objectId is " + jsonDocList[i].GetDocId());
	Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc());
}
$dbName = "<Your_DataBase_Name>";
$collectionName = "<Your_Collection_Name>"; 
$key = "name"; 
$value = "Nick"; 
$jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$storage = $storageService->updateDocumentByKeyValue($dbName,$collectionName,$key,$value,$jsonDoc); 
print_r("dbName is " . $storage->getDbName());
print_r("Collection Name is :".$storage->getCollectionName());
$jsonDocList = $storage->getJsonDocList();
foreach( $jsonDocList as $jsonDoc )
{
	print_r("docId is : " . $jsonDoc->getDocId());
	print_r("jsonDocs is : " . $jsonDoc->getJsonDoc());
	print_r("updated at is : " . $jsonDoc->getUpdatedAt());
	print_r("created At is : " . $jsonDoc->getCreatedAt());
}
$jsonResponse = $storage->toString(); 
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>"; 
const char* key = "name";
const char* value = "Nick";
const char* jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->UpdateDocumentByKeyValue(dbName, collectionName, key, value, jsonDoc, this, app42callfuncND_selector(Sample_Class::onStorageRequestCompleted));

void Sample_Class::onStorageRequestCompleted(App42CallBack *sender, void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
Coming Soon
Not Available 
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
String jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.updateDocumentByKeyValue(dbName,collectionName,key,value,jsonDoc);  
System.out.println("dbName is " + storage.getDbName());

Vector JsonDocList = storage.getJsonDocList();   
for(int i=0;i < JsonDocList.size();i++)  
{ 
	Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i);  
	System.out.println("objectId is " + jsonDoc.getDocId());  
	System.out.println("CreatedAt is " + jsonDoc.getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDoc.getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDoc.getJsonDoc());
}         
Update Document By Key Value WIth JSON Object

Update target document using a key value search parameter. This key value pair will be searched in the JSON doc stored in the cloud and matching doc will be updated with new value passed. For example, if you have an existing JSON document like “{"name":"Nick Carter","Company":"Shephertz Technologies"}” and you need to update this JSON document with the name with John Carter, then will you need to pass the JSON document with updated value like “{"name":"John Carter","Company":"Shephertz Technologies"}”.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc needs to be updated. key - Key to be updated for the target JSON doc. value - Value to be updated for the target JSON doc. jsonDoc - JSON document with updated values.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
JSONObject jsonDoc = new JSONObject();
jsonDoc.put("name","John");
jsonDoc.put("age",20);
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.updateDocumentByKeyValue(dbName, collectionName, key, value, jsonDoc, new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
		System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
	} 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});   
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
JObject jsonDoc = new JObject();
jsonDoc.Add("name","John");
jsonDoc.Add("age",20);
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.UpdateDocumentByKeyValue(dbName,collectionName,key,value,jsonDoc, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			Console.WriteLine("DocId is : " + jsonDocList[i].GetDocId());
			Console.WriteLine("JSONDoc is : " + jsonDocList[i].GetJsonDoc());
			Console.WriteLine("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			Console.WriteLine("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
		}  
	}  
}  
NSString *dbName = @"<Your_DataBase_Name>";
NSString *collectionName = @"<Your_Collection_Name>"; 
NSString *key = @"name"; 
NSString *value = @"Nick";
NSDictionary *jsonDoc = [NSDictionary dictionaryWithObjectsAndKeys:@"John",@"name", nil];
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService updateDocumentByKeyValue:dbName collectionName:collectionName key:key value:value newDataDict:jsonDoc completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Storage *storage =  (Storage*)responseObj;
		NSLog(@"dbName is %@" , storage.dbName);
		NSLog(@"collectionNameId is %@" ,  storage.collectionName);
		NSMutableArray *jsonDocArray = storage.jsonDocArray;               
		for(JSONDocument *jsonDoc in jsonDocArray) 
		{  
			NSLog(@"objectId is = %@ " , jsonDoc.docId);  
			NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); 
		}  
	}
	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 dbName = "<Your_DataBase_Name>"
let collectionName = "<Your_Collection_Name>"
let key = "name"
let value = "Nick"
let newJSONDoc = ["name":"John"]
App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY")    
let storageService = App42API.buildStorageService() as? StorageService 
storageService?.updateDocumentByKeyValue(dbName, collectionName: collectionName, key: key, value: value, newDataDict: newJSONDoc, completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let storage = response as! Storage
		NSLog("dbName is : %@", storage.dbName)
		NSLog("collectionName is : %@", storage.collectionName)
		let jsonDocList = storage.jsonDocArray
		for jsonDoc in jsonDocList {
			NSLog("Docid is : %@",jsonDoc.docId)
			NSLog("CreatedAt is : %@",jsonDoc.createdAt)
			NSLog("UpdatedAt is : %@",jsonDoc.updatedAt)
			NSLog("JsonDoc is : %@",jsonDoc.jsonDoc)
		}
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
JSONObject jsonDoc = new JSONObject();
jsonDoc.put("name","John");
jsonDoc.put("age",20);
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.updateDocumentByKeyValue(dbName,collectionName,key,value,jsonDoc);  
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
for(int i=0;i<jsonDocList.size();i++)
{
	System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
	System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
}    
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
Dictionary<String, Object> jsonDoc = new Dictionary<String, Object>();
jsonDoc.Add("name","John");
jsonDoc.Add("age",20);
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.UpdateDocumentByKeyValue(dbName,collectionName,key,value,jsonDoc, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			App42Log.Console("objectId is " + jsonDocList[i].GetDocId());
			App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc());
		}  
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var dbName = "<Your_DataBase_Name>",
collectionName = "<Your_Collection_Name>",
key = "name",
value = "Nick",
response ;  
var jsonDoc = new Object();
jsonDoc.name = "John";
jsonDoc.type = "20";
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.updateDocumentByKeyValue(dbName,collectionName,key,value,jsonDoc,{  
success: function(object) 
	{  
		var storageObj = JSON.parse(object);
		console.log("dbName is :" +storageObj.app42.response.storage.dbName)
		response = storageObj.app42.response.storage.jsonDoc;
		if(response.length == undefined)  
		{			
			console.log(response._id.$oid)
			console.log(response._$createdAt)
			console.log(response._$updatedAt)
		}
	   for(var i=0;i<response.length;i++)  
	   {
			console.log(response[i])
			console.log(response[i]._id.$oid)
			console.log(response[i]._$createdAt)
			console.log(response[i]._$updatedAt)
	   }
	},  
	error: function(error) {  
	}  
}); 
local dbName  = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local key = "name"
local value = "Nick"
local jsonDoc = {}
jsonDoc.name = "John"
jsonDoc.age = 20
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:updateDocumentByKeyValue(dbName,collectionName,key,value,jsonDoc,App42CallBack)
function App42CallBack:onSuccess(object)
	print("dbName is "..object:getDbName())
		for i=1,table.getn(object:getJsonDocList()) do
			print("DocId is "..object:getJsonDocList()[i]:getDocId())
			print("CreatedAt is "..object:getJsonDocList()[i]:getCreatedAt())
		end
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
const char* key = "name";
const char* value = "Nick";
App42Object *object = new App42Object();
object->setObject("name", "John");
object->setObject("age", "20");
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->UpdateDocumentByKeyValue(dbName, collectionName, key, value, object, app42callback(Sample_Class::onStorageRequestCompleted, this));

void Sample_Class::onStorageRequestCompleted(void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick";  
Dictionary<String, Object> jsonDoc = new Dictionary<String, Object>();
jsonDoc.Add("name","John");
jsonDoc.Add("age",20);
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
Storage storage = storageService.UpdateDocumentByKeyValue(dbName,collectionName,key,value,jsonDoc);  
Console.WriteLine("dbName is :: " + storage.GetDbName());
IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
for(int i=0;i <jsonDocList.Count;i++)
{   
	Console.WriteLine("objectId is " + jsonDocList[i].GetDocId());
	Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc());
}
$dbName = "<Your_DataBase_Name>";
$collectionName = "<Your_Collection_Name>"; 
$key = "name"; 
$value = "Nick"; 
$jsonDoc = new JSONObject();
$jsonDoc->put("name","John");
$jsonDoc->put("age",20);
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$storage = $storageService->updateDocumentByKeyValue($dbName,$collectionName,$key,$value,$jsonDoc); 
print_r("dbName is " . $storage->getDbName());
print_r("Collection Name is :".$storage->getCollectionName());
$jsonDocList = $storage->getJsonDocList();
foreach( $jsonDocList as $jsonDoc )
{
	print_r("docId is : " . $jsonDoc->getDocId());
	print_r("jsonDocs is : " . $jsonDoc->getJsonDoc());
	print_r("updated at is : " . $jsonDoc->getUpdatedAt());
	print_r("created At is : " . $jsonDoc->getCreatedAt());
}
$jsonResponse = $storage->toString(); 
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
const char* key = "name";
const char* value = "Nick";
App42Object *object = new App42Object();
object->setObject("name", "John");
object->setObject("age", "20");
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->UpdateDocumentByKeyValue(dbName, collectionName, key, value, object, this, app42callfuncND_selector(Sample_Class::onStorageRequestCompleted));

void Sample_Class::onStorageRequestCompleted(App42CallBack *sender, void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
Not Available
var dbName:String  = "<Your_DataBase_Name>";
var collectionName:String = "<Your_Collection_Name>"; 
var key:String = "<Enter_the_key>"; 
var value:String = "<Enter_the_value>"; 
var jsonDoc:Object  = new Object();
jsonDoc.name = "John"; 
jsonDoc.age = 20; 
App42API.initialize("API_KEY","SECRET_KEY");
var storageService:StorageService = App42API.buildStorageService(); 
storageService.updateDocumentByKeyValueWithJsonObject(dbName,collectionName,key,value ,jsonDoc ,new callback());	
class callback implements App42CallBack  
{  
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}  
	public function onSuccess(response:Object):void  
	{  
		var storage:Storage = Storage(response);
		var jsonDoc:JSONDocument = new JSONDocument(); 
		trace("dbName is " + storage.getDbName());
		trace("Collection Name is :  " + storage.getCollectionName());
		var jsonDocsList:Array = storage.getJsonDocList();
		for(var i:int=0; i < jsonDocsList.length;i++)
		{
			jsonDoc = JSONDocument(jsonDocsList[i]);
			trace("Docid is : " + jsonDoc.getDocId());
			trace("CreatedAt is : " + jsonDoc.getCreatedAt());
			trace("UpdatedAt is :  " + jsonDoc.getUpdatedAt());
			trace("JsonDoc is :  " + jsonDoc.getJsonDoc());
		}
	}  
}
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
JSONObject jsonDoc = new JSONObject();
jsonDoc.put("name","John");
jsonDoc.put("age",20);
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.updateDocumentByKeyValue(dbName,collectionName,key,value,jsonDoc);  
System.out.println("dbName is " + storage.getDbName());

Vector JsonDocList = storage.getJsonDocList();   
for(int i=0;i < JsonDocList.size();i++)  
{ 
	Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i);  
	System.out.println("objectId is " + jsonDoc.getDocId());  
	System.out.println("CreatedAt is " + jsonDoc.getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDoc.getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDoc.getJsonDoc()); 
}         
Update Document By Doc Id With JSON String

Update target document using the document ID. For example, if you have an existing JSON document like “{"name":"Nick Carter","Company":"Shephertz Technologies"}” and you need to update this JSON document with the name with John Carter, then will you need to pass the JSON document with updated value like “{"name":"John Carter","Company":"Shephertz Technologies"}”.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc needs to be updated. docId - ID of the document to be updated for the target JSON doc. jsonDoc - Complete Json document with updated values.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
String jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.updateDocumentByDocId(dbName, collectionName, docId, jsonDoc, new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
	for(int i=0;i<jsonDocList.size();i++)
	{
	System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
	System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
	} 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});  
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
String jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.UpdateDocumentByDocId(dbName,collectionName,docId,jsonDoc, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			Console.WriteLine("DocId is : " + jsonDocList[i].GetDocId());
			Console.WriteLine("JSONDoc is : " + jsonDocList[i].GetJsonDoc());
			Console.WriteLine("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			Console.WriteLine("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
		}  
	}  
}  
NSString *dbName = @"<Your_DataBase_Name>";
NSString *collectionName = @"<Your_Collection_Name>"; 
String *docId = @"docId";
NSString *jsonDoc = @"{\"Company\":\"Shephertz Technologies\"}";
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService updateDocumentByDocId:dbName collectionName:collectionName docId:docId newJsonDoc:jsonDoc completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Storage *storage =  (Storage*)responseObj;
		NSLog(@"dbName is %@" , storage.dbName);
		NSLog(@"collectionNameId is %@" ,  storage.collectionName);
		NSMutableArray *jsonDocArray = storage.jsonDocArray;               
		for(JSONDocument *jsonDoc in jsonDocArray) 
		{  
			NSLog(@"objectId is = %@ " , jsonDoc.docId);  
			NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); 
		}  
	}
	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 dbName = "<Your_DataBase_Name>"
let collectionName = "<Your_Collection_Name>"
let docId =  "docId"
let newJSONDoc = "{\"Company\":\"Shephertz Technologies\"}"
App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY")    
let storageService = App42API.buildStorageService() as? StorageService 
storageService?.updateDocumentByDocId(dbName, collectionName: collectionName, docId:docId as String, newJsonDoc:newJSONDoc, completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let storage = response as! Storage
		NSLog("dbName is : %@", storage.dbName)
		NSLog("collectionName is : %@", storage.collectionName)
		let jsonDocList = storage.jsonDocArray
		for jsonDoc in jsonDocList {
			NSLog("Docid is : %@",jsonDoc.docId)
			NSLog("CreatedAt is : %@",jsonDoc.createdAt)
			NSLog("UpdatedAt is : %@",jsonDoc.updatedAt)
			NSLog("JsonDoc is : %@",jsonDoc.jsonDoc)
		}
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
String jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.updateDocumentByDocId(dbName,collectionName,docId,jsonDoc);  
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
for(int i=0;i<jsonDocList.size();i++)
{
	System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
	System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
}    
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
String jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.UpdateDocumentByDocId(dbName, collectionName, docId, jsonDoc, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			App42Log.Console("objectId is " + jsonDocList[i].GetDocId());
			App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc());
			App42Log.Console("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			App42Log.Console("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
		}  
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var dbName = "<Your_DataBase_Name>",
collectionName = "<Your_Collection_Name>",
docId = "docId",
jsonDoc = "{\"Company\":\"Shephertz Technologies\"}",
response ;  
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.updateDocumentByDocId(dbName,collectionName,docId,jsonDoc,{  
	success: function(object) 
	{  
		var storageObj = JSON.parse(object);  
		response = storageObj.app42.response.storage;
		console.log("dbName is " + response.dbName)
	},  
	error: function(error) {  
	}  
}); 
local dbName  = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local docId = "docId"
local jsonDoc = "{\"Company\":\"Shephertz Technologies\"}"
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:updateDocumentByDocId(dbName,collectionName,docId,jsonDoc,App42CallBack)
function App42CallBack:onSuccess(object)
	print("dbName is "..object:getDbName())
	print("DocId is "..object:getJsonDocList():getDocId())
	print("CreatedAt is "..object:getJsonDocList():getCreatedAt())
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* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
const char* docId = "docId";
const char* jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->UpdateDocumentByDocId(dbName, collectionName, docId, jsonDoc, app42callback(Sample_Class::onStorageRequestCompleted, this));

void Sample_Class::onStorageRequestCompleted(void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
String jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
Storage storage = storageService.UpdateDocumentByDocId(dbName,collectionName,docId,jsonDoc);  
Console.WriteLine("dbName is " + storage.GetDbName());
IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
for(int i=0;i <jsonDocList.Count;i++)
{   
	Console.WriteLine("objectId is " + jsonDocList[i].GetDocId());
	Console.WriteLine("JSONDoc is : " + jsonDocList[i].GetJsonDoc());
	Console.WriteLine("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
	Console.WriteLine("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
}  
$dbName = "<Your_DataBase_Name>";
$collectionName = "<Your_Collection_Name>";
$docId = "docId";
$jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$storage = $storageService->updateDocumentByDocId($dbName,$collectionName,$docId,$jsonDoc); 
print_r("dbName is " . $storage->getDbName());
print_r("Collection Name is :".$storage->getCollectionName());
$jsonDocList = $storage->getJsonDocList();
foreach( $jsonDocList as $jsonDoc )
{
	print_r("docId is : " . $jsonDoc->getDocId());
	print_r("jsonDocs is : " . $jsonDoc->getJsonDoc());
	print_r("updated at is : " . $jsonDoc->getUpdatedAt());
	print_r("created At is : " . $jsonDoc->getCreatedAt());
}
$jsonResponse = $storage->toString(); 
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
const char* docId = "docId";
const char* jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->UpdateDocumentByDocId(dbName, collectionName, docId, jsonDoc, this, app42callfuncND_selector(Sample_Class::onStorageRequestCompleted));

void Sample_Class::onStorageRequestCompleted(App42CallBack *sender, void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
Coming Soon
Not Available
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
String jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.updateDocumentByDocId(dbName,collectionName,docId,jsonDoc);  
System.out.println("dbName is " + storage.getDbName());
Vector JsonDocList = storage.getJsonDocList();   
for(int i=0;i < JsonDocList.size();i++)  
{ 
	Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i);  
	System.out.println("objectId is " + jsonDoc.getDocId());  
	System.out.println("CreatedAt is " + jsonDoc.getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDoc.getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDoc.getJsonDoc()); 
}         
Delete Document By Doc ID

Delete target document using Object ID from the given database and collection. The Object ID will be searched in the JSON doc stored in the cloud and matching doc will be deleted.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc needs to be deleted. docId - Unique Object ID handler.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.deleteDocumentById(dbName, collectionName, docId, 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 dbName = "<Enter_the_dbName>"; 
String collectionName = "<Your_Collection_Name>";  
String docId = "docId";
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.DeleteDocumentById(dbName,collectionName,docId, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		App42Response success = (App42Response) response;     
		String jsonResponse = success.ToString();  
	}  
}  
NSString *dbName = @"<Enter_the_dbName>"; 
NSString *collectionName = @"<Your_Collection_Name>";  
String *docId = @"docId";
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService deleteDocumentById:dbName collectionName:collectionName docId:docId completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{	
	if (success)
	{
		App42Response *response = (App42Response*)responseObj;
		NSString *success = response.isResponseSuccess;
		NSString *jsonResponse = [response toString];        
	}
	else
	{
		NSLog(@"Exception = %@",[exception reason]);
		NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
		NSLog(@"App Error Code = %d",[exception appErrorCode]);
		NSLog(@"User Info = %@",[exception userInfo]);
	}
}];                          
let dbName = "<Your_DataBase_Name>"
let collectionName = "<Your_Collection_Name>"
let docId =  "docId"
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")    
let storageService = App42API.buildStorageService() as? StorageService 
storageService?.deleteDocumentById(dbName, collectionName: collectionName, docId:docId as String, completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let app42Response = response as! App42Response
		NSLog("App42Response is : %@", app42Response.strResponse)
		NSLog("IsResponseSuccess : %@", app42Response.isResponseSuccess)
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
App42Response app42response = storageService.deleteDocumentById(dbName,collectionName,docId);
System.out.println("response is " + app42response) ;  
boolean  success = app42response.isResponseSuccess();
String jsonResponse = app42response.toString(); 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.DeleteDocumentById(dbName, collectionName, docId, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		App42Response success = (App42Response) response;     
		String jsonResponse = success.ToString();  
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var dbName = "<Your_DataBase_Name>",
collectionName = "<Your_Collection_Name>",
docId = "docId",
response ;  
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.deleteDocumentById(dbName,collectionName,docId,{  
	success: function(object) 
	{  
		var storageObj = JSON.parse(object);  
		response = storageObj.app42.response.storage;
		console.log("dbName is " + response.dbName)
	},  
	error: function(error) {  
	}  
}); 
local dbName  = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local docId = "docId"
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:deleteDocumentById(dbName,collectionName,docId,App42CallBack)
function App42CallBack:onSuccess(object)
	print(object:getResponseSuccess())
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* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
const char* docId = "docId";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->DeleteDocumentsById(dbName, collectionName,docId,app42callback(Sample_Class::onStorageRequestCompleted, this));

void Sample_Class::onStorageRequestCompleted(void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
App42Response response = storageService.DeleteDocumentById(dbName,collectionName,docId); 
Boolean  success = response.IsResponseSuccess();
String jsonResponse = response.ToString(); 
$dbName = "<Your_DataBase_Name>";
$collectionName = "<Your_Collection_Name>"; 
$docId = "docId";
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$response = $storageService->deleteDocumentById($dbName,$collectionName,$docId); 
print_r("Response is : ".$storage->toString());
$success = $respons->isResponseSuccess();
$jsonResponse = $respons->toString(); 
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
const char* docId = "docId";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->DeleteDocumentsById(dbName, collectionName,docId,this, app42callfuncND_selector(Sample_Class::onStorageRequestCompleted));

void Sample_Class::onStorageRequestCompleted(App42CallBack *sender, void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
Coming Soon
var dbName:String = "<Your_DataBase_Name>";
var collectionName:String = "<Your_Collection_Name>"; 
var docId:String = "docId";
App42API.initialize("API_KEY","SECRET_KEY");
var storageService:StorageService = App42API.buildStorageService(); 
storageService.deleteDocumentById(dbName,collectionName,docId,new callback());  
public class callback implements App42CallBack  
{  
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
	public function onSuccess(response:Object):void  
	{  
		var storage:Storage = Storage(response); 
		trace("response is : " + storage);
	}  
}  
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
App42Response response = storageService.deleteDocumentById(dbName,collectionName,docId);
System.out.println("response is " + response) ;   
boolean  success = response.isResponseSuccess();
String jsonResponse = response.toString(); 
Insert JSON Doc Using Map

Save the JSON document in giving database name and collection name. It accepts the HashMap containing key value and converts it into JSON. Converted JSON doc further is saved in the cloud using given database name and collection name.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc has to be saved. map - HashMap containing key value pairs.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
HashMap<String, String> map = new HashMap< String, String >();
map.put("Company", "Shephertz");					
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.insertJsonDocUsingMap(dbName, collectionName, map ,new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
		System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
	} 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});    
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
Dictionary<String, String> map = new Dictionary<String, String>();
map.Add("Company", "Shephertz");
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.InsertJsonDocUsingMap(dbName, collectionName, map, new Callback());
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Storage storage = (Storage) response;
		Console.WriteLine("dbName is " + storage.GetDbName());
		Console.WriteLine("collection Name is " + storage.GetCollectionName());
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList();            
		for(int i=0; i<jsonDocList.Count; i++)
		{
			Console.WriteLine("objectId is " + jsonDocList[i].GetDocId());  
			Console.WriteLine("CreatedAt is " + jsonDocList[i].GetCreatedAt());  
			Console.WriteLine("UpdatedAtis " + jsonDocList[i].GetUpdatedAt());  
			Console.WriteLine("Jsondoc is " + jsonDocList[i].GetJsonDoc());  
		} 		
		String jsonResponse = storage.ToString();  
	}  
}  
NSString *dbName = @"<Your_DataBase_Name>";
NSString *collectionName = @"<Your_Collection_Name>"; 
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
[dict setObject:@"Shephertz" forKey:@"Company"];
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService insertJsonDocUsingMap:dbName collectionName:collectionName map:dict completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Storage *storage =  (Storage*)responseObj;
		NSLog(@"dbName is %@" , storage.dbName);
		NSLog(@"collectionNameId is %@" ,  storage.collectionName);
	}
	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 dbName = "<Your_DataBase_Name>"
let collectionName = "<Your_Collection_Name>"
let map = NSMutableDictionary()
map["Company"] = "Shephertz"
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")    
let storageService = App42API.buildStorageService() as? StorageService 
storageService?.insertJsonDocUsingMap(dbName, collectionName: collectionName, map:map, completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let storage = response as! Storage
		NSLog("dbName is : %@", storage.dbName)
		NSLog("collectionName is : %@", storage.collectionName)
		let jsonDocList = storage.jsonDocArray
		for jsonDoc in jsonDocList {
			NSLog("Docid is : %@",jsonDoc.docId)
			NSLog("CreatedAt is : %@",jsonDoc.createdAt)
			NSLog("UpdatedAt is : %@",jsonDoc.updatedAt)
			NSLog("JsonDoc is : %@",jsonDoc.jsonDoc)
		}
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
HashMap< String, String > map = new HashMap< String, String >();
map.put("Company", "Shephertz");					
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.insertJsonDocUsingMap(dbName,collectionName,map);  
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
for(int i=0;i<jsonDocList.size();i++)
{
	System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
	System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
} 
String jsonResponse = storage.toString();        
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
Dictionary< String, String > map = new Dictionary< String, String >();
map.Add("Company", "Shephertz");
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.InsertJsonDocUsingMap(dbName,collectionName,map, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		App42Log.Console("Success : " + response);
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
Not Available       
Coming Soon
Coming Soon
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
Dictionary< String, String > map = new Dictionary< String, String >();
map.Add("Company", "Shephertz");
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
Storage storage = storageService.InsertJsonDocUsingMap(dbName,collectionName,map);  
Console.WriteLine("dbName is " + storage.GetDbName());
Console.WriteLine("Collection Name is " + storage.GetCollectionName());
String jsonResponse = storage.ToString();        
$dbName = "<Your_DataBase_Name>";
$collectionName = "<Your_Collection_Name>"; 
$map = array("Company" => "Shephertz");						
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$storage = $storageService->insertJsonDocUsingMap($dbName, $collectionName,$map);  
print_r("dbName is " . $storage->getDbName());
print_r("Collection Name is " . $storage->getCollectionName());
$jsonResponse = $storage->toString(); 
Coming Soon
Coming Soon
Coming Soon
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
Hashtable map = new Hashtable();
map.put("Company", "Shephertz");					
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.insertJsonDocUsingMap(dbName,collectionName,map);  
System.out.println("dbName is " + storage.getDbName());
Vector JsonDocList = storage.getJsonDocList();   
for(int i=0;i < JsonDocList.size();i++)  
{ 
	Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i);  
	System.out.println("objectId is " + jsonDoc.getDocId());  
	System.out.println("CreatedAt is " + jsonDoc.getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDoc.getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDoc.getJsonDoc()); 
}         
String jsonResponse = storage.toString();     
Map Reduce

Map reduce function to search the target document. Please see detailed information on mapReduce http://en.wikipedia.org/wiki/MapReduce

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc needs to be searched. mapFunction - Map function to be used to search the document. reduceFunction - Reduce function to be used to search the document.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String mapFunction = "function map(){ emit(this.user,1);}";
String reduceFunction = "function reduce(key, val){var sum = 0; for(var n=0;n< val.length;n++){ sum = sum + val[n]; } return sum;}";		 
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.mapReduce(dbName, collectionName, mapFunction, reduceFunction, new App42CallBack() {
public void onSuccess(Object response) 
{
	String  storage  = (String )response;
	System.out.println(storage);
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String mapFunction = "function map(){ emit(this.user,1);}";
String reduceFunction = "function reduce(key, val){var sum = 0; for(var n=0;n< val.length;n++){ sum = sum + val[n]; } return sum;}";		 
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.MapReduce(dbName, collectionName, mapFunction, reduceFunction,new Callback());
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		String storage = (String) response;  
		Console.WriteLine("Response Is :: " + storage); 
	}  
}  
NSString *dbName = @"<Your_DataBase_Name>";
NSString *collectionName = @"<Your_Collection_Name>"; 
NSString *mapFunction = @"function map(){ emit(this.user,1);}";
NSString *reduceFunction = @"function reduce(key, val){var sum = 0; for(var n=0;n< val.length;n++){ sum = sum + val[n]; } return sum;}";		 
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService mapReduce:dbName collectionName:collectionName mapFunction:mapFunction reduceFunction:reduceFunction completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		NSString *response = (NSString*)responseObj;
		NSLog(@"Response is %@" , response);
	}
	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 dbName = "<Your_DataBase_Name>"
let collectionName = "<Your_Collection_Name>"
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")    
let storageService = App42API.buildStorageService() as? StorageService 
let mapFunction = "function map(){ emit(this.user,1);}"
let reduceFunction = "function reduce(key, val){var sum = 0; for(var n=0;n< val.length;n++){ sum = sum + val[n]; } return sum;}"
storageService?.mapReduce(dbName, collectionName: collectionName, mapFunction:mapFunction , reduceFunction:reduceFunction, completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let app42Response = response as! NSString
		NSLog("app42Response is %@", app42Response)
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String mapFunction = "function map(){ emit(this.user,1);}";
String reduceFunction = "function reduce(key, val){var sum = 0; for(var n=0;n< val.length;n++){ sum = sum + val[n]; } return sum;}";		 
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
String storage = storageService.mapReduce(dbName, collectionName, mapFunction, reduceFunction);  
System.out.println(storage);
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String mapFunction = "function map(){ emit(this.user,1);}";
String reduceFunction = "function reduce(key, val){var sum = 0; for(var n=0;n< val.length;n++){ sum = sum + val[n]; } return sum;}";	
App42Log.SetDebug(true);		//Print output in your editor console	 
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.MapReduce(dbName, collectionName, mapFunction, reduceFunction, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		App42Log.Console("Success : " + response);
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
Not Available      
Coming Soon
Coming Soon
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String mapFunction = "function map(){ emit(this.user,1);}";
String reduceFunction = "function reduce(key, val){var sum = 0; for(var n=0;n< val.length;n++){ sum = sum + val[n]; } return sum;}";		 
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
String response = storageService.MapReduce(dbName, collectionName, mapFunction, reduceFunction);
$dbName = "<Your_DataBase_Name>";
$collectionName = "<Your_Collection_Name>"; 
$mapFunction = "function map(){ emit(this.user,1);}";
$reduceFunction = "function reduce(key, val){var sum = 0; for(var n=0;n< val.length;n++){ sum = sum + val[n]; } return sum;}";
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$response = $storageService-> mapReduce($dbName, $collectionName, $mapFunction, $reduceFunction);
Coming Soon
Coming Soon
Coming Soon
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String mapFunction = "function map(){ emit(this.user,1);}";
String reduceFunction = "function reduce(key, val){var sum = 0; for(var n=0;n< val.length;n++){ sum = sum + val[n]; } return sum;}";		 
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
String response = storageService.mapReduce(dbName, collectionName, mapFunction, reduceFunction);  
System.out.println(response);
Delete All Documents

Delete all documents from selected database and collectionName.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection in which the documents need to be searched.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.deleteAllDocuments(dbName, collectionName, 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 dbName = "<Enter_the_dbName>"; 
String collectionName = "<Your_Collection_Name>";  
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.DeleteAllDocuments(dbName, collectionName, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{ 
		App42Response success = (App42Response) response;     
		String jsonResponse = success.ToString();  
	}  
} 
NSString *dbName = @"<Enter_the_dbName>"; 
NSString *collectionName = @"<Your_Collection_Name>";  
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService deleteAllDocuments:dbName collectionName:collectionName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{	
	if (success)
	{
		App42Response *response = (App42Response*)responseObj;
		NSString *success = response.isResponseSuccess;
		NSString *jsonResponse = [response toString];        
	}
	else
	{
		NSLog(@"Exception = %@",[exception reason]);
		NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
		NSLog(@"App Error Code = %d",[exception appErrorCode]);
		NSLog(@"User Info = %@",[exception userInfo]);
	}
}];
let dbName = "<Your_DataBase_Name>"
let collectionName = "<Your_Collection_Name>"
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")    
let storageService = App42API.buildStorageService() as? StorageService 
storageService?.deleteAllDocuments(dbName, collectionName: collectionName, completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let app42Response = response as! NSString
		NSLog("app42Response is %@", app42Response)
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
App42Response app42response = storageService.deleteAllDocuments(dbName,collectionName);
System.out.println("response is " + app42response) ; 
boolean success = app42response.isResponseSuccess();
String jsonResponse = app42response.toString();
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.DeleteAllDocuments(dbName,collectionName, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		App42Response success = (App42Response) response;     
		String jsonResponse = success.ToString();  
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var dbName = "<Your_DataBase_Name>",
collectionName = "<Your_Collection_Name>",
response; 
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.deleteAllDocuments(dbName, collectionName,{  
success: function(object) 
	{  
		var storageObj = JSON.parse(object);  
		response = storageObj.app42.response.storage;
		console.log("dbName is " + response.dbName);
	},  
	error: function(error) {  
	}  
});
local dbName  = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:deleteAllDocuments(dbName,collectionName,App42CallBack)
function App42CallBack:onSuccess(object)
	print(object:getResponseSuccess())
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* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->DeleteAllDocuments(dbName, collectionName,app42callback(Sample_Class::onStorageRequestCompleted, this));
void Sample_Class::onStorageRequestCompleted(void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
App42Response response = storageService.DeleteAllDocuments(dbName,collectionName);
Boolean response = response.IsResponseSuccess();
String jsonResponse = response.ToString();
$dbName = "<Your_DataBase_Name>";
$collectionName = "<Your_Collection_Name>"; 
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$storage = $storageService->deleteAllDocuments($dbName, $collectionName);
print_r("Response is : ".$storage->toString());
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->DeleteAllDocuments(dbName, collectionName,this, app42callfuncND_selector(Sample_Class::onStorageRequestCompleted));
void Sample_Class::onStorageRequestCompleted(App42CallBack *sender, void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
Coming Soon
var dbName:String = "<Your_DataBase_Name>";
var collectionName:String = "<Your_Collection_Name>"; 
App42API.initialize("API_KEY","SECRET_KEY");
var storageService:StorageService = App42API.buildStorageService(); 
storageService.deleteAllDocuments(dbName,collectionName,new callback()); 
public class callback implements App42CallBack  
{   
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
	public function onSuccess(response:Object):void  
	{  
		var storage:Storage = Storage(response); 
		trace("response is : " + storage);
	}  
}  
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
App42Response response = storageService.deleteAllDocuments(dbName,collectionName);
System.out.println("response is " + response) ; 
boolean response = response.isResponseSuccess();
String jsonResponse = response.toString();
Find Documents By Location

Find target documents using Custom Geo Query.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which the documents need to be searched. Query - Query Object containing custom Geo query for searching docs.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
GeoTag gp = new GeoTag();
gp.setLat(new BigDecimal(29.685693));
gp.setLng(new BigDecimal(76.990482));
storageService.setGeoTag(gp);
GeoQuery query = QueryBuilder.buildGeoQuery(gp, GeoOperator.NEAR, new BigDecimal(100));
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.findDocumentsByLocation(dbName, collectionName, query, new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
		System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
	} 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());	
}
});   
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
GeoTag gp = new GeoTag();
gp.SetLat(-73.99171);
gp.SetLng(40.738868);
storageService.SetGeoTag(gp);
GeoQuery query = QueryBuilder.BuildGeoQuery(gp, GeoOperator.NEAR, new BigDecimal(100));
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.FindDocumentsByLocation(dbName, collectionName, query, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Storage storage = (Storage) response;
		Console.WriteLine("dbName is " + storage.GetDbName());
		Console.WriteLine("collection Name is " + storage.GetCollectionName());
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			Console.WriteLine("DocId is : " + jsonDocList[i].GetDocId());
			Console.WriteLine("JSONDoc is : " + jsonDocList[i].GetJsonDoc());
			Console.WriteLine("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			Console.WriteLine("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
		} 
	}  
}  
NSString *dbName = @<Your_DataBase_Name>";
NSString *collectionName = @"Your_Collection_Name";
GeoTag *geoTag = [[GeoTag alloc] initWithLatitude:2.0 andLongitude:20.0];
storageService.geoTag = [geoTag toString];
GeoQuery *query = [QueryBuilder buildGeoQueryWithTag:geoTag andOperator:APP42_OP_NEAR maxDistance:10];
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService findDocumentsByLocation:dbName collectionName:collectionName geoQuery:query completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Storage *storage =  (Storage*)responseObj;
		NSLog(@"dbName is %@" , storage.dbName);
		NSLog(@"collectionNameId is %@" ,  storage.collectionName);
		NSMutableArray *jsonDocArray = storage.jsonDocArray;               
		for(JSONDocument *jsonDoc in jsonDocArray) 
		{  
			NSLog(@"objectId is = %@ " , jsonDoc.docId);  
			NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); 
			NSLog(@"Loc=(%lf, %lf)",jsonDoc.loc.lat,jsonDoc.loc.lng);
		}  
	}
	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 dbName = "<Your_DataBase_Name>"
let collectionName = "<Your_Collection_Name>"
let geoQuery = "";
App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")    
let storageService = App42API.buildStorageService() as? StorageService 
storageService?.findDocumentsByLocation(dbName, collectionName: collectionName, geoQuery: geoQuery, completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let storage = response as! Storage
		NSLog("dbName is : %@", storage.dbName)
		NSLog("collectionName is : %@", storage.collectionName)
		let jsonDocList = storage.jsonDocArray
		for jsonDoc in jsonDocList {
			NSLog("Docid is : %@",jsonDoc.docId)
			NSLog("CreatedAt is : %@",jsonDoc.createdAt)
			NSLog("UpdatedAt is : %@",jsonDoc.updatedAt)
			NSLog("JsonDoc is : %@",jsonDoc.jsonDoc)
		}
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
GeoTag gp = new GeoTag();
gp.setLat(new BigDecimal(29.685693));
gp.setLng(new BigDecimal(76.990482));
storageService.setGeoTag(gp);
GeoQuery query = QueryBuilder.buildGeoQuery(gp, GeoOperator.NEAR, new BigDecimal(100));
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage =storageService.findDocumentsByLocation(dbName, collectionName, query);
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
for(int i=0;i<jsonDocList.size();i++)
{
	System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
	System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
}   
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
GeoTag gp = new GeoTag();
gp.SetLat(-73.99171);
gp.SetLng(40.738868);
storageService.SetGeoTag(gp);
GeoQuery query = QueryBuilder.BuildGeoQuery(gp, GeoOperator.NEAR, new BigDecimal(100));
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.FindDocumentsByLocation(dbName, collectionName, query, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			App42Log.Console("objectId is " + jsonDocList[i].GetDocId());
			App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc());
		}  
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var dbName = "<Your_DataBase_Name>",
collectionName = "<Your_Collection_Name>",
response;
var gp = new GeoTag();
gp.setLat(-73.1234)
gp.setLng(-26.1234)
storageService.setGeoTag(gp);
var queryBuilder = new QueryBuilder();
var build = queryBuilder.buildGeoQuery(gp, GeoOperator.NEAR, 100);
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.findDocumentsByQuery(dbName, collectionName, build,{
	success: function(object) {
	var storageObj = JSON.parse(object);		
	response = storageObj.app42.response.storage.jsonDoc;
		if(response.length == undefined)  
		{
			console.log(response.loc)
			console.log(response._id.$oid)
			console.log(response._$createdAt)
			console.log(response._$updatedAt)
		}
	   for(var i=0;i<response.length;i++)  
		{
			console.log(response[i].loc)
			console.log(response[i]._id.$oid)
			console.log(response[i]._$createdAt)
			console.log(response[i]._$updatedAt)
		}
	},
	error: function(error1) {
		console.log(error1)
	}		
}); 
local dbName  = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local gp = require("App42-Lua-API.GeoTag")
gp:setLat(-73.99171)
gp:setLng(40.738868)
storageService:setGeoTag(gp);
local query = QueryBuilder:buildGeoQuery(gp, GeoOperator.NEAR, 100)
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:findDocumentsByLocation(dbName, collectionName, query,App42CallBack)
function App42CallBack:onSuccess(object)
	print("dbName is "..object:getDbName		
	for i=1,table.getn(object:getJsonDocList()) do
			print("DocId is "..object:getJsonDocList()[i]:getDocId())
			print("CreatedAt is "..object:getJsonDocList()[i]:getCreatedAt())
	end
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
Coming Soon
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>";  
GeoTag gp = new GeoTag();
gp.SetLat(-73.99171);
gp.SetLng(40.738868);
storageService.SetGeoTag(gp);
GeoQuery query = QueryBuilder.BuildGeoQuery(gp, GeoOperator.NEAR, new BigDecimal(100));
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
Storage storage =storageService.FindDocumentsByLocation(dbName, collectionName, query);
Console.WriteLine("dbName is " + storage.GetDbName());
IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
for(int i=0;i <jsonDocList.Count;i++)
{   
	Console.WriteLine("objectId is " + jsonDocList[i].GetDocId());
	Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc());
}
$dbName = "<Your_DataBase_Name>";
$collectionName = "<Your_Collection_Name>"; 
$gp = new GeoTag();
$gp->setLat(-73.99171);
$gp->setLng(40.738868);
$storageService->setGeoTag($gp);
$queryBuilder = new QueryBuilder();
$query = $queryBuilder->buildGeoQuery($gp, GeoOperator::NEAR, 100);
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$storage = $storageService->findDocumentsByLocation($dbName, $collectionName, $query);
print_r("dbName is " . $storage->getDbName());
print_r("Collection Name is :".$storage->getCollectionName());
$jsonDocList = $storage->getJsonDocList();
foreach( $jsonDocList as $jsonDoc )
{
	print_r("docId is : " . $jsonDoc->getDocId());
	print_r("jsonDocs is : " . $jsonDoc->getJsonDoc());
	print_r("updated at is : " . $jsonDoc->getUpdatedAt());
	print_r("created At is : " . $jsonDoc->getCreatedAt());
	print_r("Lat is ".$jsonDoc->getLocation()->getLat());
	print_r("Lng is ".$jsonDoc->getLocation()->getLng());
} 
Coming Soon
Coming Soon
var dbName:String = "<Your_DataBase_Name>";
var collectionName:String = "<Your_Collection_Name>"; 
var gp:GeoTag = new GeoTag();
gp.setLat(-73.99171);
gp.setLng(40.738868);
storageService.setGeoTag(gp);
var query:GeoQuery = QueryBuilder.buildGeoQuery(gp, GeoOperator.NEAR, 100);
App42API.initialize("API_KEY","SECRET_KEY");
var storageService:StorageService = App42API.buildStorageService(); 
storageService.findDocumentsByLocation(dbName, collectionName, query,new callback());
public class callback implements App42CallBack  
{  
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
	public function onSuccess(response:Object):void  
	{  
		var storage:Storage = Storage(response);
		trace("dbName is : " + storage.getDbName());
		trace("collectionName is : " + storage.getCollectionName());
		var jsonDocsList:Array = storage.getJsonDocList();
		for(var i:int=0; i < jsonDocsList.length;i++)
		{
			jsonDoc = JSONDocument(jsonDocsList[i]);
			trace("Docid is : " + jsonDoc.getDocId());
			trace("CreatedAt is : " + jsonDoc.getCreatedAt());
			trace("UpdatedAt is :  " + jsonDoc.getUpdatedAt());
			trace("JsonDoc is :  " + jsonDoc.getJsonDoc());
			if(jsonDoc.getLocation()!=null)
			{
				trace("Lat is : " + jsonDoc.getLocation().getLat());
				trace("Lng is : " + jsonDoc.getLocation().getLng());
			}
		}
	}  
}  
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
GeoTag gp = new GeoTag();
gp.setLat(new Double(-74.2713));  
gp.setLng(new Double(40.73137));  
storageService.setGeoTag(gp);
GeoQuery query = QueryBuilder.buildGeoQuery(gp, GeoOperator.NEAR, new BigDecimal(100));
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage =storageService.findDocumentsByLocation(dbName, collectionName, query);
System.out.println("dbName is " + storage.getDbName());
Vector JsonDocList = storage.getJsonDocList();   
for(int i=0;i < JsonDocList.size();i++)  
{ 
	Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i);  
	System.out.println("objectId is " + jsonDoc.getDocId());  
	System.out.println("CreatedAt is " + jsonDoc.getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDoc.getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDoc.getJsonDoc());
}         
Delete Documents By Key Value

Delete target document using key and value from the given database and collection. The key value will be searched in the JSON doc stored in the cloud and matching value will be deleted.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc needs to be deleted. key - Key to be searched for target JSON document which has to be deleted. value - Value to be searched for target JSON document which has to be deleted.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"
String key = "name"; 
String value = "Nick"; 	
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.deleteDocumentsByKeyValue(dbName, collectionName, key, value, 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 dbName = "<Enter_the_dbName>"; 
String collectionName = "<Your_Collection_Name>";  
String key = "name"; 
String value = "Nick"; 	
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.DeleteDocumentsByKeyValue(dbName, collectionName, key, value, new Callback());  
new Callback()


public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		App42Response success = (App42Response) response;     
		String jsonResponse = success.ToString();  
	}  
}
NSString *dbName = @"<Enter_the_dbName>"; 
NSString *collectionName = @"<Your_Collection_Name>";  
NSString *key = @"name";
NSString *value = @"Nick";
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService deleteDocumentsByKeyValue:dbName collectionName:collectionName key:key value:value completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{	
	if (success)
	{
		App42Response *response = (App42Response*)responseObj;
		NSString *success = response.isResponseSuccess;
		NSString *jsonResponse = [response toString];        
	}
	else
	{
		NSLog(@"Exception = %@",[exception reason]);
		NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
		NSLog(@"App Error Code = %d",[exception appErrorCode]);
		NSLog(@"User Info = %@",[exception userInfo]);
	}
}];
let dbName = "<Your_DataBase_Name>"
let collectionName = "<Your_Collection_Name>"
let key = "name"
let value = "Nick"
App42API.initializeWithAPIKey(@"API_KEY" andSecretKey:@"SECRET_KEY")    
var storageService = App42API.buildStorageService() as? StorageService 
storageService?.deleteDocumentsByKeyValue(dbName, collectionName: collectionName, key:key, value:value, completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let app42Response = response as! App42Response
		NSLog("app42Response is %@", app42Response.strResponse)
		NSLog("isResponseSuccess : %@", app42Response.isResponseSuccess)
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 	
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
App42Response app42response = storageService.deleteDocumentsByKeyValue(dbName,collectionName, key,value);
System.out.println("response is " + app42response) ;  
boolean  success = app42response.isResponseSuccess();
String jsonResponse = app42response.toString();
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 	
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.DeleteDocumentsByKeyValue(dbName,collectionName, key,value, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		App42Response success = (App42Response) response;     
		String jsonResponse = success.ToString();  
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var dbName = "<Your_DataBase_Name>",
collectionName = "<Your_Collection_Name>",
key = "key",
value = "Nick",
response; 
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.deleteDocumentsByKeyValue(dbName, collectionName,key,value,{  
	success: function(object) 
	{  
		var storage = JSON.parse(object);  
		response = storage.app42.response;
		console.log("response is " + response)
	},  
	error: function(error) {  
	}  
});
local dbName  = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local key = "name"
local value = "Nick"
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:deleteDocumentsByKeyValue(dbName,collectionName,key,value,App42CallBack)
function App42CallBack:onSuccess(object)
	print(object:getResponseSuccess())
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* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
const char* key = "name";
const char* value = "Nick";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->DeleteDocumentsByKeyValue(dbName, collectionName,key,value,app42callback(Sample_Class::onStorageRequestCompleted, this));

void Sample_Class::onStorageRequestCompleted(void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 	
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
App42Response response = storageService.DeleteDocumentsByKeyValue(dbName,collectionName, key,value);
Boolean  response = response.IsResponseSuccess();
String jsonResponse = response.ToString();
$dbName = "<Your_DataBase_Name>";
$collectionName = "<Your_Collection_Name>"; 
$key = "name"; 
$value = "Nick"; 
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$storage = $storageService->>deleteDocumentsByKeyValue($dbName , $collectionName, $key, $value);
print_r("Response is : ".$storage->toString());
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
const char* key = "name";
const char* value = "Nick";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->DeleteDocumentsByKeyValue(dbName, collectionName,key,value,this, app42callfuncND_selector(Sample_Class::onStorageRequestCompleted));

void Sample_Class::onStorageRequestCompleted(App42CallBack *sender, void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
Coming Soon
var dbName:String = "<Your_DataBase_Name>";
var collectionName:String = "<Your_Collection_Name>"; 
var key:String = "name"; 
var value:String = "Nick"; 
App42API.initialize("API_KEY","SECRET_KEY");
var storageService:StorageService = App42API.buildStorageService(); 
storageService.deleteDocumentsByKeyValue(dbName,collectionName, key,value,new callback());  
public class callback implements App42CallBack  
{  
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
	public function onSuccess(response:Object):void  
	{  
		var storage:Storage = Storage(response); 
		trace("response is : " + storage);
	}  
}  
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 	
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
App42Response response = storageService.deleteDocumentsByKeyValue(dbName,collectionName, key,value);
System.out.println("response is " + response) ;  
boolean  response = response.isResponseSuccess();
String jsonResponse = response.toString();
Update Document By Doc Id With JSON Object

Update target document with JSONObject doc using the document ID. For example, if you have an existing JSON document like “{"name":"Nick Carter","Company":"Shephertz Technologies"}” and you need to update this JSON document with the name with John Carter, then will you need to pass the JSON document with updated value like “{"name":"John Carter","Company":"Shephertz Technologies"}”.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc needs to be updated. docId - ID of the document to be updated for the target JSON doc jsonDoc - Complete JSON document with updated values.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";  
JSONObject newJsonObject = new JSONObject();
newJsonObject.put("Company", "Shephertz Technologies");
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.updateDocumentByDocId(dbName, collectionName, docId, newJsonObject, new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
		System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
	} 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());	
}
}); 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";  
JObject newJsonObject = new JObject();
newJsonObject.Add("Company", "Shephertz Technologies");
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.UpdateDocumentByDocId(dbName, collectionName, docId, newJsonObject, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Storage storage = (Storage) response;
		Console.WriteLine("dbName is " + storage.GetDbName());
		Console.WriteLine("collection Name is " + storage.GetCollectionName());
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0; i<jsonDocList.Count; i++)
		{   
			Console.WriteLine("DocId is : " + jsonDocList[i].GetDocId());
			Console.WriteLine("JSONDoc is : " + jsonDocList[i].GetJsonDoc());
			Console.WriteLine("CreatedAt is : " + jsonDocList()[i].GetCreatedAt());
			Console.WriteLine("UpdatedAt is : " + jsonDocList()[i].GetUpdatedAt());
		} 
	}  
} 
NSString *dbName = @"<Your_DataBase_Name>";
NSString *collectionName = @"Your_Collection_Name";
NSString *docId = @"docId";
NSDictionary *dataDict = [NSDictionary dictionaryWithObjectsAndKeys:@"Nick",@"name", nil];
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService updateDocumentByDocId:dbName collectionName:collectionName docId:docId newDataDict:dataDict completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Storage *storage =  (Storage*)responseObj;
		NSLog(@"dbName is %@" , storage.dbName);
		NSLog(@"collectionNameId is %@" ,  storage.collectionName);
		NSMutableArray *jsonDocArray = storage.jsonDocArray;               
		for(JSONDocument *jsonDoc in jsonDocArray) 
		{  
			NSLog(@"objectId is = %@ " , jsonDoc.docId);  
			NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); 
		}  
	}
	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 dbName = "<Your_DataBase_Name>"
let collectionName = "<Your_Collection_Name>"
let docId =  "docId"
let newJSONDoc = ["name":"John"]
App42API.initializeWithAPIKey(@"API_KEY" andSecretKey:@"SECRET_KEY")    
var storageService = App42API.buildStorageService() as? StorageService 
storageService?.updateDocumentByDocId(dbName, collectionName: collectionName, docId:docId as String, newDataDict:newJSONDoc, completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let storage = response as! Storage
		NSLog("dbName is : %@", storage.dbName)
		NSLog("collectionName is : %@", storage.collectionName)
		let jsonDocList = storage.jsonDocArray
		for jsonDoc in jsonDocList {
			NSLog("Docid is : %@",jsonDoc.docId)
			NSLog("CreatedAt is : %@",jsonDoc.createdAt)
			NSLog("UpdatedAt is : %@",jsonDoc.updatedAt)
			NSLog("JsonDoc is : %@",jsonDoc.jsonDoc)
		}
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";  
JSONObject newJsonObject = new JSONObject();
newJsonObject.put("Company", "Shephertz Technologies");
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.updateDocumentByDocId(dbName, collectionName, docId, newJsonObject);
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
for(int i=0;i<jsonDocList.size();i++)
{
	System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
	System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
}  
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId"; 
Dictionary<String, Object> jsonDoc = new Dictionary<String, Object>();
jsonDoc.Add("Company", "Shephertz Technologies");
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.UpdateDocumentByDocId(dbName, collectionName, docId, jsonDoc, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			App42Log.Console("objectId is " + jsonDocList[i].GetDocId());
			App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc());
			App42Log.Console("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			App42Log.Console("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
		}  
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var dbName = "<Your_DataBase_Name>",
collectionName = "<Your_Collection_Name>",
docId = "docId";
var jsonDoc = new Object();
jsonDoc.name = "John";
jsonDoc.type = "20";
var response ;  
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.updateDocumentByDocId(dbName,collectionName,docId,jsonDoc,{  
	success: function(object) 
	{  
		var storageObj = JSON.parse(object);  
		response = storageObj.app42.response.storage;
		console.log("dbName is " + response.dbName)
		console.log("objectId is " + response.jsonDoc._id.$oid)
		console.log("Created At is "+response.jsonDoc._$createdAt)
		console.log("Updated At is "+response.jsonDoc._$updatedAt)
	},  
	error: function(error) {  
	}  
}); 
local dbName  = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local docId = "docId"
local jsonDoc = {}
jsonDoc.name = "John"
jsonDoc.age = 20
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:updateDocumentByDocId(dbName,collectionName,docId,jsonDoc,App42CallBack)
function App42CallBack:onSuccess(object)
	print("dbName is "..object:getDbName())
		for i=1,table.getn(object:getJsonDocList()) do
			print("DocId is "..object:getJsonDocList()[i]:getDocId())
			print("CreatedAt is "..object:getJsonDocList()[i]:getCreatedAt())
		end
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
const char* key = "name";
const char* value = "Nick";
App42Object *object = new App42Object();
object->setObject("name", "John");
object->setObject("age", "20");
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->UpdateDocumentByKeyValue(dbName, collectionName, key, value, object, app42callback(Sample_Class::onStorageRequestCompleted, this));

void Sample_Class::onStorageRequestCompleted(void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
Dictionary<String, Object> jsonDoc = new Dictionary<String, Object>();
jsonDoc.Add("Company", "Shephertz Technologies");
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
Storage storage = storageService.UpdateDocumentByDocId(dbName,collectionName,docId,jsonDoc);  
Console.WriteLine("dbName is " + storage.GetDbName());
IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
for(int i=0;i <jsonDocList.Count;i++)
{   
	Console.WriteLine("objectId is " + jsonDocList[i].GetDocId());
	Console.WriteLine("JSONDoc is : " + jsonDocList[i].GetJsonDoc());
	Console.WriteLine("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
	Console.WriteLine("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
}  
$dbName = "<Your_DataBase_Name>";
$collectionName = "<Your_Collection_Name>"; 
$docId= "docId";
$jsonDoc = new JSONObject();
$jsonDoc->put("Company","Shephertz Technologies");
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$storage =$storageService->updateDocumentByDocId($dbName,$collectionName,$docId,$jsonDoc);  
print_r("Db Name is :".$storage->getDbName());
print_r("Collection Name is :".$storage->getCollectionName());
$jsonDocList = $storage->getJsonDocList();
foreach( $jsonDocList as $jsonDoc )
{
	print_r("docId is : " . $jsonDoc->getDocId());
	print_r("jsonDocs is : " . $jsonDoc->getJsonDoc());
	print_r("updated at is : " . $jsonDoc->getUpdatedAt());
	print_r("created At is : " . $jsonDoc->getCreatedAt());
}
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
const char* key = "name";
const char* value = "Nick";
App42Object *object = new App42Object();
object->setObject("name", "John");
object->setObject("age", "20");
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->UpdateDocumentByKeyValue(dbName, collectionName, key, value, object, this, app42callfuncND_selector(Sample_Class::onStorageRequestCompleted));

void Sample_Class::onStorageRequestCompleted(App42CallBack *sender, void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
Coming Soon 
App42Log.setDebug(true);
var dbName:String  = "<Your_DataBase_Name>";
var collectionName:String = "<Your_Collection_Name>";   
var docId:String = "docId";  
var newjsonObject:Object = new Object;
newjsonObject.key  = "<Enter_the_value>";
App42API.initialize("API_KEY","SECRET_KEY");
var storageService:StorageService = App42API.buildStorageService(); 
storageService.updateDocumentByDocIdWithJsonObject(dbName, collectionName, docId, newjsonObject,new callback());
class callback implements App42CallBack  
{  
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}  
	public function onSuccess(response:Object):void  
	{  
		var storage:Storage = Storage(response);
		var jsonDoc:JSONDocument = new JSONDocument(); 
		trace("dbName is " + storage.getDbName());
		trace("Collection Name is :  " + storage.getCollectionName());
		var jsonDocsList:Array = storage.getJsonDocList();
		for(var i:int=0; i < jsonDocsList.length;i++)
		{
			jsonDoc = JSONDocument(jsonDocsList[i]);
			trace("Docid is : " + jsonDoc.getDocId());
			trace("CreatedAt is : " + jsonDoc.getCreatedAt());
			trace("UpdatedAt is :  " + jsonDoc.getUpdatedAt());
			trace("JsonDoc is :  " + jsonDoc.getJsonDoc());
		}
	}  
}
Not Available
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";  
JSONObject newJsonObject = new JSONObject();
newJsonObject.put("Company", "Shephertz Technologies");
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.updateDocumentByDocId(dbName,collectionName,docId,newJsonObject);  
System.out.println("dbName is " + storage.getDbName());
Vector JsonDocList = storage.getJsonDocList();   
for(int i=0;i < JsonDocList.size();i++)  
{ 
	Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i);  
	System.out.println("objectId is " + jsonDoc.getDocId());  
	System.out.println("CreatedAt is " + jsonDoc.getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDoc.getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDoc.getJsonDoc()); 
}         
Save Or Update Document By Key Value With JSON String

Update target document using a key value search parameter. This key value pair will be searched in the JSON doc stored in the cloud and matching doc will be updated with the new value passed. For example, if you have an existing JSON document like “{"name":"Nick Carter","Company":"Shephertz Technologies"}” and you need to update this JSON document with the name with John Carter, then will you need to pass the JSON document with updated value like “{"name":"John Carter","Company":"Shephertz Technologies"}”.


Note: If no document is found with this key value pair then a new document is inserted.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc needs to be updated. key - Key to be searched for the target JSON doc. value - Value to be searched for the target JSON doc. jsonDoc - Complete JSON document with updated values.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
String jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.saveOrUpdateDocumentByKeyValue(dbName, collectionName, key, value, jsonDoc, new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
		System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
	} 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());	
}
});  
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
String jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.SaveOrUpdateDocumentByKeyValue(dbName, collectionName, key, value, jsonDoc, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Storage storage = (Storage) response;
		Console.WriteLine("dbName is " + storage.GetDbName());
		Console.WriteLine("collection Name is " + storage.GetCollectionName());
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0; i<jsonDocList.Count; i++)
		{   
			Console.WriteLine("DocId is : " + jsonDocList[i].GetDocId());
			Console.WriteLine("JSONDoc is : " + jsonDocList[i].GetJsonDoc());
			Console.WriteLine("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			Console.WriteLine("UpdatedAt is : " + jsonDocList()[i].GetUpdatedAt());
		} 
	}  
} 
NSString *dbName = @"<Your_DataBase_Name>";
NSString *collectionName = @"Your_Collection_Name";
NSString *key = @"Company";
NSString *value = @"Shephertz";
NSDictionary *jsonDict = [NSDictionary dictionaryWithObjectsAndKeys:@"Shephertz Technologies",key, nil];
NSString *jsonDoc = [jsonDict JSONRepresentation];
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService saveOrUpdateDocumentByKeyValue:dbName collectionName:collectionName key:key value:value newJsonDoc:jsonDoc completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Storage *storage =  (Storage*)responseObj;
		NSLog(@"dbName is %@" , storage.dbName);
		NSLog(@"collectionNameId is %@" ,  storage.collectionName);
		NSMutableArray *jsonDocArray = storage.jsonDocArray;               
		for(JSONDocument *jsonDoc in jsonDocArray) 
		{  
			NSLog(@"objectId is = %@ " , jsonDoc.docId);  
			NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); 
		}  
	}
	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 dbName = "<Your_DataBase_Name>"
let collectionName = "<Your_Collection_Name>"
let key = "name"
let value = "Shikha"
let newJSONDoc = "{\"Company\":\"Shephertz Technologies\"}"
App42API.initializeWithAPIKey(@"API_KEY" andSecretKey:@"SECRET_KEY")    
var storageService = App42API.buildStorageService() as? StorageService 
storageService?.saveOrUpdateDocumentByKeyValue(dbName, collectionName: collectionName, key:key, value:value, newJsonDoc:newJSONDoc, completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let storage = response as! Storage
		NSLog("dbName is : %@", storage.dbName)
		NSLog("collectionName is : %@", storage.collectionName)
		let jsonDocList = storage.jsonDocArray
		for jsonDoc in jsonDocList {
			NSLog("Docid is : %@",jsonDoc.docId)
			NSLog("CreatedAt is : %@",jsonDoc.createdAt)
			NSLog("UpdatedAt is : %@",jsonDoc.updatedAt)
			NSLog("JsonDoc is : %@",jsonDoc.jsonDoc)
		}
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
String jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.saveOrUpdateDocumentByKeyValue(dbName, collectionName, key, value, jsonDoc);  
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
for(int i=0;i<jsonDocList.size();i++)
{
	System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
	System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
}   
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
String jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.SaveOrUpdateDocumentByKeyValue(dbName, collectionName, key, value, jsonDoc, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Storage storage = (Storage) response; 
		App42Log.Console("dbName is " + storage.GetDbName());
		App42Log.Console("collection Name is " + storage.GetCollectionName());
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			App42Log.Console("objectId is " + jsonDocList[i].GetDocId());
			App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc());
			App42Log.Console("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			App42Log.Console("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
		}  
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var dbName = "<Your_DataBase_Name>",
collectionName = "<Your_Collection_Name>",
key = "name",
value = "Nick",
response ; 
var jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.saveOrUpdateDocumentByKeyValue(dbName,collectionName,key,value,jsonDoc,{  
success: function(object) 
	{  
		var storageObj = JSON.parse(object);
		console.log("dbName is :" +storageObj.app42.response.storage.dbName)
		response = storageObj.app42.response.storage.jsonDoc;
		if(response.length == undefined)  
		{			
			console.log(response._id.$oid)
			console.log(response._$createdAt)
			console.log(response._$updatedAt)
		}
	   for(var i=0;i<response.length;i++)  
	   {
			console.log(response[i])
			console.log(response[i]._id.$oid)
			console.log(response[i]._$createdAt)
			console.log(response[i]._$updatedAt)
	   }
	},  
	error: function(error) {  
	}  
}); 
local dbName  = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local key = "name"
local value = "Nick"
local jsonDoc = "{\"Company\":\"Shephertz Technologies\"}"
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:saveOrupdateDocumentByKeyValue(dbName,collectionName,key,value,jsonDoc,App42CallBack)
function App42CallBack:onSuccess(object)
	print("dbName is "..object:getDbName())
	for i=1,table.getn(object:getJsonDocList()) do
		print("DocId is "..object:getJsonDocList()[i]:getDocId())
		print("CreatedAt is "..object:getJsonDocList()[i]:getCreatedAt())
		print("UpdatedAt is "..object:getJsonDocList()[i]:getUpdatedAt())
		print("jsonDoc is "..JSON:encode(object:getJsonDocList()[i]:getJsonDoc())); 
	end
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
const char* key = "name";
const char* value = "Nick";
const char* jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->SaveOrUpdateDocumentByKeyValue(dbName, collectionName, key, value, jsonDoc, app42callback(Sample_Class::onStorageRequestCompleted, this));

void Sample_Class::onStorageRequestCompleted(void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
String jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
Storage storage = storageService.SaveOrUpdateDocumentByKeyValue(dbName, collectionName, key, value, jsonDoc);   
Console.WriteLine("dbName is " + storage.GetDbName());
Console.WriteLine("collection Name is " + storage.GetCollectionName());
IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
for(int i=0;i <jsonDocList.Count;i++)
{   
	Console.WriteLine("objectId is " + jsonDocList[i].GetDocId());
	Console.WriteLine("CreatedAt is " + jsonDocList[i].GetCreatedAt());  
	Console.WriteLine("UpdatedAt is " + jsonDocList[i].GetUpdatedAt());  
	Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc());
}
$dbName = "<Your_DataBase_Name>";
$collectionName = "<Your_Collection_Name>"; 
$key = "name"; 
$value = "Nick"; 
$jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$storage = $storageService->saveOrUpdateDocumentByKeyValue($dbName, $collectionName, $key, $value, $jsonDoc);
print_r("Db Name is :".$storage->getDbName());
print_r("Collection Name is :".$storage->getCollectionName());
$jsonDocList = $storage->getJsonDocList();
foreach( $jsonDocList as $jsonDoc )
{
	print_r("docId is : " . $jsonDoc->getDocId());
	print_r("jsonDocs is : " . $jsonDoc->getJsonDoc());
	print_r("updated at is : " . $jsonDoc->getUpdatedAt());
	print_r("created At is : " . $jsonDoc->getCreatedAt());
}	
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
const char* key = "name";
const char* value = "Nick";
const char* jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->SaveOrUpdateDocumentByKeyValue(dbName, collectionName, key, value, jsonDoc, this, app42callfuncND_selector(Sample_Class::onStorageRequestCompleted));

void Sample_Class::onStorageRequestCompleted(App42CallBack *sender, void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
Coming Soon
var dbName:String  = "<Your_DataBase_Name>";
var collectionName:String = "<Your_Collection_Name>"; 
var key:String = "<Enter_the_key>"; 
var value:String = "<Enter_the_value>"; 
var jsonDoc:String = "{\"Company\":\"Shephertz Technologies\"}";
App42API.initialize("API_KEY","SECRET_KEY");
var storageService:StorageService = App42API.buildStorageService(); 
storageService.saveOrupdateDocumentByKeyValue(dbName,collectionName,key,value ,jsonDoc ,new callback());	
class callback implements App42CallBack  
{  
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}  
	public function onSuccess(response:Object):void  
	{  
		var storage:Storage = Storage(response);
		var jsonDoc:JSONDocument = new JSONDocument(); 
		trace("dbName is " + storage.getDbName());
		trace("Collection Name is :  " + storage.getCollectionName());
		var jsonDocsList:Array = storage.getJsonDocList();
		for(var i:int=0; i < jsonDocsList.length;i++)
		{
			jsonDoc = JSONDocument(jsonDocsList[i]);
			trace("Docid is : " + jsonDoc.getDocId());
			trace("CreatedAt is : " + jsonDoc.getCreatedAt());
			trace("UpdatedAt is :  " + jsonDoc.getUpdatedAt());
			trace("JsonDoc is :  " + jsonDoc.getJsonDoc());
		}
	}  
}
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
String jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.saveOrUpdateDocumentByKeyValue(dbName, collectionName, key, value, jsonDoc);   
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
Vector JsonDocList = storage.getJsonDocList();   
for(int i=0;i < JsonDocList.size();i++)  
{ 
	Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i);  
	System.out.println("objectId is " + jsonDoc.getDocId());  
	System.out.println("CreatedAt is " + jsonDoc.getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDoc.getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDoc.getJsonDoc()); 
}       
Save Or Update Document By Key Value With JSON Object

Update target document using a key value search parameter. This key value pair will be searched in the JSON doc stored in the cloud and matching doc will be updated with the new value passed. For example, if you have an existing JSON document like “{"name":"Nick Carter","Company":"Shephertz Technologies"}” and you need to update this JSON document with the name with John Carter, then will you need to pass the JSON document with updated value like “{"name":"John Carter","Company":"Shephertz Technologies"}”.


Note: If no document is found with this key value pair then a new document is inserted.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc needs to be updated. key - Key to be searched for the target JSON doc. value - Value to be searched for the target JSON doc. jsonDoc - Complete JSON document with updated values.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
JSONObject jsonDoc = new JSONObject();
jsonDoc.put("name","John");
jsonDoc.put("age",20);
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.saveOrUpdateDocumentByKeyValue(dbName, collectionName, key, value, jsonDoc, new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
		System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
	} 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());	
}
});  
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
JObject jsonDoc = new JObject();
jsonDoc.Add("name","John");
jsonDoc.Add("age",20);
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.SaveOrUpdateDocumentByKeyValue(dbName, collectionName, key, value, jsonDoc, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Storage storage = (Storage) response;
		Console.WriteLine("dbName is " + storage.GetDbName());
		Console.WriteLine("collection Name is " + storage.GetCollectionName());
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0; i<jsonDocList.Count; i++)
		{   
			Console.WriteLine("DocId is : " + jsonDocList[i].GetDocId());
			Console.WriteLine("JSONDoc is : " + jsonDocList[i].GetJsonDoc());
			Console.WriteLine("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			Console.WriteLine("UpdatedAt is : " + jsonDocList()[i].GetUpdatedAt());
		} 
	}  
} 
NSString *dbName = @"<Your_DataBase_Name>";
NSString *collectionName = @"Your_Collection_Name";
NSString *key = @"name";
NSString *value = @"Nick";
NSDictionary *jsonDict = [NSDictionary dictionaryWithObjectsAndKeys:@"John ",key, nil];
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService saveOrUpdateDocumentByKeyValue:dbName collectionName:collectionName key:key value:value dataDict:jsonDict completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Storage *storage =  (Storage*)responseObj;
		NSLog(@"dbName is %@" , storage.dbName);
		NSLog(@"collectionNameId is %@" ,  storage.collectionName);
		NSMutableArray *jsonDocArray = storage.jsonDocArray;               
		for(JSONDocument *jsonDoc in jsonDocArray) 
		{  
			NSLog(@"objectId is = %@ " , jsonDoc.docId);  
			NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); 
		}  
	}
	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 dbName = "<Your_DataBase_Name>"
let collectionName = "<Your_Collection_Name>"
let key = "name"
let value = "Nick"
let newJSONDoc = ["name":"John"]
App42API.initializeWithAPIKey(@"API_KEY" andSecretKey:@"SECRET_KEY")    
var storageService = App42API.buildStorageService() as? StorageService 
storageService?.saveOrUpdateDocumentByKeyValue(dbName, collectionName: collectionName, key:key, value:value, dataDict:newJSONDoc, completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let storage = response as! Storage
		NSLog("dbName is : %@", storage.dbName)
		NSLog("collectionName is : %@", storage.collectionName)
		let jsonDocList = storage.jsonDocArray
		for jsonDoc in jsonDocList {
			NSLog("Docid is : %@",jsonDoc.docId)
			NSLog("CreatedAt is : %@",jsonDoc.createdAt)
			NSLog("UpdatedAt is : %@",jsonDoc.updatedAt)
			NSLog("JsonDoc is : %@",jsonDoc.jsonDoc)
		}
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
JSONObject jsonDoc = new JSONObject();
jsonDoc.put("name","John");
jsonDoc.put("age",20);
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.saveOrUpdateDocumentByKeyValue(dbName, collectionName, key, value, jsonDoc);  
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
for(int i=0;i<jsonDocList.size();i++)
{
	System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
	System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
}   
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
Dictionary<String, Object> jsonDoc = new Dictionary<String, Object>();
jsonDoc.Add("name","John");
jsonDoc.Add("age",20);
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.SaveOrUpdateDocumentByKeyValue(dbName, collectionName, key, value, jsonDoc, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Storage storage = (Storage) response; 
		App42Log.Console("dbName is " + storage.GetDbName());
		App42Log.Console("collection Name is " + storage.GetCollectionName());
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			App42Log.Console("objectId is " + jsonDocList[i].GetDocId());
			App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc());
			App42Log.Console("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			App42Log.Console("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
		}  
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var dbName = "<Your_DataBase_Name>",
collectionName = "<Your_Collection_Name>",
key = "name",
value = "Nick",
response ; 
var jsonDoc = new Object();
jsonDoc.name = "John";
jsonDoc.type = "20";
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.saveOrUpdateDocumentByKeyValue(dbName,collectionName,key,value,jsonDoc,{  
success: function(object) 
	{  
		var storageObj = JSON.parse(object);
		console.log("dbName is :" +storageObj.app42.response.storage.dbName)
		response = storageObj.app42.response.storage.jsonDoc;
		if(response.length == undefined)  
		{			
			console.log(response._id.$oid)
			console.log(response._$createdAt)
			console.log(response._$updatedAt)
		}
	   for(var i=0;i<response.length;i++)  
	   {
			console.log(response[i])
			console.log(response[i]._id.$oid)
			console.log(response[i]._$createdAt)
			console.log(response[i]._$updatedAt)
	   }
	},  
	error: function(error) {  
	}  
}); 
local dbName  = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local key = "name"
local value = "Nick"
local jsonDoc = {}
jsonDoc.name = "John"
jsonDoc.age = 20
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:saveOrupdateDocumentByKeyValue(dbName,collectionName,key,value,jsonDoc,App42CallBack)
function App42CallBack:onSuccess(object)
	print("dbName is "..object:getDbName())
	for i=1,table.getn(object:getJsonDocList()) do
		print("DocId is "..object:getJsonDocList()[i]:getDocId())
		print("CreatedAt is "..object:getJsonDocList()[i]:getCreatedAt())
		print("UpdatedAt is "..object:getJsonDocList()[i]:getUpdatedAt())
		print("jsonDoc is "..JSON:encode(object:getJsonDocList()[i]:getJsonDoc())); 
	end
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
const char* key = "name";
const char* value = "Nick";
App42Object *object = new App42Object();
object->setObject("name", "John");
object->setObject("age", "20");
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->SaveOrUpdateDocumentByKeyValue(dbName, collectionName, key, value, object, app42callback(Sample_Class::onStorageRequestCompleted, this));

void Sample_Class::onStorageRequestCompleted(void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
Dictionary<String, Object> jsonDoc = new Dictionary<String, Object>();
jsonDoc.Add("name","John");
jsonDoc.Add("age",20);
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
Storage storage = storageService.SaveOrUpdateDocumentByKeyValue(dbName, collectionName, key, value, jsonDoc);   
Console.WriteLine("dbName is " + storage.GetDbName());
Console.WriteLine("collection Name is " + storage.GetCollectionName());
IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
for(int i=0;i <jsonDocList.Count;i++)
{   
	Console.WriteLine("objectId is " + jsonDocList[i].GetDocId());
	Console.WriteLine("CreatedAt is " + jsonDocList[i].GetCreatedAt());  
	Console.WriteLine("UpdatedAt is " + jsonDocList[i].GetUpdatedAt());  
	Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc());
}
$dbName = "<Your_DataBase_Name>";
$collectionName = "<Your_Collection_Name>"; 
$key = "name"; 
$value = "Nick"; 
$jsonDoc  = new JSONObject();
$jsonDoc->put("name", "John");
$jsonDoc->put("age", 20);
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$storage = $storageService->saveOrUpdateDocumentByKeyValue($dbName, $collectionName, $key, $value, $jsonDoc);
print_r("Db Name is :".$storage->getDbName());
print_r("Collection Name is :".$storage->getCollectionName());
$jsonDocList = $storage->getJsonDocList();
foreach( $jsonDocList as $jsonDoc )
{
	print_r("docId is : " . $jsonDoc->getDocId());
	print_r("jsonDocs is : " . $jsonDoc->getJsonDoc());
	print_r("updated at is : " . $jsonDoc->getUpdatedAt());
	print_r("created At is : " . $jsonDoc->getCreatedAt());
}
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
const char* key = "name";
const char* value = "Nick";
App42Object *object = new App42Object();
object->setObject("name", "John");
object->setObject("age", "20");
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->SaveOrUpdateDocumentByKeyValue(dbName, collectionName, key, value, object, this, app42callfuncND_selector(Sample_Class::onStorageRequestCompleted));

void Sample_Class::onStorageRequestCompleted(App42CallBack *sender, void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
Coming Soon
var dbName:String  = "<Your_DataBase_Name>";
var collectionName:String = "<Your_Collection_Name>"; 
var key:String = "<Enter_the_key>"; 
var value:String = "<Enter_the_value>"; 
var jsonDoc:Object  = new Object();
jsonDoc.name = "John"; 
jsonDoc.age = 20; 
App42API.initialize("API_KEY","SECRET_KEY");
var storageService:StorageService = App42API.buildStorageService(); 
storageService.saveOrupdateDocumentByKeyValueWithJsonObject(dbName,collectionName,key,value ,jsonDoc ,new callback());	
class callback implements App42CallBack  
{  
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}  
	public function onSuccess(response:Object):void  
	{  
		var storage:Storage = Storage(response);
		var jsonDoc:JSONDocument = new JSONDocument(); 
		trace("dbName is " + storage.getDbName());
		trace("Collection Name is :  " + storage.getCollectionName());
		var jsonDocsList:Array = storage.getJsonDocList();
		for(var i:int=0; i < jsonDocsList.length;i++)
		{
			jsonDoc = JSONDocument(jsonDocsList[i]);
			trace("Docid is : " + jsonDoc.getDocId());
			trace("CreatedAt is : " + jsonDoc.getCreatedAt());
			trace("UpdatedAt is :  " + jsonDoc.getUpdatedAt());
			trace("JsonDoc is :  " + jsonDoc.getJsonDoc());
		}
	}  
}
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
JSONObject jsonDoc = new JSONObject();
jsonDoc.put("name","John");
jsonDoc.put("age",20);
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.saveOrUpdateDocumentByKeyValue(dbName, collectionName, key, value, jsonDoc);  
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
Vector JsonDocList = storage.getJsonDocList();   
for(int i=0;i < JsonDocList.size();i++)  
{ 
	Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i);  
	System.out.println("objectId is " + jsonDoc.getDocId());  
	System.out.println("CreatedAt is " + jsonDoc.getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDoc.getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDoc.getJsonDoc()); 
}             
Update Document By Query With JSON String

Update target documents using a custom query. This custom query will be searched in the JSON doc stored in the cloud and matching doc will be updated with the new value passed. For example, if you have an existing JSON document like “{"name":"Nick Carter","Company":"Shephertz Technologies"}” and you need to update this JSON document with the name with John Carter, then will you need to pass the JSON document with updated value like “{"name":"John Carter","Company":"Shephertz Technologies"}”.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc needs to be updated. query - Query Object containing custom query for searching docs. jsonDoc - Complete JSON document with updated values.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key1 = "name";   
String value1 = "Nick";  
String key2 = "age";      
int value2 = 30;    
Query q1 = QueryBuilder.build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick
Query q2 = QueryBuilder.build(key2, value2, Operator.GREATER_THAN);	// Build query q2 for key2 equal to age and value2 equal to 30	 
Query query = QueryBuilder.compoundOperator(q1, Operator.OR, q2);   	
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object.   
String jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.updateDocumentByQuery(dbName, collectionName, query, jsonDoc, new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	System.out.println("Record Count is "+ storage.getRecordCount());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
		System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
	} 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());	
}
});  
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key1 = "name";     
String value = "Nick";       
String key2 = "age";     
int value1 = 30;   
Query q1 = QueryBuilder.Build(key1, value2, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick  
Query q2 = QueryBuilder.Build(key2, value2, Operator.GREATER_THAN); // Build query q2 for key2 equal to age and value2 equal to 30     
Query query = QueryBuilder.CompoundOperator(q1, Operator.OR, q2);         
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object. 
String jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.UpdateDocumentByQuery(dbName, collectionName, query, jsonDoc, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Storage storage = (Storage) response;
		Console.WriteLine("dbName is " + storage.GetDbName());
		Console.WriteLine("collection Name is " + storage.GetCollectionName());
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0; i<jsonDocList.Count; i++)
		{   
			Console.WriteLine("DocId is : " + jsonDocList[i].GetDocId());
			Console.WriteLine("JSONDoc is : " + jsonDocList[i].GetJsonDoc());
			Console.WriteLine("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			Console.WriteLine("UpdatedAt is : " + jsonDocList()[i].GetUpdatedAt());
		} 
	}  
}
NSString *dbName = @"<Your_DataBase_Name>";
NSString *collectionName = @"<Your_Collection_Name>";
NSString *jsonDoc = @"{\"Company\":\"Shephertz Technologies\"}";
Query *query = [QueryBuilder buildQueryWithKey:@"Role" value:@"COO" andOperator:APP42_OP_EQUALS];
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService updateDocumentByQuery:dbName collectionName:collectionName query:query newJsonDoc:jsonDoc completionBlock:^(BOOL success, id responseObj, App42Exception *exception) {
	if (success)
	{
		Storage *storage = (Storage*)responseObj;
		NSLog(@"dbName is %@" , storage.dbName);
		NSLog(@"collectionName is %@" ,  storage.collectionName);
		NSMutableArray *jsonDocArray = storage.jsonDocArray;
		for(JSONDocument *jsonDoc in jsonDocArray)
		{
			NSLog(@"objectId is = %@ ", jsonDoc.docId);
			NSLog(@"jsonDoc is  = %@ ", jsonDoc.jsonDoc);
			NSLog(@"UpdatedAt   = %@ ", jsonDoc.updatedAt);
			NSLog(@"CreatedAt   = %@ ", jsonDoc.createdAt);
		}
	}
	else
	{
		NSLog(@"Exception = %@",[exception reason]);
		NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
		NSLog(@"App Error Code = %d",[exception appErrorCode]);
		NSLog(@"User Info = %@",[exception userInfo]);
		[self showResponse:[exception reason]];
	}
}];
let dbName = "<Your_DataBase_Name>"
let collectionName = "<Your_Collection_Name>"
let key = "name"
let value = "Nick"
let newJSONDoc = "{\"Company\":\"Shephertz Technologies\"}"
App42API.initializeWithAPIKey(@"API_KEY" andSecretKey:@"SECRET_KEY")    
var storageService = App42API.buildStorageService() as? StorageService 
let query = QueryBuilder.buildQueryWithKey(key, value: value, andOperator:APP42_OP_EQUALS)
storageService?.updateDocumentByQuery(dbName, collectionName: collectionName, query:query, newJsonDoc:newJSONDoc, completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let storage = response as! Storage
		NSLog("dbName is : %@", storage.dbName)
		NSLog("collectionName is : %@", storage.collectionName)
		let jsonDocList = storage.jsonDocArray
		for jsonDoc in jsonDocList {
			NSLog("Docid is : %@",jsonDoc.docId)
			NSLog("CreatedAt is : %@",jsonDoc.createdAt)
			NSLog("UpdatedAt is : %@",jsonDoc.updatedAt)
			NSLog("JsonDoc is : %@",jsonDoc.jsonDoc)
		}
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key1 = "name";   
String value1 = "Nick";  
String key2 = "age";      
int value2 = 30;    
Query q1 = QueryBuilder.build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick
Query q2 = QueryBuilder.build(key2, value2, Operator.GREATER_THAN);	// Build query q2 for key2 equal to age and value2 equal to 30	 
Query query = QueryBuilder.compoundOperator(q1, Operator.OR, q2);   	
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object.   
String jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.updateDocumentByQuery(dbName, collectionName, query, jsonDoc);  
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
System.out.println("Record Count is "+ storage.getRecordCount());
ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
for(int i=0;i<jsonDocList.size();i++)
{
	System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
	System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
}   
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key1 = "name";     
String value = "Nick";       
String key2 = "age";     
int value1 = 30;   
Query q1 = QueryBuilder.Build(key1, value2, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick  
Query q2 = QueryBuilder.Build(key2, value2, Operator.GREATER_THAN); // Build query q2 for key2 equal to age and value2 equal to 30     
Query query = QueryBuilder.CompoundOperator(q1, Operator.OR, q2);         
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object.    
String jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.UpdateDocumentByQuery(dbName, collectionName, query, jsonDoc, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Storage storage = (Storage) response; 
		App42Log.Console("dbName is " + storage.GetDbName());
		App42Log.Console("collection Name is " + storage.GetCollectionName());
		App42Log.Console("Record Count is "+ storage.GetRecordCount());
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			App42Log.Console("objectId is " + jsonDocList[i].GetDocId());
			App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc());
			App42Log.Console("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			App42Log.Console("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
		}  
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var dbName = "<Your_DataBase_Name>",
collectionName = "<Your_Collection_Name>",
key1 = "name",  
value1 = "Nick",   
key2 = "age",
value2 = 30,
response ; 
var queryBuilder = new QueryBuilder();
var q1= queryBuilder.build(key1, value1, Operator.EQUALS);    
var q2 = queryBuilder.build(key2, value2, Operator.GREATER_THAN);		
var query = queryBuilder.compoundOperator(q1,Operator.OR, q2);   
var jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.updateDocumentByQuery(dbName, collectionName,query,jsonDoc,{  
success: function(object) 
	{  
		var storageObj = JSON.parse(object);
		console.log("dbName is :" +storageObj.app42.response.storage.dbName)
		response = storageObj.app42.response.storage.jsonDoc;
		if(response.length == undefined)  
		{			
			console.log(response._id.$oid)
			console.log(response._$createdAt)
			console.log(response._$updatedAt)
		}
	   for(var i=0;i<response.length;i++)  
	   {
			console.log(response[i])
			console.log(response[i]._id.$oid)
			console.log(response[i]._$createdAt)
			console.log(response[i]._$updatedAt)
	   }
	},  
	error: function(error) {  
	}  
}); 
local dbName  = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local jsonDoc = "{\"Company\":\"Shephertz Technologies\"}"
local key1 = "name"
local value1 = "Nick"
local key2 = "age"
local value2 = 30
local q1 = queryBuilder:build(key1, value1, Operator.EQUALS)   
local q2 = queryBuilder:build(key2, value2, Operator.GREATER_THAN)		
local query = queryBuilder:compoundOperator(q1,Operator.OR, q2)
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:updateDocumentByQuery(dbName, collectionName,query,jsonDoc,App42CallBack)
function App42CallBack:onSuccess(object)
	print("dbName is "..object:getDbName())
	for i=1,table.getn(object:getJsonDocList()) do
		print("DocId is "..object:getJsonDocList()[i]:getDocId())
		print("CreatedAt is "..object:getJsonDocList()[i]:getCreatedAt())
		print("UpdatedAt is "..object:getJsonDocList()[i]:getUpdatedAt())
		print("jsonDoc is "..JSON:encode(object:getJsonDocList()[i]:getJsonDoc())); 
	end
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
const char* key1 = "name";
const char* value1 = "Nick";
const char* key2 = "age";
const char* value2 = "30";
Query *query1 = QueryBuilder::BuildQuery(key1, value1, APP42_OP_EQUALS);
Query *query2 = QueryBuilder::BuildQuery(key2, value2, APP42_OP_GREATER_THAN_EQUALTO);
Query *query3 = QueryBuilder::CompoundOperator(query1, APP42_OP_OR, query2);
const char* jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->UpdateDocumentByQuery(dbName, collectionName, query3, jsonDoc, app42callback(Sample_Class::onStorageRequestCompleted, this));

void Sample_Class::onStorageRequestCompleted(void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key1 = "name";     
String value = "Nick";       
String key2 = "age";     
int value1 = 30;   
Query q1 = QueryBuilder.Build(key1, value2, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick  
Query q2 = QueryBuilder.Build(key2, value2, Operator.GREATER_THAN); // Build query q2 for key2 equal to age and value2 equal to 30     
Query query = QueryBuilder.CompoundOperator(q1, Operator.OR, q2);         
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object.    
String jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
Storage storage = storageService.UpdateDocumentByQuery(dbName,collectionName,query,jsonDoc);  
Console.WriteLine("dbName is " + storage.GetDbName());
Console.WriteLine("collection Name is " + storage.GetCollectionName());
Console.WriteLine("Record Count is "+ storage.GetRecordCount());
IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
for(int i=0;i <jsonDocList.Count;i++)
{   
	Console.WriteLine("objectId is " + jsonDocList[i].GetDocId());
	Console.WriteLine("CreatedAt is " + jsonDocList[i].GetCreatedAt());  
	Console.WriteLine("UpdatedAtis " + jsonDocList[i].GetUpdatedAt());  
	Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc());
}
$dbName = "<Your_DataBase_Name>";
$collectionName = "<Your_Collection_Name>"; 
$key1 = "name";     
$value = "Nick";       
$key2 = "age";     
$value1 = 30; 
$queryBuilder = new QueryBuilder(); 
$q1 = queryBuilder->build($key1, $value2, Operator::EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick  
Query q2 =  queryBuilder->build($key2, $value2, Operator::GREATER_THAN); // Build query q2 for key2 equal to age and value2 equal to 30     
$query = $queryBuilder->compoundOperator($q1, Operator::ORop, $q2);       
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object. 
$jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$storage = $storageService->updateDocumentByQuery($dbName,$collectionName, $query, $jsonDoc);
print_r("Db Name is :".$storage->getDbName());
print_r("Collection Name is :".$storage->getCollectionName());
$jsonDocList = $storage->getJsonDocList();
foreach( $jsonDocList as $jsonDoc )
{
	print_r("docId is : " . $jsonDoc->getDocId());
	print_r("jsonDocs is : " . $jsonDoc->getJsonDoc());
	print_r("updated at is : " . $jsonDoc->getUpdatedAt());
	print_r("created At is : " . $jsonDoc->getCreatedAt());
}
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
const char* key1 = "name";
const char* value1 = "Nick";
const char* key2 = "age";
const char* value2 = "30";
Query *query1 = QueryBuilder::BuildQuery(key1, value1, APP42_OP_EQUALS);
Query *query2 = QueryBuilder::BuildQuery(key2, value2, APP42_OP_GREATER_THAN_EQUALTO);
Query *query3 = QueryBuilder::CompoundOperator(query1, APP42_OP_OR, query2);
const char* jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->UpdateDocumentByQuery(dbName, collectionName, query3, jsonDoc, this, app42callfuncND_selector(Sample_Class::onStorageRequestCompleted));

void Sample_Class::onStorageRequestCompleted(App42CallBack *sender, void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
Coming Soon
var dbName:String  = "<Your_DataBase_Name>";
var collectionName:String = "<Your_Collection_Name>"; 
var key1:String = "name";  
var value1:String = "Nick";  
var key2:String = "age";  
var value2:int = 30;  
var q1:Query = QueryBuilder.build(key1, value1, Operator.EQUALS);  
var q2:Query = QueryBuilder.build(key2, value2, Operator.GREATER_THAN);  
var query:Query = QueryBuilder.compoundOperator(q1, Operator.OR, q2);  
var jsonDoc:String = "{\"Company\":\"Shephertz Technologies\"}";
App42API.initialize("API_KEY","SECRET_KEY");
var storageService:StorageService = App42API.buildStorageService(); 
storageService.updateDocumentByQuery(dbName, collectionName, query ,jsonDoc ,new callback());	
class callback implements App42CallBack  
{  
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}  
	public function onSuccess(response:Object):void  
	{  
		var storage:Storage = Storage(response);
		var jsonDoc:JSONDocument = new JSONDocument(); 
		trace("dbName is " + storage.getDbName());
		trace("Collection Name is :  " + storage.getCollectionName());
		var jsonDocsList:Array = storage.getJsonDocList();
		for(var i:int=0; i < jsonDocsList.length;i++)
		{
			jsonDoc = JSONDocument(jsonDocsList[i]);
			trace("Docid is : " + jsonDoc.getDocId());
			trace("CreatedAt is : " + jsonDoc.getCreatedAt());
			trace("UpdatedAt is :  " + jsonDoc.getUpdatedAt());
			trace("JsonDoc is :  " + jsonDoc.getJsonDoc());
		}
	}  
}
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key1 = "name";   
String value1 = "Nick";  
String key2 = "age";      
int value2 = 30;    
Query q1 = QueryBuilder.build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick
Query q2 = QueryBuilder.build(key2, value2, Operator.GREATER_THAN);	// Build query q2 for key2 equal to age and value2 equal to 30	 
Query query = QueryBuilder.compoundOperator(q1, Operator.OR, q2);   	
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object.   
String jsonDoc = "{\"Company\":\"Shephertz Technologies\"}";
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.updateDocumentByQuery(dbName, collectionName, query, jsonDoc);  
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
System.out.println("Record Count is "+ storage.getRecordCount());
Vector JsonDocList = storage.getJsonDocList();   
for(int i=0;i < JsonDocList.size();i++)  
{ 
	Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i);  
	System.out.println("objectId is " + jsonDoc.getDocId());  
	System.out.println("CreatedAt is " + jsonDoc.getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDoc.getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDoc.getJsonDoc()); 
}       
Update Document By Query With JSON Object

Update target documents using a Custom Query. This Custom Query will be searched in the JSON doc stored in the cloud and matching doc will be updated with the new value passed. For example, if you have an existing JSON document like “{"name":"Nick Carter","Company":"Shephertz Technologies"}” and you need to update this JSON document with the name with John Carter, then will you need to pass the JSON document with updated value like “{"name":"John Carter","Company":"Shephertz Technologies"}”.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc needs to be updated. query - Query Object containing custom query for searching docs. jsonDoc - Complete JSON document with updated values.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key1 = "name";   
String value1 = "Nick";  
String key2 = "age";      
int value2 = 30;    
Query q1 = QueryBuilder.build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick
Query q2 = QueryBuilder.build(key2, value2, Operator.GREATER_THAN);	// Build query q2 for key2 equal to age and value2 equal to 30	 
Query query = QueryBuilder.compoundOperator(q1, Operator.OR, q2);   	
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object.    
JSONObject jsonDoc = new JSONObject();
jsonDoc.put("name","John");
jsonDoc.put("age",20);
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.updateDocumentByQuery(dbName, collectionName, query, jsonDoc, new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
		System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
	} 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});   
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key1 = "name";     
String value = "Nick";       
String key2 = "age";     
int value1 = 30;   
Query q1 = QueryBuilder.Build(key1, value2, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick  
Query q2 = QueryBuilder.Build(key2, value2, Operator.GREATER_THAN); // Build query q2 for key2 equal to age and value2 equal to 30     
Query query = QueryBuilder.CompoundOperator(q1, Operator.OR, q2);         
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object. 
JObject jsonDoc = new JObject();
jsonDoc.Add("name","John");
jsonDoc.Add("age",20);
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.UpdateDocumentByQuery(dbName, collectionName, query, jsonDoc, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Storage storage = (Storage) response;
		Console.WriteLine("dbName is " + storage.GetDbName());
		Console.WriteLine("collection Name is " + storage.GetCollectionName());
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0; i<jsonDocList.Count; i++)
		{   
			Console.WriteLine("DocId is : " + jsonDocList[i].GetDocId());
			Console.WriteLine("JSONDoc is : " + jsonDocList[i].GetJsonDoc());
			Console.WriteLine("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			Console.WriteLine("UpdatedAt is : " + jsonDocList()[i].GetUpdatedAt());
		} 
	}  
} 
NSString *dbName = @"<Your_DataBase_Name>";
NSString *collectionName = @"<Your_Collection_Name>";
NSDictionary *dataDict = [NSDictionary dictionaryWithObjectsAndKeys:@"Role",@"A", nil];
Query *query = [QueryBuilder buildQueryWithKey:@"Role" value:@"COO" andOperator:APP42_OP_EQUALS];
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService updateDocumentByQuery:dbName collectionName:collectionName query:query newDataDict:dataDict completionBlock:^(BOOL success, id responseObj, App42Exception *exception) {
	if (success)
	{
		Storage *storage = (Storage*)responseObj;
		NSLog(@"dbName is %@" , storage.dbName);
		NSLog(@"collectionName is %@" ,  storage.collectionName);
		NSMutableArray *jsonDocArray = storage.jsonDocArray;
		for(JSONDocument *jsonDoc in jsonDocArray)
		{
			NSLog(@"objectId is = %@ ", jsonDoc.docId);
			NSLog(@"jsonDoc is  = %@ ", jsonDoc.jsonDoc);
			NSLog(@"UpdatedAt   = %@ ", jsonDoc.updatedAt);
			NSLog(@"CreatedAt   = %@ ", jsonDoc.createdAt);
		}
	}
	else
	{
		NSLog(@"Exception = %@",[exception reason]);
		NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
		NSLog(@"App Error Code = %d",[exception appErrorCode]);
		NSLog(@"User Info = %@",[exception userInfo]);
		[self showResponse:[exception reason]];
	}
}];
let dbName = "<Your_DataBase_Name>"
let collectionName = "<Your_Collection_Name>"
let key = "name"
let value = "Nick"
let newJSONDoc = ["name":"John"]
App42API.initializeWithAPIKey(@"API_KEY" andSecretKey:@"SECRET_KEY")    
var storageService = App42API.buildStorageService() as? StorageService 
let query = QueryBuilder.buildQueryWithKey(key, value: value, andOperator:APP42_OP_EQUALS)
storageService?.updateDocumentByQuery(dbName, collectionName: collectionName, query:query, dataDict:newJSONDoc, completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let storage = response as! Storage
		NSLog("dbName is : %@", storage.dbName)
		NSLog("collectionName is : %@", storage.collectionName)
		let jsonDocList = storage.jsonDocArray
		for jsonDoc in jsonDocList {
			NSLog("Docid is : %@",jsonDoc.docId)
			NSLog("CreatedAt is : %@",jsonDoc.createdAt)
			NSLog("UpdatedAt is : %@",jsonDoc.updatedAt)
			NSLog("JsonDoc is : %@",jsonDoc.jsonDoc)
		}
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key1 = "name";   
String value1 = "Nick";  
String key2 = "age";      
int value2 = 30;    
Query q1 = QueryBuilder.build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick
Query q2 = QueryBuilder.build(key2, value2, Operator.GREATER_THAN);	// Build query q2 for key2 equal to age and value2 equal to 30	 
Query query = QueryBuilder.compoundOperator(q1, Operator.OR, q2);   	
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object.   
JSONObject jsonDoc = new JSONObject();
jsonDoc.put("name","John");
jsonDoc.put("age",20);
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.updateDocumentByQuery(dbName,collectionName,query,jsonDoc);  
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
for(int i=0;i<jsonDocList.size();i++)
{
	System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
	System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
}    
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key1 = "name";     
String value = "Nick";       
String key2 = "age";     
int value1 = 30;   
Query q1 = QueryBuilder.Build(key1, value2, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick  
Query q2 = QueryBuilder.Build(key2, value2, Operator.GREATER_THAN); // Build query q2 for key2 equal to age and value2 equal to 30     
Query query = QueryBuilder.CompoundOperator(q1, Operator.OR, q2);         
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object.
Dictionary<String, Object> jsonDoc = new Dictionary<String, Object>();
jsonDoc.Add("name","John");
jsonDoc.Add("age",20);
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.UpdateDocumentByQuery(dbName, collectionName, query, jsonDoc, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Storage storage = (Storage) response; 
		App42Log.Console("dbName is " + storage.GetDbName());
		App42Log.Console("collection Name is " + storage.GetCollectionName());
		App42Log.Console("Record Count is "+ storage.GetRecordCount());
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			App42Log.Console("objectId is " + jsonDocList[i].GetDocId());
			App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc());
			App42Log.Console("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			App42Log.Console("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
		}  
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var dbName = "<Your_DataBase_Name>",
collectionName = "<Your_Collection_Name>",
key1 = "name",  
value1 = "Nick",   
key2 = "age",
value2 = 30,
response ; 
var queryBuilder = new QueryBuilder();
var q1= queryBuilder.build(key1, value1, Operator.EQUALS);    
var q2 = queryBuilder.build(key2, value2, Operator.GREATER_THAN);		
var query = queryBuilder.compoundOperator(q1,Operator.OR, q2);   
var jsonDoc = new Object();
jsonDoc.name = "Nick";
jsonDoc.type = "30";
var response ;
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.updateDocumentByQuery(dbName, collectionName,query,jsonDoc,{  
success: function(object) 
	{  
		var storageObj = JSON.parse(object);
		console.log("dbName is :" +storageObj.app42.response.storage.dbName)
		response = storageObj.app42.response.storage.jsonDoc;
		if(response.length == undefined)  
		{			
			console.log(response._id.$oid)
			console.log(response._$createdAt)
			console.log(response._$updatedAt)
		}
	   for(var i=0;i<response.length;i++)  
	   {
			console.log(response[i])
			console.log(response[i]._id.$oid)
			console.log(response[i]._$createdAt)
			console.log(response[i]._$updatedAt)
	   }
	},  
	error: function(error) {  
	}  
}); 
local dbName  = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local jsonDoc = {}
jsonDoc.name = "John"
jsonDoc.age = 20
local key1 = "name"
local value1 = "Nick"
local key2 = "age"
local value2 = 30
local q1 = queryBuilder:build(key1, value1, Operator.EQUALS)   
local q2 = queryBuilder:build(key2, value2, Operator.GREATER_THAN)		
local query = queryBuilder:compoundOperator(q1,Operator.OR, q2)
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:updateDocumentByQuery(dbName, collectionName,query,jsonDoc,App42CallBack)
function App42CallBack:onSuccess(object)
	print("dbName is "..object:getDbName())
	for i=1,table.getn(object:getJsonDocList()) do
		print("DocId is "..object:getJsonDocList()[i]:getDocId())
		print("CreatedAt is "..object:getJsonDocList()[i]:getCreatedAt())
		print("UpdatedAt is "..object:getJsonDocList()[i]:getUpdatedAt())
		print("jsonDoc is "..JSON:encode(object:getJsonDocList()[i]:getJsonDoc())); 
	end
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
const char* key1 = "name";
const char* value1 = "Nick";
const char* key2 = "age";
const char* value2 = "30";
Query *query1 = QueryBuilder::BuildQuery(key1, value1, APP42_OP_EQUALS);
Query *query2 = QueryBuilder::BuildQuery(key2, value2, APP42_OP_GREATER_THAN_EQUALTO);
Query *query3 = QueryBuilder::CompoundOperator(query1, APP42_OP_OR, query2);
App42Object *object = new App42Object();
object->setObject("name", "John");
object->setObject("age", "20");
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->UpdateDocumentByQuery(dbName, collectionName, query3, object, app42callback(Sample_Class::onStorageRequestCompleted, this));

void Sample_Class::onStorageRequestCompleted(void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key1 = "name";     
String value = "Nick";       
String key2 = "age";     
int value1 = 30;   
Query q1 = QueryBuilder.Build(key1, value2, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick  
Query q2 = QueryBuilder.Build(key2, value2, Operator.GREATER_THAN); // Build query q2 for key2 equal to age and value2 equal to 30     
Query query = QueryBuilder.CompoundOperator(q1, Operator.OR, q2);         
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object. 
Dictionary<String, Object> jsonDoc = new Dictionary<String, Object>();
jsonDoc.Add("name","John");
jsonDoc.Add("age",20);
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
Storage storage = storageService.UpdateDocumentByQuery(dbName,collectionName,query,jsonDoc);  
Console.WriteLine("dbName is " + storage.GetDbName());
Console.WriteLine("collection Name is " + storage.GetCollectionName());
Console.WriteLine("Record Count is "+ storage.GetRecordCount());
IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
for(int i=0;i <jsonDocList.Count;i++)
{   
	Console.WriteLine("objectId is " + jsonDocList[i].GetDocId());
	Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc());
	Console.WriteLine("CreatedAt is " + jsonDocList[i].GetCreatedAt());  
	Console.WriteLine("UpdatedAtis " + jsonDocList[i].GetUpdatedAt());  
}
$dbName = "<Your_DataBase_Name>";
$collectionName = "<Your_Collection_Name>"; 
$key1 = "name";     
$value = "Nick";       
$key2 = "age";     
$value1 = 30; 
$queryBuilder = new QueryBuilder(); 
$q1 = queryBuilder->build($key1, $value2, Operator::EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick  
Query q2 =  queryBuilder->build($key2, $value2, Operator::GREATER_THAN); // Build query q2 for key2 equal to age and value2 equal to 30     
$query = $queryBuilder->compoundOperator($q1, Operator::ORop, $q2);       
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object. 
$jsonDoc = new JSONObject();
$jsonDoc->put("name","John");
$jsonDoc->put("age",20);
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$storage = $storageService->updateDocumentByQuery($dbName,$collectionName, $query, $jsonDoc);
print_r("Db Name is :".$storage->getDbName());
print_r("Collection Name is :".$storage->getCollectionName());
$jsonDocList = $storage->getJsonDocList();
foreach( $jsonDocList as $jsonDoc )
{
	print_r("docId is : " . $jsonDoc->getDocId());
	print_r("jsonDocs is : " . $jsonDoc->getJsonDoc());
	print_r("updated at is : " . $jsonDoc->getUpdatedAt());
	print_r("created At is : " . $jsonDoc->getCreatedAt());
}
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
const char* key1 = "name";
const char* value1 = "Nick";
const char* key2 = "age";
const char* value2 = "30";
Query *query1 = QueryBuilder::BuildQuery(key1, value1, APP42_OP_EQUALS);
Query *query2 = QueryBuilder::BuildQuery(key2, value2, APP42_OP_GREATER_THAN_EQUALTO);
Query *query3 = QueryBuilder::CompoundOperator(query1, APP42_OP_OR, query2);
App42Object *object = new App42Object();
object->setObject("name", "John");
object->setObject("age", "20");
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->UpdateDocumentByQuery(dbName, collectionName, query3, object, this, app42callfuncND_selector(Sample_Class::onStorageRequestCompleted));

void Sample_Class::onStorageRequestCompleted(App42CallBack *sender, void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
Not Available
var dbName:String  = "<Your_DataBase_Name>";
var collectionName:String = "<Your_Collection_Name>"; 
var key1:String = "name";  
var value1:String = "Nick";  
var key2:String = "age";  
var value2:int = 30;  
var q1:Query = QueryBuilder.build(key1, value1, Operator.EQUALS);  
var q2:Query = QueryBuilder.build(key2, value2, Operator.GREATER_THAN);  
var query:Query = QueryBuilder.compoundOperator(q1, Operator.OR, q2);  
var jsonDoc:Object  = new Object();
jsonDoc.name = "John"; 
jsonDoc.age = 20; 
App42API.initialize("API_KEY","SECRET_KEY");
var storageService:StorageService = App42API.buildStorageService(); 
storageService.updateDocumentByQuery(dbName, collectionName, query ,jsonDoc ,new callback());	
class callback implements App42CallBack  
{  
	public function onException(exception:App42Exception):void  
	{  
		trace("Exception Message " + exception);  
	}  
	public function onSuccess(response:Object):void  
	{  
		var storage:Storage = Storage(response);
		var jsonDoc:JSONDocument = new JSONDocument(); 
		trace("dbName is " + storage.getDbName());
		trace("Collection Name is :  " + storage.getCollectionName());
		var jsonDocsList:Array = storage.getJsonDocList();
		for(var i:int=0; i < jsonDocsList.length;i++)
		{
			jsonDoc = JSONDocument(jsonDocsList[i]);
			trace("Docid is : " + jsonDoc.getDocId());
			trace("CreatedAt is : " + jsonDoc.getCreatedAt());
			trace("UpdatedAt is :  " + jsonDoc.getUpdatedAt());
			trace("JsonDoc is :  " + jsonDoc.getJsonDoc());
		}
	}  
}
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key1 = "name";   
String value1 = "Nick";  
String key2 = "age";      
int value2 = 30;    
Query q1 = QueryBuilder.build(key1, value1, Operator.EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick
Query q2 = QueryBuilder.build(key2, value2, Operator.GREATER_THAN);	// Build query q2 for key2 equal to age and value2 equal to 30	 
Query query = QueryBuilder.compoundOperator(q1, Operator.OR, q2);   	
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object.   
JSONObject jsonDoc = new JSONObject();
jsonDoc.put("name","John");
jsonDoc.put("age",20);
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.updateDocumentByQuery(dbName,collectionName,query,jsonDoc);  
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
System.out.println("Record Count is "+ storage.getRecordCount());
Vector JsonDocList = storage.getJsonDocList();   
for(int i=0;i < JsonDocList.size();i++)  
{ 
	Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i);  
	System.out.println("objectId is " + jsonDoc.getDocId());  
	System.out.println("CreatedAt is " + jsonDoc.getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDoc.getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDoc.getJsonDoc()); 
}       
Add Or Update Keys With JSON String

This function will allow users to add or update the JSON document keys based on object ID of JSON document. Using this method, you can add new keys or update the exisitng keys in current document. For example, if you have an existing JSON document like “{"name":"Nick Carter","Company":"Shephertz Technologies"}” and you need to update this JSON document with the name with John Carter, then will you need to pass the JSON document with updated value like “{"name":"John Carter","Company":"Shephertz Technologies"}”.

Also, if you want to add a new key in existing document you can easily do by using this method. For example, you have an existing JSON document like: “{“name”:”Nick Carter”,”Company”:”Shephertz Technologies”}” and you need to update this JSON document with name John Carter and first Name is John then in this case you need to pass the JSON document with value like “{“name”:”John Carter”,”firstName”:”John”}” and your new JSON document is: “{“name”:”John Carter”,”firstName”:”John”,”Company”:”Shephertz Technologies”}”.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON keys needs to be updated. docId - ID of the document to be updated for the target JSON doc. keys - JSON document with updated values.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
String keys = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.addOrUpdateKeys(dbName, collectionName, docId, keys, new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
		System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
	} 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());		
}
}); 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
String keys = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.AddOrUpdateKeys(dbName,collectionName,docId,keys, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			Console.WriteLine("DocId is : " + jsonDocList[i].GetDocId());
			Console.WriteLine("JSONDoc is : " + jsonDocList[i].GetJsonDoc());
			Console.WriteLine("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			Console.WriteLine("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
		}  
	}  
}
Not Availabe
let dbName = "<Your_DataBase_Name>"
let collectionName = "<Your_Collection_Name>"
let docId = "docId"
let newJSONDoc = "{\"Company\":\"Shephertz Technologies\"}"
App42API.initializeWithAPIKey(@"API_KEY" andSecretKey:@"SECRET_KEY")    
var storageService = App42API.buildStorageService() as? StorageService 
storageService?.addOrUpdateKeys(dbName, collectionName: collectionName, docId:docId, newJsonDoc:newJSONDoc, completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let storage = response as! Storage
		NSLog("dbName is : %@", storage.dbName)
		NSLog("collectionName is : %@", storage.collectionName)
		let jsonDocList = storage.jsonDocArray
		for jsonDoc in jsonDocList {
			NSLog("Docid is : %@",jsonDoc.docId)
			NSLog("CreatedAt is : %@",jsonDoc.createdAt)
			NSLog("UpdatedAt is : %@",jsonDoc.updatedAt)
			NSLog("JsonDoc is : %@",jsonDoc.jsonDoc)
		}
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
String keys = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.addOrUpdateKeys(dbName,collectionName,docId,keys);  
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
for(int i=0;i<jsonDocList.size();i++)
{
	System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
	System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
}
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
String keys = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.AddOrUpdateKeys(dbName, collectionName, docId, keys, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Storage storage = (Storage) response; 
		App42Log.Console("dbName is " + storage.GetDbName());
		App42Log.Console("collection Name is " + storage.GetCollectionName());
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			App42Log.Console("objectId is " + jsonDocList[i].GetDocId());
			App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc());
			App42Log.Console("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			App42Log.Console("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
		}  
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var dbName = "<Your_DataBase_Name>",
collectionName = "<Your_Collection_Name>",
docId = "docId",
response ;  
var keys = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.addOrUpdateKeys(dbName, collectionName,docId, keys,{  
success: function(object) 
	{  
		var storageObj = JSON.parse(object);
		response = storageObj.app42.response.storage;
		console.log("dbName is " + response.dbName)
		console.log("objectId is " + response.jsonDoc._id.$oid)
		console.log("Created At is "+response.jsonDoc._$createdAt)
		console.log("Updated At is "+response.jsonDoc._$updatedAt)
	},  
	error: function(error) {  
	}  
}); 
local dbName  = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local docId = "docId"
local keys = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}"
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:addOrUpdateKeys(dbName, collectionName,docId, keys,App42CallBack)
function App42CallBack:onSuccess(object)
	print("dbName is "..object:getDbName())
	print("collectionName is "..object:getCollectionName())
	print("DocId is "..object:getJsonDocList():getDocId())
	print("Created At is "..object:getJsonDocList():getCreatedAt())
	print("Updated At is "..object:getJsonDocList():getUpdatedAt())
	print("getJsonDoc is : "..JSON:encode(object:getJsonDocList():getJsonDoc()) )  
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* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
const char* docId = "docId";
const char* jsonDoc = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->AddOrUpdateKeys(dbName, collectionName, docId, jsonDoc, app42callback(Sample_Class::onStorageRequestCompleted, this));

void Sample_Class::onStorageRequestCompleted(void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
String keys = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
Storage storage = storageService.AddOrUpdateKeys(dbName, collectionName, docId, keys);  
Console.WriteLine("dbName is " + storage.GetDbName());
Console.WriteLine("collection Name is " + storage.GetCollectionName());
Console.WriteLine("Record Count is "+ storage.GetRecordCount());
IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
for(int i=0;i <jsonDocList.Count;i++)
{   
	Console.WriteLine("objectId is " + jsonDocList[i].GetDocId());
	Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc());
	Console.WriteLine("CreatedAt is " + jsonDocList[i].GetCreatedAt());  
	Console.WriteLine("UpdatedAtis " + jsonDocList[i].GetUpdatedAt());  
}
$dbName = "<Your_DataBase_Name>";
$collectionName = "<Your_Collection_Name>"; 
$key1 = "name";     
$value = "Nick";       
$key2 = "age";     
$value1 = 30; 
$queryBuilder = new QueryBuilder(); 
$q1 = queryBuilder->build($key1, $value2, Operator::EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick  
Query q2 =  queryBuilder->build($key2, $value2, Operator::GREATER_THAN); // Build query q2 for key2 equal to age and value2 equal to 30     
$query = $queryBuilder->compoundOperator($q1, Operator::ORop, $q2);       
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object. 
$jsonDoc = new JSONObject();
$jsonDoc->put("name","John");
$jsonDoc->put("age",20);
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$storage = $storageService->updateDocumentByQuery($dbName,$collectionName, $query, $jsonDoc);
print_r("Db Name is :".$storage->getDbName());
print_r("Collection Name is :".$storage->getCollectionName());
$jsonDocList = $storage->getJsonDocList();
foreach( $jsonDocList as $jsonDoc )
{
	print_r("docId is : " . $jsonDoc->getDocId());
	print_r("jsonDocs is : " . $jsonDoc->getJsonDoc());
	print_r("updated at is : " . $jsonDoc->getUpdatedAt());
	print_r("created At is : " . $jsonDoc->getCreatedAt());
} 
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
const char* docId = "docId";
const char* jsonDoc = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->AddOrUpdateKeys(dbName, collectionName, docId, jsonDoc, this, app42callfuncND_selector(Sample_Class::onStorageRequestCompleted)); 

void Sample_Class::onStorageRequestCompleted(App42CallBack *sender, void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
Coming Soon
var dbName:String = "<Your_DataBase_Name>";
var collectionName:String = "<Your_Collection_Name>"; 
var docId:String = "docId";
var keys:String = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
App42API.initialize("API_KEY","SECRET_KEY");
var storageService:StorageService = App42API.buildStorageService(); 
storageService.addOrUpdateKeys(dbName,collectionName, docId, keys, new callback());  
public class callback implements App42CallBack  
{  
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
	public function onSuccess(response:Object):void  
	{  
		var storage:Storage = Storage(response);
		trace("dbName is : " + storage.getDbName());
		trace("collectionName is : " + storage.getCollectionName());
		var jsonDocsList:Array = storage.getJsonDocList();
		for(var i:int=0; i < jsonDocsList.length;i++)
		{
			jsonDoc = JSONDocument(jsonDocsList[i]);
			trace("Docid is : " + jsonDoc.getDocId());
			trace("CreatedAt is : " + jsonDoc.getCreatedAt());
			trace("UpdatedAt is :  " + jsonDoc.getUpdatedAt());
			trace("JsonDoc is :  " + jsonDoc.getJsonDoc());
		}
	}  
} 
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
String keys = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.addOrUpdateKeys(dbName, collectionName, docId, keys);  
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
System.out.println("Record Count is "+ storage.getRecordCount());
Vector JsonDocList = storage.getJsonDocList();   
for(int i=0;i < JsonDocList.size();i++)  
{ 
	Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i);  
	System.out.println("objectId is " + jsonDoc.getDocId());  
	System.out.println("CreatedAt is " + jsonDoc.getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDoc.getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDoc.getJsonDoc()); 
}            
Add Or Update Keys With JSON Object

This function will allow users to add or update the JSON document keys based on object ID of JSON document. Using this method, you can add new keys or update the exisitng keys in current document. For example, if you have an existing JSON document like “{"name":"Nick Carter","Company":"Shephertz Technologies"}” and you need to update this JSON document with the name with John Carter, then will you need to pass the JSON document with updated value like “{"name":"John Carter","Company":"Shephertz Technologies"}”.

Also, if you want to add a new key in existing document you can easily do by using this method. For example, you have an existing JSON document like: “{“name”:”Nick Carter”,”Company”:”Shephertz Technologies”}” and you need to update this JSON document with name John Carter and first Name is John then in this case you need to pass the JSON document with value like “{“name”:”John Carter”,”firstName”:”John”}” and your new JSON document is: “{“name”:”John Carter”,”firstName”:”John”,”Company”:”Shephertz Technologies”}”.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON keys needs to be updated. docId - ID of the document to be updated for the target JSON doc. keys - JSON document with updated values.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
JSONObject keys = new JSONObject();
keys.put("name","John");
keys.put("age",20);
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.addOrUpdateKeys(dbName, collectionName, docId, keys, new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
		System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
	} 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());		
}
});
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
JObject keys = new JObject();
keys.Add("name","Nick");
keys.Add("age",30);
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.AddOrUpdateKeys(dbName,collectionName,docId,keys, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			Console.WriteLine("DocId is : " + jsonDocList[i].GetDocId());
			Console.WriteLine("JSONDoc is : " + jsonDocList[i].GetJsonDoc());
			Console.WriteLine("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			Console.WriteLine("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
		}  
	}  
}
NSString *dbName = @"<Your_DataBase_Name>";
NSString *collectionName = @"Your_Collection_Name";
NSString *docId = @"docId";
NSDictionary *jsonDict = [NSDictionary dictionaryWithObjectsAndKeys:@"Nick",@"name", nil];
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService addOrUpdateKeys:dbName collectionName:collectionName docId:docId dataDict:jsonDict completionBlock:^(BOOL success, id responseObj, App42Exception *exception) {
	if (success)
	{
		Storage *storage = (Storage*)responseObj;
		NSLog(@"dbName is %@" , storage.dbName);
		NSLog(@"collectionName is %@" ,  storage.collectionName);
		NSMutableArray *jsonDocArray = storage.jsonDocArray;
		for(JSONDocument *jsonDoc in jsonDocArray)
		{
			NSLog(@"objectId is = %@ ", jsonDoc.docId);
			NSLog(@"jsonDoc is  = %@ ", jsonDoc.jsonDoc);
			NSLog(@"UpdatedAt   = %@ ", jsonDoc.updatedAt);
			NSLog(@"CreatedAt   = %@ ", jsonDoc.createdAt);
		}
	}
	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 dbName = "<Your_DataBase_Name>"
let collectionName = "<Your_Collection_Name>"
let docId = "docId"
let newJSONDoc = ["name":"John"]
App42API.initializeWithAPIKey(@"API_KEY" andSecretKey:@"SECRET_KEY")    
var storageService = App42API.buildStorageService() as? StorageService 
storageService?.addOrUpdateKeys(dbName, collectionName: collectionName, docId:docId, dataDict:newJSONDoc, completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let storage = response as! Storage
		NSLog("dbName is : %@", storage.dbName)
		NSLog("collectionName is : %@", storage.collectionName)
		let jsonDocList = storage.jsonDocArray
		for jsonDoc in jsonDocList {
			NSLog("Docid is : %@",jsonDoc.docId)
			NSLog("CreatedAt is : %@",jsonDoc.createdAt)
			NSLog("UpdatedAt is : %@",jsonDoc.updatedAt)
			NSLog("JsonDoc is : %@",jsonDoc.jsonDoc)
		}
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
JSONObject keys = new JSONObject();
keys.put("name","John");
keys.put("age",20);
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.addOrUpdateKeys(dbName,collectionName,docId,keys);  
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
for(int i=0;i<jsonDocList.size();i++)
{
	System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
	System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
}
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
Dictionary<string,object> keys = new Dictionary<string,object>();
keys.Add("name","Nick");
keys.Add("age",30);
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.AddOrUpdateKeys(dbName, collectionName, docId, keys, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Storage storage = (Storage) response; 
		App42Log.Console("dbName is " + storage.GetDbName());
		App42Log.Console("collection Name is " + storage.GetCollectionName());
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			App42Log.Console("objectId is " + jsonDocList[i].GetDocId());
			App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc());
			App42Log.Console("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			App42Log.Console("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
		}  
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var dbName = "<Your_DataBase_Name>",
collectionName = "<Your_Collection_Name>",
docId = "docId",
response ;  
var keys = new Object();
keys.name = "Nick";
keys.type = "30";
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.addOrUpdateKeys(dbName, collectionName,docId, keys,{  
success: function(object) 
	{  
		var storageObj = JSON.parse(object);
		response = storageObj.app42.response.storage;
		console.log("dbName is " + response.dbName)
		console.log("objectId is " + response.jsonDoc._id.$oid)
		console.log("Created At is "+response.jsonDoc._$createdAt)
		console.log("Updated At is "+response.jsonDoc._$updatedAt)
	},  
	error: function(error) {  
	}  
});  
local dbName  = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local docId = "docId"
local keys = {}
keys.name = "Nick"
keys.age = 30
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:addOrUpdateKeys(dbName, collectionName,docId, keys,App42CallBack)
function App42CallBack:onSuccess(object)
	print("dbName is "..object:getDbName())
	print("collectionName is "..object:getCollectionName())
	print("DocId is "..object:getJsonDocList():getDocId())
	print("Created At is "..object:getJsonDocList():getCreatedAt())
	print("Updated At is "..object:getJsonDocList():getUpdatedAt())
	print("GetJsonDoc is : "..JSON:encode(object:getJsonDocList():getJsonDoc()) )  
	
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* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
const char* docId = "docId";
App42Object *object = new App42Object();
object->setObject("name", "John");
object->setObject("age", "20");
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->AddOrUpdateKeys(dbName, collectionName, docId, object, app42callback(Sample_Class::onStorageRequestCompleted, this));

void Sample_Class::onStorageRequestCompleted(void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
Dictionary<string,object> keys = new Dictionary<string,object>();
keys.Add("name","Nick");
keys.Add("age",30);
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
Storage storage = storageService.AddOrUpdateKeys(dbName, collectionName, docId, keys);  
Console.WriteLine("dbName is " + storage.GetDbName());
Console.WriteLine("collection Name is " + storage.GetCollectionName());
Console.WriteLine("Record Count is "+ storage.GetRecordCount());
IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
for(int i=0;i <jsonDocList.Count;i++)
{   
	Console.WriteLine("objectId is " + jsonDocList[i].GetDocId());
	Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc());
	Console.WriteLine("CreatedAt is " + jsonDocList[i].GetCreatedAt());  
	Console.WriteLine("UpdatedAtis " + jsonDocList[i].GetUpdatedAt());  
}  
$dbName = "<Your_DataBase_Name>";
$collectionName = "<Your_Collection_Name>"; 
$docId = "docId";
$keys = new JSONObject();
$keys->put("name","Nick");
$keys->put("age",30);
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$storage= $storageService->addOrUpdateKeys($dbName, $collectionName, $docId, $keys);
print_r("Db Name is :".$storage->getDbName());
print_r("Collection Name is :".$storage->getCollectionName());
$jsonDocList = $storageObj->getJsonDocList();
foreach( $jsonDocList as $jsonDoc )
{
	print_r("docId is : " . $jsonDoc->getDocId());
	print_r("jsonDocs is : " . $jsonDoc->getJsonDoc());
	print_r("updated at is : " . $jsonDoc->getUpdatedAt());
	print_r("created At is : " . $jsonDoc->getCreatedAt());
}
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
const char* docId = "docId";
App42Object *object = new App42Object();
object->setObject("name", "John");
object->setObject("age", "20");
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->AddOrUpdateKeys(dbName, collectionName, docId, object, this, app42callfuncND_selector(Sample_Class::onStorageRequestCompleted));

void Sample_Class::onStorageRequestCompleted(App42CallBack *sender, void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
Coming Soon
var dbName:String = "<Your_DataBase_Name>";
var collectionName:String = "<Your_Collection_Name>"; 
var docId:String = "docId";
var keys:Object  = new Object();
keys.name = "Nick"; 
keys.age = 30; 
App42API.initialize("API_KEY","SECRET_KEY");
var storageService:StorageService = App42API.buildStorageService(); 
storageService.addOrUpdateKeys(dbName,collectionName, docId, keys, new callback());  
public class callback implements App42CallBack  
{  
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
	public function onSuccess(response:Object):void  
	{  
		var storage:Storage = Storage(response);
		trace("dbName is : " + storage.getDbName());
		trace("collectionName is : " + storage.getCollectionName());
		var jsonDocsList:Array = storage.getJsonDocList();
		for(var i:int=0; i < jsonDocsList.length;i++)
		{
			jsonDoc = JSONDocument(jsonDocsList[i]);
			trace("Docid is : " + jsonDoc.getDocId());
			trace("CreatedAt is : " + jsonDoc.getCreatedAt());
			trace("UpdatedAt is :  " + jsonDoc.getUpdatedAt());
			trace("JsonDoc is :  " + jsonDoc.getJsonDoc());
		}
	}  
} 
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
JSONObject keys = new JSONObject();
keys.put("name","John");
keys.put("age",20);
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.addOrUpdateKeys(dbName, collectionName, docId, keys);  
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
Vector JsonDocList = storage.getJsonDocList();   
for(int i=0;i < JsonDocList.size();i++)  
{ 
	Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i);  
	System.out.println("objectId is " + jsonDoc.getDocId());  
	System.out.println("CreatedAt is " + jsonDoc.getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDoc.getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDoc.getJsonDoc()); 
}           
Add Attachment To Docs

Attach file object in your JSON document.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc needs to be updated. docId - Id of the document to be updated for the target JSON doc. file - InputStream of the file to be uploaded.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
InputStream inputStream = null; /* Get input stream from your source */
App42File file = new App42File();
file.setFileInputStream(inputStream);
file.setFileType(UploadFileType.IMAGE);
file.setName("sample.jpg");
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.addAttachmentToDocs(dbName, collectionName, docId, file, new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
		System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc()); 
		for (int j = 0; j < jsonDocList.get(i).getFileList().size(); j++) {
			System.out.println("Get File Id :"+jsonDocList.get(i).getFileList().get(j).getFileId());
			System.out.println("Url of image : "+jsonDocList.get(i).getFileList().get(j).getUrl());
			System.out.println("File Name :"+jsonDocList.get(i).getFileList().get(j).getName());
			System.out.println("File Type :"+jsonDocList.get(i).getFileList().get(j).getType());
		}
	}	
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());		
}
});
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>";
String docId = "docId";
Stream inputStream = null; /* Get input stream from your source */
App42File file = new App42File();
file.SetFileInputStream(inputStream);
file.SetFileType("image");
file.SetName("sample.jpg");
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.AddAttachmentToDocs(dbName, collectionName, docId, file, Callback());
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			Console.WriteLine("DocId is : " + jsonDocList[i].GetDocId());
			Console.WriteLine("JSONDoc is : " + jsonDocList[i].GetJsonDoc());
			Console.WriteLine("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			Console.WriteLine("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
			for (int j = 0; j < jsonDocList[i].GetFileList().Count(); j++) 
			{
				Console.WriteLine("Get File Id :"+jsonDocList[i].GetFileList()[j].GetFileId());
				Console.WriteLine("Url of image : "+jsonDocList[i].GetFileList()[j].GetUrl());
				Console.WriteLine("File Name :"+jsonDocList[i].GetFileList()[j].GetName());
				Console.WriteLine("File Type :"+jsonDocList[i].GetFileList()[j].GetType());
			}
		}  
	}  
}
NSString *dbName = @"<Your_DataBase_Name>";
NSString *collectionName = @"Your_Collection_Name";
NSString *docId = @"docId";
NSData *imageFileData = nil; /* Get file data from your source */
App42File *file = [[App42File alloc] initWithFileData:imageFileData fileName:@"sample.png" andType:IMAGE];
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService addAttachmentToDocs:dbName collectionName:collectionName docId:docId attachment:file completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Storage *storage =  (Storage*)responseObj;
		NSLog(@"dbName is %@" , storage.dbName);
		NSLog(@"collectionNameId is %@" ,  storage.collectionName);
		NSMutableArray *jsonDocArray = storage.jsonDocArray;               
		for(JSONDocument *jsonDoc in jsonDocArray) 
		{  
			NSLog(@"objectId is = %@ " , jsonDoc.docId);  
			NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc);
			for(App42File *file in jsonDoc.fileList)
			{
				NSLog(@"name is = %@ ", file.name);
				NSLog(@"url = %@ ", file.url);
				NSLog(@"type = %@ ", file.type);
			}			
		}  
	}
	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 dbName = "<Your_DataBase_Name>"
let collectionName = "<Your_Collection_Name>"
let docId = "docId"
let attachmentFile = "App42File"
App42API.initializeWithAPIKey(@"API_KEY" andSecretKey:@"SECRET_KEY")    
var storageService = App42API.buildStorageService() as? StorageService 
storageService?.addAttachmentToDocs(dbName, collectionName: collectionName, docId:docId, attachment:attachmentFile, completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let storage = response as! Storage
		NSLog("dbName is : %@", storage.dbName)
		NSLog("collectionName is : %@", storage.collectionName)
		let jsonDocList = storage.jsonDocArray
		for jsonDoc in jsonDocList {
			NSLog("Docid is : %@",jsonDoc.docId)
			NSLog("CreatedAt is : %@",jsonDoc.createdAt)
			NSLog("UpdatedAt is : %@",jsonDoc.updatedAt)
			NSLog("JsonDoc is : %@",jsonDoc.jsonDoc)
		}
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
InputStream inputStream = null; /* Get input stream from your source */
App42File file = new App42File();
file.setFileInputStream(inputStream);
file.setFileType(UploadFileType.IMAGE);
file.setName("sample.jpg");
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.addAttachmentToDocs(dbName, collectionName, docId, file);
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
for(int i=0;i<jsonDocList.size();i++)
{
	System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
	System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc()); 
	for (int j = 0; j < jsonDocList.get(i).getFileList().size(); j++) 
	{
		System.out.println("Get File Id :"+jsonDocList.get(i).getFileList().get(j).getFileId());
		System.out.println("Url of image : "+jsonDocList.get(i).getFileList().get(j).getUrl());
		System.out.println("File Name :"+jsonDocList.get(i).getFileList().get(j).getName());
		System.out.println("File Type :"+jsonDocList.get(i).getFileList().get(j).getType());
	}
}	
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>";
String docId = "docId";
Stream inputStream = null; /* Get input stream from your source */
App42File file = new App42File();
file.SetFileInputStream(inputStream);
file.SetFileType("image");
file.SetName("sample.jpg");
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.AddAttachmentToDocs(dbName, collectionName, docId, file, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Storage storage = (Storage) response; 
		App42Log.Console("dbName is " + storage.GetDbName());
		App42Log.Console("collection Name is " + storage.GetCollectionName());
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			App42Log.Console("objectId is " + jsonDocList[i].GetDocId());
			App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc());
			App42Log.Console("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			App42Log.Console("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
			
			for (int j = 0; j < jsonDocList[i].GetFileList().Count; j++) 
			{
				App42Log.Console("Get File Id : "+jsonDocList[i].GetFileList()[j].GetFileId());
				App42Log.Console("Url of image : "+jsonDocList[i].GetFileList()[j].GetUrl());
				App42Log.Console("File Name : "+jsonDocList[i].GetFileList()[j].GetName());
				App42Log.Console("File Type : "+jsonDocList[i].GetFileList()[j].GetType());
			}
		}  
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
Coming Soon 
Not Available
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>";
String docId = "docId";
Stream inputStream = null; /* Get input stream from your source */
App42File file = new App42File();
file.SetFileInputStream(inputStream);
file.SetFileType("image");
file.SetName("sample.jpg");
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
Storage storage = storageService.AddAttachmentToDocs(dbName, collectionName, docId, file);  
Console.WriteLine("dbName is " + storage.GetDbName());
Console.WriteLine("collection Name is " + storage.GetCollectionName());
IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
for(int i=0;i <jsonDocList.Count;i++)
{   
	Console.WriteLine("objectId is " + jsonDocList[i].GetDocId());
	Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc());
	Console.WriteLine("CreatedAt is " + jsonDocList[i].GetCreatedAt());  
	Console.WriteLine("UpdatedAtis " + jsonDocList[i].GetUpdatedAt());  
	for (int j = 0; j < jsonDocList[i].GetFileList().Count(); j++) 
	{
		Console.WriteLine("Get File Id :"+jsonDocList[i].GetFileList()[j].GetFileId());
		Console.WriteLine("Url of image : "+jsonDocList[i].GetFileList()[j].GetUrl());
		Console.WriteLine("File Name :"+jsonDocList[i].GetFileList()[j].GetName());
		Console.WriteLine("File Type :"+jsonDocList[i].GetFileList()[j].GetType());
	}
}   
Coming Soon 
Coming Soon
Coming Soon
Not Available
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
InputStream inputStream = null; /* Get input stream from your source */
App42File file = new App42File();
file.setFileInputStream(inputStream);
file.setFileType(UploadFileType.IMAGE);
file.setName("sample.jpg");
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.addAttachmentToDocs(dbName, collectionName, docId, file);
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
Vector JsonDocList = storage.getJsonDocList();   
for(int i=0;i < JsonDocList.size();i++)  
{ 
	Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i);  
	System.out.println("objectId is " + jsonDoc.getDocId());  
	System.out.println("CreatedAt is " + jsonDoc.getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDoc.getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDoc.getJsonDoc()); 
	for (int j = 0; j < jsonDoc.getFileList().size(); j++) 
	{
		App42File fileList = (App42File)jsonDoc.getFileList().elementAt(j);
		System.out.println("Get File Id :" + fileList.getFileId());
		System.out.println("Url of image : " + fileList.getUrl());
		System.out.println("File Name :" + fileList.getName());
		System.out.println("File Type :" + fileList.getType());
	}
}        
Insert JSON With File

Attach file object with insert JSON doc.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc needs to be updated. json - Target JSON document to be saved. file - InputStream of the file to be uploaded.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String json = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
InputStream inputStream = null; /* Get input stream from your source */
App42File file = new App42File();
file.setFileInputStream(inputStream);
file.setFileType(UploadFileType.IMAGE);
file.setName("sample.jpg");
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.insertJSONDocument(dbName, collectionName, json,file ,new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
		System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc()); 
		for (int j = 0; j < jsonDocList.get(i).getFileList().size(); j++) 
		{
			System.out.println("Get File Id :"+jsonDocList.get(i).getFileList().get(j).getFileId());
			System.out.println("Url of image : "+jsonDocList.get(i).getFileList().get(j).getUrl());
			System.out.println("File Name :"+jsonDocList.get(i).getFileList().get(j).getName());
			System.out.println("File Type :"+jsonDocList.get(i).getFileList().get(j).getType());
		}
	}	
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
}); 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String json = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
Stream inputStream = null; /* Get input stream from your source */
App42File file = new App42File();
file.SetFileInputStream(inputStream);
file.SetFileType("image");
file.SetName("sample.jpg");
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.InsertJSONDocument(dbName,collectionName,json,file, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			Console.WriteLine("DocId is : " + jsonDocList[i].GetDocId());
			Console.WriteLine("JSONDoc is : " + jsonDocList[i].GetJsonDoc());
			Console.WriteLine("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			Console.WriteLine("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
			for (int j = 0; j < jsonDocList[i].GetFileList().Count(); j++) 
			{
				Console.WriteLine("Get File Id :"+jsonDocList[i].GetFileList()[j].GetFileId());
				Console.WriteLine("Url of image : "+jsonDocList[i].GetFileList()[j].GetUrl());
				Console.WriteLine("File Name :"+jsonDocList[i].GetFileList()[j].GetName());
				Console.WriteLine("File Type :"+jsonDocList[i].GetFileList()[j].GetType());
			}
		}  
	}  
}
NSString *dbName = @"<Your_DataBase_Name>";
NSString *collectionName = @"Your_Collection_Name";
NSDictionary *jsonDict = [NSDictionary dictionaryWithObjectsAndKeys:@"Nick",@"name", nil];
NSData *imageFileData = nil; /* Get file data from your source */
App42File *file = [[App42File alloc] initWithFileData:imageFileData fileName:@"sample.png" andType:IMAGE];
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService insertJSONDocument:dbName collectionName:collectionName json:[jsonDict JSONRepresentation] attachment:file completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Storage *storage =  (Storage*)responseObj;
		NSLog(@"dbName is %@" , storage.dbName);
		NSLog(@"collectionNameId is %@" ,  storage.collectionName);
		NSMutableArray *jsonDocArray = storage.jsonDocArray;               
		for(JSONDocument *jsonDoc in jsonDocArray) 
		{  
			NSLog(@"objectId is = %@ " , jsonDoc.docId);  
			NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc);
			for(App42File *file in jsonDoc.fileList)
			{
				NSLog(@"name is = %@ ", file.name);
				NSLog(@"url = %@ ", file.url);
				NSLog(@"type = %@ ", file.type);
			}			
		}  
	}
	else
	{
		NSLog(@"Exception = %@",[exception reason]);
		NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
		NSLog(@"App Error Code = %d",[exception appErrorCode]);
		NSLog(@"User Info = %@",[exception userInfo]);
	}
}];
Coming Soon
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String json = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
InputStream inputStream = null; /* Get input stream from your source */
App42File file = new App42File();
file.setFileInputStream(inputStream);
file.setFileType(UploadFileType.IMAGE);
file.setName("sample.jpg");
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.insertJSONDocument(dbName, collectionName, json,file);
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
for(int i=0;i<jsonDocList.size();i++)
{
	System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
	System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc()); 
	for (int j = 0; j < jsonDocList.get(i).getFileList().size(); j++) 
	{
		System.out.println("Get File Id :"+jsonDocList.get(i).getFileList().get(j).getFileId());
		System.out.println("Url of image : "+jsonDocList.get(i).getFileList().get(j).getUrl());
		System.out.println("File Name :"+jsonDocList.get(i).getFileList().get(j).getName());
		System.out.println("File Type :"+jsonDocList.get(i).getFileList().get(j).getType());
	}
}	
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String json = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
Stream inputStream = null; /* Get input stream from your source */
App42File file = new App42File();
file.SetFileInputStream(inputStream);
file.SetFileType("image");
file.SetName("sample.jpg");
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.InsertJSONDocument(dbName, collectionName, json, file, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Storage storage = (Storage) response; 
		App42Log.Console("dbName is " + storage.GetDbName());
		App42Log.Console("collection Name is " + storage.GetCollectionName());
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			App42Log.Console("objectId is " + jsonDocList[i].GetDocId());
			App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc());
			App42Log.Console("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			App42Log.Console("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
			
			for (int j = 0; j < jsonDocList[i].GetFileList().Count; j++) 
			{
				App42Log.Console("Get File Id : "+jsonDocList[i].GetFileList()[j].GetFileId());
				App42Log.Console("Url of image : "+jsonDocList[i].GetFileList()[j].GetUrl());
				App42Log.Console("File Name : "+jsonDocList[i].GetFileList()[j].GetName());
				App42Log.Console("File Type : "+jsonDocList[i].GetFileList()[j].GetType());
			}
		}  
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
Coming Soon 
Not Available 
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String json = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
Stream inputStream = null; /* Get input stream from your source */
App42File file = new App42File();
file.SetFileInputStream(inputStream);
file.SetFileType("image");
file.SetName("sample.jpg");
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
Storage storage = storageService.InsertJSONDocument(dbName, collectionName, json, file);  
Console.WriteLine("dbName is " + storage.GetDbName());
Console.WriteLine("collection Name is " + storage.GetCollectionName());
IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
for(int i=0;i <jsonDocList.Count;i++)
{   
	Console.WriteLine("objectId is " + jsonDocList[i].GetDocId());
	Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc());
	Console.WriteLine("CreatedAt is " + jsonDocList[i].GetCreatedAt());  
	Console.WriteLine("UpdatedAtis " + jsonDocList[i].GetUpdatedAt());  
	for (int j = 0; j < jsonDocList[i].GetFileList().Count(); j++) 
	{
		Console.WriteLine("Get File Id :"+jsonDocList[i].GetFileList()[j].GetFileId());
		Console.WriteLine("Url of image : "+jsonDocList[i].GetFileList()[j].GetUrl());
		Console.WriteLine("File Name :"+jsonDocList[i].GetFileList()[j].GetName());
		Console.WriteLine("File Type :"+jsonDocList[i].GetFileList()[j].GetType());
	}
}   
Coming Soon 
Coming Soon
Coming Soon
Not Available
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String json = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
InputStream inputStream = null; /* Get input stream from your source */
App42File file = new App42File();
file.setFileInputStream(inputStream);
file.setFileType(UploadFileType.IMAGE);
file.setName("sample.jpg");
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.insertJSONDocument(dbName, collectionName, json, file);
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
Vector JsonDocList = storage.getJsonDocList();   
for(int i=0;i < JsonDocList.size();i++)  
{ 
	Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i);  
	System.out.println("objectId is " + jsonDoc.getDocId());  
	System.out.println("CreatedAt is " + jsonDoc.getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDoc.getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDoc.getJsonDoc()); 
	for (int j = 0; j < jsonDoc.getFileList().size(); j++) 
	{
		App42File fileList = (App42File)jsonDoc.getFileList().elementAt(j);
		System.out.println("Get File Id :" + fileList.getFileId());
		System.out.println("Url of image : " + fileList.getUrl());
		System.out.println("File Name :" + fileList.getName());
		System.out.println("File Type :" + fileList.getType());
	}
}          
Insert JSON With File Using JSON Object

Attach file object with insert JSON doc.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc needs to be updated. json - Target JSON document to be saved. file - InputStream of the file to be uploaded.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
JSONObject json = new JSONObject();
json.put("name","Nick");
json.put("age",30);
InputStream inputStream = null; /* Get input stream from your source */
App42File file = new App42File();
file.setFileInputStream(inputStream);
file.setFileType(UploadFileType.IMAGE);
file.setName("sample.jpg");
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.insertJSONDocument(dbName, collectionName, json,file ,new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
		System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc()); 
		for (int j = 0; j < jsonDocList.get(i).getFileList().size(); j++) 
		{
			System.out.println("Get File Id :"+jsonDocList.get(i).getFileList().get(j).getFileId());
			System.out.println("Url of image : "+jsonDocList.get(i).getFileList().get(j).getUrl());
			System.out.println("File Name :"+jsonDocList.get(i).getFileList().get(j).getName());
			System.out.println("File Type :"+jsonDocList.get(i).getFileList().get(j).getType());
		}
	}	
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});  
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
JObject json = new JObject();
json.Add("name","Nick");
json.Add("age",30);
Stream inputStream = null; /* Get input stream from your source */
App42File file = new App42File();
file.SetFileInputStream(inputStream);
file.SetFileType("image");
file.SetName("sample.jpg");
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.InsertJSONDocument(dbName,collectionName,json,file, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			Console.WriteLine("DocId is : " + jsonDocList[i].GetDocId());
			Console.WriteLine("JSONDoc is : " + jsonDocList[i].GetJsonDoc());
			Console.WriteLine("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			Console.WriteLine("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
			for (int j = 0; j < jsonDocList[i].GetFileList().Count(); j++) 
			{
				Console.WriteLine("Get File Id :"+jsonDocList[i].GetFileList()[j].GetFileId());
				Console.WriteLine("Url of image : "+jsonDocList[i].GetFileList()[j].GetUrl());
				Console.WriteLine("File Name :"+jsonDocList[i].GetFileList()[j].GetName());
				Console.WriteLine("File Type :"+jsonDocList[i].GetFileList()[j].GetType());
			}
		}  
	}  
}
Not Availabe
Coming Soon
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
JSONObject json = new JSONObject();
json.put("name","Nick");
json.put("age",30);
InputStream inputStream = null; /* Get input stream from your source */
App42File file = new App42File();
file.setFileInputStream(inputStream);
file.setFileType(UploadFileType.IMAGE);
file.setName("sample.jpg");
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.insertJSONDocument(dbName, collectionName, json,file);
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
for(int i=0;i<jsonDocList.size();i++)
{
	System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
	System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc()); 
	for (int j = 0; j < jsonDocList.get(i).getFileList().size(); j++) 
	{
		System.out.println("Get File Id :"+jsonDocList.get(i).getFileList().get(j).getFileId());
		System.out.println("Url of image : "+jsonDocList.get(i).getFileList().get(j).getUrl());
		System.out.println("File Name :"+jsonDocList.get(i).getFileList().get(j).getName());
		System.out.println("File Type :"+jsonDocList.get(i).getFileList().get(j).getType());
	}
}	
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
Dictionary<string,object> json = new Dictionary<string,object>();
json.Add("name","Nick");
json.Add("age",30);
Stream inputStream = null; /* Get input stream from your source */
App42File file = new App42File();
file.SetFileInputStream(inputStream);
file.SetFileType("image");
file.SetName("sample.jpg");
App42Log.SetDebug(true);		//Print output in your editor console 
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.InsertJSONDocument(dbName, collectionName, json, file, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Storage storage = (Storage) response; 
		App42Log.Console("dbName is " + storage.GetDbName());
		App42Log.Console("collection Name is " + storage.GetCollectionName());
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			App42Log.Console("objectId is " + jsonDocList[i].GetDocId());
			App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc());
			App42Log.Console("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			App42Log.Console("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
			
			for (int j = 0; j < jsonDocList[i].GetFileList().Count; j++) 
			{
				App42Log.Console("Get File Id : "+jsonDocList[i].GetFileList()[j].GetFileId());
				App42Log.Console("Url of image : "+jsonDocList[i].GetFileList()[j].GetUrl());
				App42Log.Console("File Name : "+jsonDocList[i].GetFileList()[j].GetName());
				App42Log.Console("File Type : "+jsonDocList[i].GetFileList()[j].GetType());
			}
		}  
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
Coming Soon 
Not Available 
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
Dictionary<string,object> json = new Dictionary<string,object>();
json.Add("name","Nick");
json.Add("age",30);
Stream inputStream = null; /* Get input stream from your source */
App42File file = new App42File();
file.SetFileInputStream(inputStream);
file.SetFileType("image");
file.SetName("sample.jpg");
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
Storage storage = storageService.InsertJSONDocument(dbName, collectionName, json, file);  
Console.WriteLine("dbName is " + storage.GetDbName());
Console.WriteLine("collection Name is " + storage.GetCollectionName());
IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
for(int i=0;i <jsonDocList.Count;i++)
{   
	Console.WriteLine("objectId is " + jsonDocList[i].GetDocId());
	Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc());
	Console.WriteLine("CreatedAt is " + jsonDocList[i].GetCreatedAt());  
	Console.WriteLine("UpdatedAtis " + jsonDocList[i].GetUpdatedAt());  
	for (int j = 0; j < jsonDocList[i].GetFileList().Count(); j++) 
	{
		Console.WriteLine("Get File Id :"+jsonDocList[i].GetFileList()[j].GetFileId());
		Console.WriteLine("Url of image : "+jsonDocList[i].GetFileList()[j].GetUrl());
		Console.WriteLine("File Name :"+jsonDocList[i].GetFileList()[j].GetName());
		Console.WriteLine("File Type :"+jsonDocList[i].GetFileList()[j].GetType());
	}
}  
Coming Soon 
Coming Soon
Coming Soon
Not Available
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>";
JSONObject json = new JSONObject();
json.put("name","Nick");
json.put("age",30);
InputStream inputStream = null; /* Get input stream from your source */
App42File file = new App42File();
file.setFileInputStream(inputStream);
file.setFileType(UploadFileType.IMAGE);
file.setName("sample.jpg");
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.insertJSONDocument(dbName, collectionName, json, file);
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
Vector JsonDocList = storage.getJsonDocList();   
for(int i=0;i < JsonDocList.size();i++)  
{ 
	Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i);  
	System.out.println("objectId is " + jsonDoc.getDocId());  
	System.out.println("CreatedAt is " + jsonDoc.getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDoc.getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDoc.getJsonDoc()); 
	for (int j = 0; j < jsonDoc.getFileList().size(); j++) 
	{
		App42File fileList = (App42File)jsonDoc.getFileList().elementAt(j);
		System.out.println("Get File Id :" + fileList.getFileId());
		System.out.println("Url of image : " + fileList.getUrl());
		System.out.println("File Name :" + fileList.getName());
		System.out.println("File Type :" + fileList.getType());
	}
}          
Insert JSON With GeoTag

Save the JSON document with geo location in the given database name and collection name.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc has to be saved. json - Target JSON document to be saved.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String json = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
GeoTag gp = new GeoTag();
gp.setLat(new BigDecimal(-73.99171));
gp.setLng(new BigDecimal(40.738868));
storageService.setGeoTag(gp);
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.insertJSONDocument(dbName, collectionName, json,new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();          
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
		System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
	}  
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String json = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
GeoTag gp = new GeoTag();
gp.SetLat(-73.99171);
gp.SetLng(40.738868);
storageService.SetGeoTag(gp);
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.InsertJSONDocument(dbName,collectionName,json, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			Console.WriteLine("DocId is : " + jsonDocList[i].GetDocId());
			Console.WriteLine("JSONDoc is : " + jsonDocList[i].GetJsonDoc());
			Console.WriteLine("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			Console.WriteLine("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
		}  
	}  
}  
NSString *dbName = @"<Your_DataBase_Name>";
NSString *collectionName = @"Your_Collection_Name";
NSString *json = @"{\"name\":\"Nick\",\"age\":40,\"phone\":\"xxx-xxx-xxx\"}";
GeoTag *geoTag = [[GeoTag alloc] initWithLatitude:2.0 andLongitude:20.0];
storageService.geoTag = [geoTag toString];
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService insertJSONDocument:dbName collectionName:collectionName json:json completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Storage *storage =  (Storage*)responseObj;
		NSLog(@"dbName is %@" , storage.dbName);
		NSLog(@"collectionNameId is %@" ,  storage.collectionName);
		NSMutableArray *jsonDocArray = storage.jsonDocArray;               
		for(JSONDocument *jsonDoc in jsonDocArray) 
		{  
			NSLog(@"objectId is = %@ " , jsonDoc.docId);  
			NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); 
			NSLog(@"Loc=(%lf, %lf)",jsonDoc.loc.lat,jsonDoc.loc.lng);
		}  
	}
	else
	{
		NSLog(@"Exception = %@",[exception reason]);
		NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
		NSLog(@"App Error Code = %d",[exception appErrorCode]);
		NSLog(@"User Info = %@",[exception userInfo]);
	}
}];
Coming Soon
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String json = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
GeoTag gp = new GeoTag();
gp.setLat(new BigDecimal(-73.99171));
gp.setLng(new BigDecimal(40.738868));
storageService.setGeoTag(gp);
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.insertJSONDocument(dbName,collectionName,json);  
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();          
for(int i=0;i<jsonDocList.size();i++)
{
	System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
	System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
}  
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String json = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
GeoTag gp = new GeoTag();
gp.SetLat(-73.99171);
gp.SetLng(40.738868);
storageService.SetGeoTag(gp);
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.InsertJSONDocument(dbName, collectionName, json, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			App42Log.Console("objectId is " + jsonDocList[i].GetDocId());
		}  
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var dbName = "<Your_DataBase_Name>",
collectionName = "<Your_Collection_Name>",
json = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
var gp = new GeoTag();
gp.setLat(-73.1234)
gp.setLng(-26.1234)
storageService.setGeoTag(gp);
var response ;  
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.insertJSONDocument(dbName, collectionName, json,{  
	success: function(object) 
	{  
		var storageObj = JSON.parse(object);  
		response = storageObj.app42.response.storage;
		console.log("dbName is " + response.dbName)
		console.log("objectId is " + response.jsonDoc._id.$oid)
	},  
	error: function(error) {  
	}  
}); 
local dbName  = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local json = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}"
local gp = require("App42-Lua-API.GeoTag")
gp:setLat(-73.99171)
gp:setLng(40.738868)
storageService:setGeoTag(gp);
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:insertJSONDocument(dbName, collectionName, json,App42CallBack)
function App42CallBack:onSuccess(object)
	print("dbName is "..object:getDbName())
	print("collectionName is "..object:getCollectionName())
	print("DocId is "..object:getJsonDocList():getDocId())
	print("Created At is "..object:getJsonDocList():getCreatedAt())
	print("Updated At is "..object:getJsonDocList():getUpdatedAt())
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
Coming Soon
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String json = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
GeoTag gp = new GeoTag();
gp.SetLat(-73.99171);
gp.SetLng(40.738868);
storageService.SetGeoTag(gp);
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
Storage storage = storageService.InsertJSONDocument(dbName,collectionName,json);  
Console.WriteLine("dbName is " + storage.GetDbName());
Console.WriteLine("collectionName is " + storage.GetCollectionName());
IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
for(int i=0;i <jsonDocList.Count;i++)
{   
	Console.WriteLine("objectId is " + jsonDocList[i].GetDocId());
	Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc());
}  
$dbName = "<Your_DataBase_Name>";
$collectionName = "<Your_Collection_Name>"; 
$json = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
$gp = new GeoTag();
$gp->setLat(-73.99171);
$gp->setLng(40.738868);
$storageService->setGeoTag($gp);
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$storage = $storageService->insertJSONDocument($dbName, $collectionName, $json); 
print_r("dbName is " . $storage->getDbName());
print_r("collectionName is " . $storage->getCollectionName());
$jsonDocList = $storage->getJsonDocList();
foreach( $jsonDocList as $jsonDoc )
{
	print_r("docId is : " . $jsonDoc->getDocId());
	print_r("jsonDocs is : " . $jsonDoc->getJsonDoc());
	print_r("updated at is : " . $jsonDoc->getUpdatedAt());
	print_r("created At is : " . $jsonDoc->getCreatedAt());
}
$jsonResponse = $storage->toString(); 
Coming Soon
Coming Soon
var dbName:String = "<Your_DataBase_Name>";
var collectionName:String = "<Your_Collection_Name>"; 
var json:String = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
var gp:GeoTag = new GeoTag();
gp.setLat(-73.99171);
gp.setLng(40.738868);
storageService.setGeoTag(gp);
App42API.initialize("API_KEY","SECRET_KEY");
var storageService:StorageService = App42API.buildStorageService(); 
storageService.insertJSONDocument(dbName,collectionName,json, new callback());  
public class callback implements App42CallBack  
{  
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
	public function onSuccess(response:Object):void  
	{  
		var storage:Storage = Storage(response);
		trace("dbName is : " + storage.getDbName());
		trace("collectionName is : " + storage.getCollectionName());
		var jsonDocsList:Array = storage.getJsonDocList();
		for(var i:int=0; i < jsonDocsList.length;i++)
		{
			jsonDoc = JSONDocument(jsonDocsList[i]);
			trace("Docid is : " + jsonDoc.getDocId());
			trace("CreatedAt is : " + jsonDoc.getCreatedAt());
			trace("UpdatedAt is :  " + jsonDoc.getUpdatedAt());
			trace("JsonDoc is :  " + jsonDoc.getJsonDoc());
			if(jsonDoc.getLocation()!=null)
			{
				trace("Lat is : " + jsonDoc.getLocation().getLat());
				trace("Lng is : " + jsonDoc.getLocation().getLng());
			}
		}
	}  
}  
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String json = "{\"name\":\"Nick\",\"age\":30,\"phone\":\"xxx-xxx-xxx\"}";
GeoTag gp = new GeoTag();
gp.setLat(new Double(-74.2713));  
gp.setLng(new Double(40.73137));  
storageService.setGeoTag(gp);
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.insertJSONDocument(dbName,collectionName,json);  
System.out.println("dbName is " + storage.getDbName());
System.out.println("Collection Name is " + storage.getCollectionName());
Vector JsonDocList = storage.getJsonDocList();   
for(int i=0;i < JsonDocList.size();i++)  
{ 
	Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i);  
	System.out.println("objectId is " + jsonDoc.getDocId());  
	System.out.println("CreatedAt is " + jsonDoc.getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDoc.getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDoc.getJsonDoc());
}         
Sorting Of JSON Documents

Find documents in sorted form according to given key stored in the database and collection by using key value search parameter.
Note: Same can be done in all find methods.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc needs to be searched. key - Key to be searched for the target JSON doc. value - Value to be searched for the target JSON doc.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
otherMetaHeaders.put("orderByDescending", "<Name_Of_key_You_Want_To_Sort>");// Use orderByDescending for Descending or orderByAscending for Ascending
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.setOtherMetaHeaders(otherMetaHeaders);
storageService.findDocumentByKeyValue(dbName, collectionName, key, value, new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
		System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
	} 
}
public void onException(Exception ex)
{
	System.out.println("Exception Message"+ex.getMessage());	
}
});  
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>();
otherMetaHeaders.Add("orderByAscending", "<Name_Of_key_You_Want_To_Sort>");// Use orderByDescending for Descending or orderByAscending for Ascending
storageService.SetOtherMetaHeaders(otherMetaHeaders);
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.FindDocumentByKeyValue(dbName,collectionName,key,value, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			Console.WriteLine("DocId is : " + jsonDocList[i].GetDocId());
			Console.WriteLine("JSONDoc is : " + jsonDocList[i].GetJsonDoc());
			Console.WriteLine("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			Console.WriteLine("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
		} 
	}  
}  
NSString *dbName = @"<Your_DataBase_Name>";
NSString *collectionName = @"<Your_Collection_Name>";
NSString *key = @"name";
NSString *value = @"Nick";
// Use orderByDescending for Descending or orderByAscending for Ascending
NSMutableDictionary *otherMetaHeaders = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"orderByAscending",@"<Name_Of_key_You_Want_To_Sort>", nil];

[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService setOtherMetaHeaders:otherMetaHeaders];
[storageService findDocumentByKeyValue:dbName collectionName:collectionName key:key value:value completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Storage *storage =  (Storage*)responseObj;
		NSLog(@"dbName is %@" , storage.dbName);
		NSLog(@"collectionNameId is %@" ,  storage.collectionName);
		NSMutableArray *jsonDocArray = storage.jsonDocArray;               
		for(JSONDocument *jsonDoc in jsonDocArray) 
		{  
			NSLog(@"objectId is = %@ " , jsonDoc.docId);  
			NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); 
		}  
	}
	else
	{
		NSLog(@"Exception = %@",[exception reason]);
		NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
		NSLog(@"App Error Code = %d",[exception appErrorCode]);
		NSLog(@"User Info = %@",[exception userInfo]);
	}
}];
Coming Soon
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
otherMetaHeaders.put("orderByDescending", "<Name_Of_key_You_Want_To_Sort>");// Use orderByDescending for Descending or orderByAscending for Ascending
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.setOtherMetaHeaders(otherMetaHeaders);
Storage storage = storageService.findDocumentByKeyValue(dbName,collectionName,key,value);  
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
for(int i=0;i<jsonDocList.size();i++)
{
	System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
	System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
}   
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
App42Log.SetDebug(true);		//Print output in your editor console
Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>();
otherMetaHeaders.Add("orderByAscending", "<Name_Of_key_You_Want_To_Sort>");// Use orderByDescending for Descending or orderByAscending for Ascending
storageService.SetOtherMetaHeaders(otherMetaHeaders);
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.FindDocumentByKeyValue(dbName, collectionName, key, value, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			App42Log.Console("objectId is " + jsonDocList[i].GetDocId());
			App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc());
		}  
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var dbName = "<Your_DataBase_Name>",
collectionName = "<Your_Collection_Name>",
key = "key",
value = "value",
response ;  
var otherMetaHeaders={orderByAscending:"<Name_Of_key_You_Want_To_Sort>"};//Use orderByDescending for Descending or orderByAscending for Ascending                  
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.setOtherMetaHeaders(otherMetaHeaders);
storageService.findDocumentByKeyValue(dbName,collectionName,key,value,{  
	success: function(object) 
	{  
		var storageObj = JSON.parse(object);  
		response = storageObj.app42.response.storage;
		console.log("dbName is " + response.dbName)
	},  
	error: function(error) {  
	}  
}); 
local dbName  = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local key = "name"
local value = "Nick"
local App42CallBack = {}
otherMetaHeaders.orderByAscending= "<Name_Of_key_You_Want_To_Sort>";//Use orderByDescending for Descending or orderByAscending for Ascending
storageService:setOtherMetaHeaders(otherMetaHeaders);
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:findDocumentByKeyValue(dbName, collectionName,key,value,App42CallBack)
function App42CallBack:onSuccess(object)
	print("dbName is "..object:getDbName())
	for i=1,table.getn(object:getJsonDocList()) do
		print("DocId is "..object:getJsonDocList()[i]:getDocId())
		print("CreatedAt is "..object:getJsonDocList()[i]:getCreatedAt())
	end
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
map<string,string>otherMetaHeaders;
otherMetaHeaders["orderByAscending"] = "<Name_Of_key_You_Want_To_Sort>";// Use orderByDescending for Descending or orderByAscending for Ascending as key
const char* key="name";
const char* value = "Nick";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->FindDocumentByKeyValue(dbName, collectionName,key,value,app42callback(Sample_Class::onStorageRequestCompleted, this));

void Sample_Class::onStorageRequestCompleted(void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>();
otherMetaHeaders.Add("orderByAscending", "<Name_Of_key_You_Want_To_Sort>");// Use orderByDescending for Descending or orderByAscending for Ascending
storageService.SetOtherMetaHeaders(otherMetaHeaders);
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
Storage storage = storageService.FindDocumentByKeyValue(dbName,collectionName,key,value);  
Console.WriteLine("dbName is " + storage.GetDbName());
IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
for(int i=0;i <jsonDocList.Count;i++)
{   
	Console.WriteLine("objectId is " + jsonDocList[i].GetDocId());
	Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc());
}
$dbName = "<Your_DataBase_Name>";
$collectionName = "<Your_Collection_Name>";
$key = "name"; 
$value = "Nick"; 
$otherMetaHeaders = array();
$otherMetaHeaders['orderByAscending'] ="<Name_Of_key_You_Want_To_Sort>";//Use orderByDescending for Descending or orderByAscending for Ascending
$storageService->setOtherMetaHeaders($otherMetaHeaders);
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$storage = $storageService->findDocumentByKeyValue($dbName,$collectionName,$key,$value); 
print_r("dbName is " . $storage->getDbName());
print_r("Collection Name is :".$storage->getCollectionName());
$jsonDocList = $storage->getJsonDocList();
foreach( $jsonDocList as $jsonDoc )
{
	print_r("docId is : " . $jsonDoc->getDocId());
	print_r("jsonDocs is : " . $jsonDoc->getJsonDoc());
	print_r("updated at is : " . $jsonDoc->getUpdatedAt());
	print_r("created At is : " . $jsonDoc->getCreatedAt());
}
$jsonResponse = $storage->toString(); 
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";
map<string,string>otherMetaHeaders;
otherMetaHeaders["orderByAscending"] = "<Name_Of_key_You_Want_To_Sort>";// Use orderByDescending for Descending or orderByAscending for Ascending as key
const char* key="name";
const char* value = "Nick";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->FindDocumentByKeyValue(dbName, collectionName,key,value,this, app42callfuncND_selector(Sample_Class::onStorageRequestCompleted));

void Sample_Class::onStorageRequestCompleted(App42CallBack *sender, void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        for(std::vector<App42Storage>::iterator it = storageResponse->storages.begin(); it != storageResponse->storages.end(); ++it)
        {
            printf("\n DbName=%s",it->dbName.c_str());
            printf("\n CollectionName=%s",it->collectionName.c_str());            
            for(std::vector<JSONDocument>::iterator iit = it->jsonDocArray.begin(); iit != it->jsonDocArray.end(); ++iit)
            {
                printf("\n CreatedAt=%s",iit->getCreatedAt().c_str());
                printf("\n DocId=%s",iit->getDocId().c_str());
                printf("\n Owner=%s",iit->getOwner().c_str());
                printf("\n UpdatedAt=%s",iit->getUpdatedAt().c_str());
                printf("\n JsonDoc=%s\n",iit->getJsonDoc().c_str());
            }
        }
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
    }
}
Coming Soon
var dbName:String = "<Your_DataBase_Name>";
var collectionName:String = "<Your_Collection_Name>"; 
var key:String = "name"; 
var value:String = "Nick"; 
var otherMetaHeaders:Dictionary = new Dictionary();
otherMetaHeaders["orderByAscending"] = "<Name_Of_key_You_Want_To_Sort>";//Use orderByDescending for Descending or orderByAscending for Ascending
App42API.initialize("API_KEY","SECRET_KEY");
var storageService:StorageService = App42API.buildStorageService(); 
storageService.setOtherMetaHeaders(otherMetaHeaders);
storageService.findDocumentByKeyValue(dbName,collectionName,key,value,new callback());  
public class callback implements App42CallBack  
{  
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
	public function onSuccess(response:Object):void  
	{  
		var storage:Storage = Storage(response);
		trace("dbName is : " + storage.getDbName());
		trace("collectionName is : " + storage.getCollectionName());
		var jsonDoc:JSONDocument = new JSONDocument(); 
		for(var i:int  = 0; i<storage.getJsonDocList().length;i++)
		{						
			jsonDoc = JSONDocument(storage.getJsonDocList()[i]);
			trace("objectId is :  " + jsonDoc.getDocId());
			trace("jsonDoc is :  " + jsonDoc.getJsonDoc());
		}
	}  
}  
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String key = "name"; 
String value = "Nick"; 
HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
otherMetaHeaders.put("orderByDescending", "<Name_Of_key_You_Want_To_Sort>");// Use orderByDescending for Descending or orderByAscending for Ascending
storageService.setOtherMetaHeaders(otherMetaHeaders);
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.findDocumentByKeyValue(dbName,collectionName,key,value);  
System.out.println("dbName is " + storage.getDbName());
Vector JsonDocList = storage.getJsonDocList();   
for(int i=0;i < JsonDocList.size();i++)  
{ 
	Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i);  
	System.out.println("objectId is " + jsonDoc.getDocId());  
	System.out.println("CreatedAt is " + jsonDoc.getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDoc.getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDoc.getJsonDoc());
}         
Find Specific Key From JSON Document

Find specific keys from the JSON doc in the database and collection.
Note: Same can be done in all find methods.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc has to be saved.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>";
Set<String> selectKeys = new HashSet<String>();
selectKeys.add("<Name_Of_the_Key>");
storageService.setSelectKeys(selectKeys); 
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.findAllDocuments(dbName, collectionName, new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage..getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
	} 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});   
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>";
HashSet<string> selectKeys = new HashSet<string> ();
selectKeys.Add("Name");
storageService.SetSelectKeys (selectKeys); 
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.FindAllDocuments(dbName,collectionName, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			Console.WriteLine("DocId is : " + jsonDocList[i].GetDocId());
			Console.WriteLine("JSONDoc is : " + jsonDocList[i].GetJsonDoc());
		}  
	}  
}  
NSString *dbName = @"<Your_DataBase_Name>";
NSString *collectionName = @"Your_Collection_Name";
NSMutableArray *selectKeys = [NSMutableArray arrayWithObjects:@"<Name_Of_the_Key>", nil];
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService setSelectKeys:selectKeys];
[storageService findAllDocuments:dbName collectionName:collectionName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Storage *storage =  (Storage*)responseObj;
		NSLog(@"dbName is %@" , storage.dbName);
		NSLog(@"collectionNameId is %@" ,  storage.collectionName);
		NSMutableArray *jsonDocArray = storage.jsonDocArray;               
		for(JSONDocument *jsonDoc in jsonDocArray) 
		{  
			NSLog(@"objectId is = %@ " , jsonDoc.docId);  
			NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); 
		}  
	}
	else
	{
		NSLog(@"Exception = %@",[exception reason]);
		NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);
		NSLog(@"App Error Code = %d",[exception appErrorCode]);
		NSLog(@"User Info = %@",[exception userInfo]);
	}
}];
Coming Soon   
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
Set<String> selectKeys = new HashSet<String>();
selectKeys.add("<Name_Of_the_Key>");
storageService.setSelectKeys(selectKeys); 
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.findAllDocuments(dbName,collectionName);  
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
for(int i=0;i<jsonDocList.size();i++)
{
	System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
	System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
}   
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
App42Log.SetDebug(true);		//Print output in your editor console
HashSet<string> selectKeys = new HashSet<string> ();
selectKeys.Add("Name");
storageService.SetSelectKeys (selectKeys);
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.FindAllDocuments(dbName,collectionName, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			App42Log.Console("objectId is " + jsonDocList[i].GetDocId());
			App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc());
		}  
	}
	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var dbName = "<Your_DataBase_Name>",
collectionName = "<Your_Collection_Name>",
response ;  
var selectKeys = new Array();
selectKeys.push("<Name_Of_the_Key>");
storageService.setSelectKeys(selectKeys);
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.findAllDocuments(dbName,collectionName,{  
	success: function(object) 
	{  
		var storageObj = JSON.parse(object);
		console.log(storageObj)
		response = storageObj.app42.response.storage.jsonDoc;
		if (response instanceof Array) {
		for(var i=0;i<response.length;i++)  
	   {
			console.log(response[i])
			console.log(response[i]._id.$oid)
			console.log(response[i]._$createdAt)
			console.log(response[i]._$updatedAt)
	   }
	} else {
		console.log(response._id.$oid)
		console.log(response._$createdAt)
		console.log(response._$updatedAt)
	}
	},  
	error: function(error) {  
	}  
}); 

local dbName  = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local App42CallBack = {}
local selectKeys={}
selectKeys[1]=("<Name_Of_the_Key>");
storageService.setSelectKeys(selectKeys);
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:findAllDocuments(dbName, collectionName, App42CallBack)
function App42CallBack:onSuccess(object)
	print("dbName is "..object:getDbName())
	for i=1,table.getn(object:getJsonDocList()) do
		print("DocId is "..object:getJsonDocList()[i]:getDocId())
		print("CreatedAt is "..object:getJsonDocList()[i]:getCreatedAt())
	end
end
function App42CallBack:onException(exception)
	print("Message is : "..exception:getMessage())
	print("App Error code is : "..exception:getAppErrorCode())
	print("Http Error code is "..exception:getHttpErrorCode())
	print("Detail is : "..exception:getDetails())
end
Coming Soon
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
HashSet<string> selectKeys = new HashSet<string> ();
selectKeys.Add("Name");
storageService.SetSelectKeys (selectKeys);
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
Storage storage = storageService.FindAllDocuments(dbName,collectionName);  
Console.WriteLine("dbName is " + storage.GetDbName());
IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
for(int i=0;i <jsonDocList.Count;i++)
{   
	Console.WriteLine("objectId is " + jsonDocList[i].GetDocId());
	Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc());
}  
$dbName = "<Your_DataBase_Name>";
$collectionName = "<Your_Collection_Name>"; 
$selectKeys = array();
array_push($selectKeys, "<Name_Of_the_Key>");
$storageService->setSelectKeys($selectKeys);
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$storage = $storageService->findAllDocuments($dbName,$collectionName); 
print_r("dbName is :" . $storage->getDbName());
 print_r("Collection Name is :".$storage->getCollectionName());
$jsonDocList = $storage->getJsonDocList();
foreach( $jsonDocList as $jsonDoc )
{
	print_r("docId is : " . $jsonDoc->getDocId());
	print_r("jsonDocs is : " . $jsonDoc->getJsonDoc());
}
$jsonResponse = $storage->toString(); 
Coming Soon
Coming Soon
var dbName:String = "<Your_DataBase_Name>";
var collectionName:String = "<Your_Collection_Name>"; 
var selectKeys:Array =new Array();
selectKeys.push("<Name_Of_the_Key>");
App42API.initialize("API_KEY","SECRET_KEY");
var storageService:StorageService = App42API.buildStorageService(); 
storageService.setSelectKeys(selectKeys);
storageService.findAllDocuments(dbName,collectionName, new callback());  
public class callback implements App42CallBack  
{  
	public function onException(excption:App42Exception):void  
	{  
		trace("Exception Message");  
	}  
	public function onSuccess(response:Object):void  
	{ 
		var storage:Storage = Storage(response);
		trace("dbName is : " + storage.getDbName());
		trace("collectionName is : " + storage.getCollectionName());
		var jsonDoc:JSONDocument = new JSONDocument(); 
		for(var i:int  = 0; i<storage.getJsonDocList().length;i++)
		{						
			jsonDoc = JSONDocument(storage.getJsonDocList()[i]);
			trace("objectId is :  " + jsonDoc.getDocId());
			trace("jsonDoc is :  " + jsonDoc.getJsonDoc());
		}
	}  
}  
Coming Soon 
Coming Soon
Increment Key By Doc Id

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc needs to be deleted. docId - Unique Object Id handler. key - Key to be searched which value is to be incremented. value - Value to be icremented in the target JSON doc.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>";
String docId = "docId";
String key = "count"; 
BigDecimal value = new BigDecimal(3500);
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.incrementKeyByDocId(dbName, collectionName,docId,key, value, new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
	} 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});   
Coming Soon
Coming Soon
Coming Soon         
Coming Soon 
Coming Soon
Coming Soon
Coming Soon
Coming Soon
Coming Soon  
Coming Soon
Coming Soon
Coming Soon
Coming Soon
Coming Soon 
Coming Soon
Revoke Access On Doc

This function allows you to revoke permission specified in the ACL list for a user on a given document id.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc needs to be revoked. docId - Unique Object Id handler. aclList - object contains the username and the permission to be granted/ revoked. The Default user name in aclList is set to PUBLIC. In this case, permission is granted/ revoked from all the users accessing the service.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
HashSet<ACL> aclSet = new HashSet<ACL>();
aclSet.add(new ACL("PUBLIC", Permission.READ));  
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.revokeAccessOnDoc(dbName, collectionName, docId, aclSet, new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
		System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
	} 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());	
}
});   
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
IList<ACL> aclSet = new List<ACL>();
aclSet.Add(new ACL("PUBLIC", Permission.READ));
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.RevokeAccessOnDoc(dbName, collectionName, docId, aclSet, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Storage storage = (Storage) response;
		Console.WriteLine("dbName is " + storage.GetDbName());
		Console.WriteLine("collection Name is " + storage.GetCollectionName());
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0; i<jsonDocList.Count; i++)
		{   
			Console.WriteLine("DocId is : " + jsonDocList[i].GetDocId());
			Console.WriteLine("JSONDoc is : " + jsonDocList[i].GetJsonDoc());
			Console.WriteLine("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			Console.WriteLine("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
		}
	}  
} 
NSString *dbName = @"<Your_DataBase_Name>";
NSString *collectionName = @"Your_Collection_Name";
NSString *docId = @"docId";
ACL *acl = [[ACL alloc] initWithUserName:@"PUBLIC" andPermission:APP42_READ];
NSArray *aclList = [NSArray arrayWithObject:acl];
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService revokeAccessOnDoc:dbName collectionName:collectionName docId:docId andAclList:aclList completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Storage *storage =  (Storage*)responseObj;
		NSLog(@"dbName is %@" , storage.dbName);
		NSLog(@"collectionNameId is %@" ,  storage.collectionName);
		NSMutableArray *jsonDocArray = storage.jsonDocArray;               
		for(JSONDocument *jsonDoc in jsonDocArray) 
		{  
			NSLog(@"objectId is = %@ " , jsonDoc.docId);  
			NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); 
		}  
	}
	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 dbName = "<Your_DataBase_Name>"
let collectionName = "<Your_Collection_Name>"
let docId = "docId"
let aclList = ""
App42API.initializeWithAPIKey(@"API_KEY" andSecretKey:@"SECRET_KEY")    
var storageService = App42API.buildStorageService() as? StorageService 
storageService?.revokeAccessOnDoc(dbName, collectionName: collectionName, docId: docId, andAclList:aclList, completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let storage = response as! Storage
		NSLog("dbName is : %@", storage.dbName)
		NSLog("collectionName is : %@", storage.collectionName)
		let jsonDocList = storage.jsonDocArray
		for jsonDoc in jsonDocList {
			NSLog("Docid is : %@",jsonDoc.docId)
			NSLog("CreatedAt is : %@",jsonDoc.createdAt)
			NSLog("UpdatedAt is : %@",jsonDoc.updatedAt)
			NSLog("JsonDoc is : %@",jsonDoc.jsonDoc)
		}
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
HashSet<ACL> aclSet = new HashSet<ACL>();
aclSet.add(new ACL("PUBLIC", Permission.READ));  
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.revokeAccessOnDoc(dbName, collectionName, docId, aclSet);
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
for(int i=0;i<jsonDocList.size();i++)
{
	System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
	System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
}    
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
HashSet<ACL> aclSet = new HashSet<ACL>();
aclSet.Add(new ACL("PUBLIC", Permission.READ));
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.RevokeAccessOnDoc(dbName, collectionName, docId, aclSet, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			App42Log.Console("objectId is " + jsonDocList[i].GetDocId());
			App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc());
		}  
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var dbName = "<Your_DataBase_Name>",
collectionName = "<Your_Collection_Name>",
docId = "docId",
response ;  
var aclList = new Array();
var point1={
user:"PUBLIC",
permission:Permission.READ,
};
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.revokeAccessOnDoc(dbName, collectionName,docId, aclList,{  
success: function(object) 
	{  
	var storage = JSON.parse(object);  
	response = storage.app42.response.storage;
	console.log("dbName is " + response.dbName)
	},  
	error: function(error) {  
	}  
});
local dbName  = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local docId = "docId"
local aclList = {}
local acl  = ACL:new()
acl:setUser("PUBLIC")
acl:setPermission(Permission.READ)
aclList[1] = acl
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:revokeAccessOnDoc(dbName,collectionName,docId, aclList,App42CallBack)
function App42CallBack:onSuccess(object)
	print(object:getResponseSuccess())
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
Coming Soon
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
HashSet<ACL> aclSet = new HashSet<ACL>();
aclSet.Add(new ACL("PUBLIC", Permission.READ));
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
Storage storage = storageService.RevokeAccessOnDoc(dbName, collectionName, docId, aclSet);
Console.WriteLine("dbName is " + storage.GetDbName());		
IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
for(int i=0;i <jsonDocList.Count;i++)
{   
	Console.WriteLine("objectId is " + jsonDocList[i].GetDocId());
	Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc());
}
$dbName = "<Your_DataBase_Name>";
$collectionName = "<Your_Collection_Name>"; 
$docId = "docId";
$aclSet = array();
array_push($aclSet, new ACL("PUBLIC", Permission::READ));
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$storage= $storageService->revokeAccessOnDoc($dbName, $collectionName, $docId, $aclSet); 
print_r("dbName is " . $storage->getDbName());
print_r("Collection Name is :".$storage->getCollectionName());
$jsonDocList = $storage->getJsonDocList();
foreach( $jsonDocList as $jsonDoc )
{
	print_r("docId is : " . $jsonDoc->getDocId());
	print_r("jsonDocs is : " . $jsonDoc->getJsonDoc());
	print_r("updated at is : " . $jsonDoc->getUpdatedAt());
	print_r("created At is : " . $jsonDoc->getCreatedAt());
}
$jsonResponse = $storage->toString(); 
Coming Soon
Coming Soon
Coming Soon
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
Hashtable aclSet = new Hashtable();
aclSet.put("PUBLIC", ACL.PERMISSION_READ);
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.revokeAccessOnDoc(dbName, collectionName, docId, aclSet);
System.out.println("dbName is "+ storage.getDbName());

Vector JsonDocList = storage.getJsonDocList();   
for(int i=0;i < JsonDocList.size();i++)  
{ 
	Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i);  
	System.out.println("objectId is " + jsonDoc.getDocId()); 
	System.out.println("CreatedAt is " + jsonDoc.getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDoc.getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDoc.getJsonDoc());
}         
Grant Access On Doc

This function allows you to grant permission specified in the ACL list to a user on a given document ID.

Required Parameters

dbName - Unique handler for storage name. collectionName - Name of collection under which JSON doc needs to be granted. docId - Unique Object ID handler. aclList - Object contains the username and the permission to be granted/revoked. The default user name in aclList is set to PUBLIC. In this case, permission is granted/revoked from all the users accessing the service.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
HashSet<ACL> aclSet = new HashSet<ACL>();
aclSet.add(new ACL("PUBLIC", Permission.READ));  
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.grantAccessOnDoc(dbName, collectionName, docId, aclSet, new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
		System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
	} 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());	
}
});   
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
IList<ACL> aclSet = new List<ACL>();
aclSet.Add(new ACL("PUBLIC", Permission.READ));
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.GrantAccessOnDoc(dbName, collectionName, docId, aclSet, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Storage storage = (Storage) response;
		Console.WriteLine("dbName is " + storage.GetDbName());
		Console.WriteLine("collection Name is " + storage.GetCollectionName());
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0; i<jsonDocList.Count; i++)
		{   
			Console.WriteLine("DocId is : " + jsonDocList[i].GetDocId());
			Console.WriteLine("JSONDoc is : " + jsonDocList[i].GetJsonDoc());
			Console.WriteLine("CreatedAt is : " + jsonDocList[i].GetCreatedAt());
			Console.WriteLine("UpdatedAt is : " + jsonDocList[i].GetUpdatedAt());
		} 
	}  
} 
NSString *dbName = @"<Your_DataBase_Name>";
NSString *collectionName = @"Your_Collection_Name";
NSString *docId = @"docId";
ACL *acl = [[ACL alloc] initWithUserName:@"PUBLIC" andPermission:APP42_READ];
NSArray *aclList = [NSArray arrayWithObject:acl];
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService grantAccessOnDoc:dbName collectionName:collectionName docId:docId andAclList:aclList completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Storage *storage =  (Storage*)responseObj;
		NSLog(@"dbName is %@" , storage.dbName);
		NSLog(@"collectionNameId is %@" ,  storage.collectionName);
		NSMutableArray *jsonDocArray = storage.jsonDocArray;               
		for(JSONDocument *jsonDoc in jsonDocArray) 
		{  
			NSLog(@"objectId is = %@ " , jsonDoc.docId);  
			NSLog(@"jsonDoc is = %@ " , jsonDoc.jsonDoc); 
		}  
	}
	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 dbName = "<Your_DataBase_Name>"
let collectionName = "<Your_Collection_Name>"
let docId = "docId"
let aclList = ""
App42API.initializeWithAPIKey(@"API_KEY" andSecretKey:@"SECRET_KEY")    
var storageService = App42API.buildStorageService() as? StorageService 
storageService?.grantAccessOnDoc(dbName, collectionName: collectionName, docId: docId, andAclList:aclList, completionBlock: { (success, response, exception) -> Void in
	if(success)
	{
		let storage = response as! Storage
		NSLog("dbName is : %@", storage.dbName)
		NSLog("collectionName is : %@", storage.collectionName)
		let jsonDocList = storage.jsonDocArray
		for jsonDoc in jsonDocList {
			NSLog("Docid is : %@",jsonDoc.docId)
			NSLog("CreatedAt is : %@",jsonDoc.createdAt)
			NSLog("UpdatedAt is : %@",jsonDoc.updatedAt)
			NSLog("JsonDoc is : %@",jsonDoc.jsonDoc)
		}
	}
	else
	{
		NSLog("%@", exception.reason!)
		NSLog("%d", exception.appErrorCode)
		NSLog("%d", exception.httpErrorCode)
		NSLog("%@", exception.userInfo!)
	}
})
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
HashSet<ACL> aclSet = new HashSet<ACL>();
aclSet.add(new ACL("PUBLIC", Permission.READ));  
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.grantAccessOnDoc(dbName, collectionName, docId, aclSet);
System.out.println("dbName is " + storage.getDbName());
System.out.println("collection Name is " + storage.getCollectionName());
ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
for(int i=0;i<jsonDocList.size();i++)
{
	System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
	System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
}    
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
HashSet<ACL> aclSet = new HashSet<ACL>();
aclSet.Add(new ACL("PUBLIC", Permission.READ));
App42Log.SetDebug(true);		//Print output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.GrantAccessOnDoc(dbName, collectionName, docId, aclSet, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		Storage storage = (Storage) response;
		IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
		for(int i=0;i <jsonDocList.Count;i++)
		{   
			App42Log.Console("objectId is " + jsonDocList[i].GetDocId());
			App42Log.Console("jsonDoc is " + jsonDocList[i].GetJsonDoc());
		}  
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
var dbName = "<Your_DataBase_Name>",
collectionName = "<Your_Collection_Name>",
docId = "docId",
response ;  
var aclList = new Array();
var point1={
user:"PUBLIC",
permission:Permission.READ,
};
aclList.push(point1);
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.grantAccessOnDoc(dbName, collectionName,docId, aclList,{  
success: function(object) 
	{  
	var storage = JSON.parse(object);  
	response = storage.app42.response.storage;
	console.log("dbName is " + response.dbName)
	},  
	error: function(error) {  
	}  
});
local dbName  = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local docId = "docId"
local aclList = {}
local acl  = ACL:new()
acl:setUser("PUBLIC")
acl:setPermission(Permission.READ)
aclList[1] = acl
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:grantAccessOnDoc(dbName,collectionName,docId, aclList,App42CallBack)
function App42CallBack:onSuccess(object)
	print(object:getResponseSuccess())
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
Coming Soon
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
HashSet<ACL> aclSet = new HashSet<ACL>();
aclSet.Add(new ACL("PUBLIC", Permission.READ));
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
Storage storage = storageService.GrantAccessOnDoc(dbName, collectionName, docId, aclSet);
Console.WriteLine("dbName is " + storage.GetDbName());		
IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); 
for(int i=0;i <jsonDocList.Count;i++)
{   
	Console.WriteLine("objectId is " + jsonDocList[i].GetDocId());
	Console.WriteLine("jsonDoc is " + jsonDocList[i].GetJsonDoc());
}
$dbName = "<Your_DataBase_Name>";
$collectionName = "<Your_Collection_Name>"; 
$docId = "docId";
$aclSet = array();
array_push($aclSet, new ACL("PUBLIC", Permission::READ));
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
$storage= $storageService->grantAccessOnDoc($dbName, $collectionName, $docId, $aclSet); 
print_r("dbName is " . $storage->getDbName());
print_r("Collection Name is :".$storage->getCollectionName());
$jsonDocList = $storage->getJsonDocList();
foreach( $jsonDocList as $jsonDoc )
{
	print_r("docId is : " . $jsonDoc->getDocId());
	print_r("jsonDocs is : " . $jsonDoc->getJsonDoc());
	print_r("updated at is : " . $jsonDoc->getUpdatedAt());
	print_r("created At is : " . $jsonDoc->getCreatedAt());
}
$jsonResponse = $storage->toString(); 
Coming Soon
Coming Soon
Coming Soon
Coming Soon 
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "docId";
Hashtable aclSet = new Hashtable();
aclSet.put("PUBLIC", ACL.PERMISSION_READ);
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
Storage storage = storageService.grantAccessOnDoc(dbName, collectionName, docId, aclSet);
System.out.println("dbName is "+ storage.getDbName());

Vector JsonDocList = storage.getJsonDocList();   
for(int i=0;i < JsonDocList.size();i++)  
{ 
	Storage.JSONDocument jsonDoc = (Storage.JSONDocument)JsonDocList.elementAt(i);  
	System.out.println("objectId is " + jsonDoc.getDocId()); 
	System.out.println("CreatedAt is " + jsonDoc.getCreatedAt());  
	System.out.println("UpdatedAtis " + jsonDoc.getUpdatedAt());  
	System.out.println("Jsondoc is " + jsonDoc.getJsonDoc());
}         
Exception Handling

The functions available under Storage API can throw some exceptions in abnormal conditions. An example of the same has been given below. E.g. If an App developer is requesting for the document that does not exist, the function will throw the App42Exception (as shown below) with the message as “Not Found” and the appErrorCode as “2600” and the details as “Document by the Id ‘4faa3f1ac68df147a51f8bd7’ does not exist”.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "4faa3f1ac68df147a51f8bd7";
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
storageService.findDocumentById(dbName, collectionName, docId, new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
		System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
	} 
}
public void onException(Exception ex) 
{
	App42Exception exception = (App42Exception)ex;
	int appErrorCode = exception.getAppErrorCode();
	int httpErrorCode = exception.getHttpErrorCode();
	if(appErrorCode == 2600)
	{
	// Handle here for Not Found (Document by the Id '4faa3f1ac68df147a51f8bd7' does not exist.)
	}
	else if(appErrorCode  == 2606)
	{
	// Handle here for Bad Request (Document Id '4faa3f1ac68df147a5' is not valid.)
	}
	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 dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "4faa3f1ac68df147a51f8bd7";
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService();  
storageService.FindDocumentById(dbName,collectionName,docId, 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 == 2600)
		{
			// Handle here for Not Found (Document by the Id '4faa3f1ac68df147a51f8bd7' does not exist.)
		}
		else if(appErrorCode  == 2606)
		{
			// Handle here for Bad Request (Document Id '4faa3f1ac68df147a7' is not valid.)
		}
		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)  
	{  
		Storage storage = (Storage) response;
		String jsonResponse = storage.ToString();  
	} 
}  
	
NSString *dbName = @"<Your_DataBase_Name>";
NSString *collectionName = @"<Your_Collection_Name>"; 
NSString *docId = @"4faa3f1ac68df147a51f8bd7";
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];
StorageService *storageService = [App42API buildStorageService]; 
[storageService findDocumentById:dbName collectionName:collectionName docId:docId completionBlock:^(BOOL success, id responseObj, App42Exception *exception) 
{
	if (success)
	{
		Storage *storage =  (Storage*)responseObj;
		NSLog(@"dbName is %@" , storage.dbName);
		NSLog(@"collectionNameId is %@" ,  storage.collectionName);
	}
	else
	{
		int appErrorCode = exception.appErrorCode;
		int httpErrorCode = exception.httpErrorCode;
		if(appErrorCode == 2600)
		{
			// Handle here for Not Found (Document by the Id '4faa3f1ac68df147a51f8bd7' does not exist.)
		}
		else if(appErrorCode  == 2606)
		{
			// Handle here for Bad Request (Document Id '4faa3f1ac68df147' is not valid.)
		}
		else if(appErrorCode == 1401)
		{
			// handle here for Client is not authorized
		}
		else if(appErrorCode == 1500)
		{
			// handle here for Internal Server Error
		}
		NSString *jsonText = exception.reason; 
	}
}];                       
Coming Soon
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "4faa3f1ac68df147a51f8bd7";
App42API.initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.buildStorageService(); 
try
{
	Storage storage = storageService.findDocumentById(dbName, collectionName, docId);
}
catch(App42Exception exception) 
{
	int appErrorCode = exception.getAppErrorCode();
	int httpErrorCode = exception.getHttpErrorCode();
	if(appErrorCode == 2600)
	{
		// Handle here for Not Found (Document by the Id '4faa3f1ac68df147a51f8bd7' does not exist.)
	}
	else if(appErrorCode  == 2606)
	{
		// Handle here for Bad Request (Document Id '4faa3f1ac68df147' is not valid.)
	}
	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 dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "4faa3f1ac68df147a51f8bd7";
App42Log.SetDebug(true);        //Prints output in your editor console
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
storageService.FindDocumentById(dbName, collectionName, docId, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnException(Exception exception)
	{
	    App42Exception ex = (App42Exception)exception;
		int appErrorCode = ex.GetAppErrorCode();
        int httpErrorCode = ex.GetHttpErrorCode();
	if(appErrorCode == 2600)
	{
		// Handle here for Not Found (Document by the Id '4faa3f1ac68df147a51f8bd7' does not exist.)
	}
	else if(appErrorCode  == 2606)
	{
		// Handle here for Bad Request (Document Id '4faa3f1ac68df147a' is not valid.)
	}
	else if(appErrorCode == 1401)
	{
		// handle here for Client is not authorized
	}
	else if(appErrorCode == 1500)
	{
		// handle here for Internal Server Error
	}
	String jsonText = ex.GetMessage(); 
	}
    
    public void OnSuccess(object response)
    {
		App42Log.Console("Response is :" + response.ToString());
	}
}
var dbName = "<Your_DataBase_Name>",
collectionName = "<Your_Collection_Name>",
docId = "4faa3f1ac68df147a51f8bd7";
var appErrorCode ;
App42.initialize("API_KEY","SECRET_KEY");
var storageService  = new App42Storage();
storageService.findDocumentById(dbName, collectionName, docId,{
	success: function(object) {
	},
	error: function(error) 
	{
		var storageObj = JSON.parse(error);
		appErrorCode = storageObj.app42Fault.appErrorCode;
		if(appErrorCode == 2600)
		{
			// Handle here for Not Found (Document by the Id '4faa3f1ac68df147a51f8bd7' does not exist.)
		}
		else if(appErrorCode  == 2606)
		{
			// Handle here for Bad Request (Document Id '4faa3f1ac68df147' is not valid.)
		}
		else if(appErrorCode == 1401)
		{
			// handle here for Client is not authorized
		}
		else if(appErrorCode == 1500)
		{
			// handle here for Internal Server Error
		}
	}
});
local dbName  = "<Your_DataBase_Name>"
local collectionName = "<Your_Collection_Name>"
local docId = "4faa3f1ac68df147a51f8bd7"
local App42CallBack = {}
App42API:initialize("API_KEY","SECRET_KEY")
local storageService = App42API:buildStorageService()
storageService:findDocumentById(dbName, collectionName,docId,App42CallBack)
function App42CallBack:onSuccess(object)
	print("dbName is "..object:getDbName())
end
function App42CallBack:onException(exception)
	local appErrorCode = exception:getAppErrorCode()
	if appErrorCode == 2600 then
			-- Handle here for Not Found (Document by the Id '4faa3f1ac68df147a51f8bd7' does not exist.)
		elseif appErrorCode  == 2606 then 
			-- Handle here for Bad Request (Document Id '4faa3f1ac68df147' is not valid.)
		elseif appErrorCode == 1401 then
			-- handle here for Client is not authorized
		elseif appErrorCode == 1500 then
			-- handle here for Internal Server Error
	end
end
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";    
const char* docId = "docId";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->FindDocumentById(dbName, collectionName, docId, app42callback(Sample_Class::onStorageRequestCompleted, this));
void Sample_Class::onStorageRequestCompleted(void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        //Handle Success Response here.
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
        
        int appErrorCode = storageResponse->appErrorCode;
        if(appErrorCode == 2600)
		{
			// Handle here for Not Found (Document by the Id '4faa3f1ac68df147a51f8bd7' does not exist.)
		}
		else if(appErrorCode  == 2606)
		{
			// Handle here for Bad Request (Document Id '4faa3f1ac68df147a' is not valid.)
		}
		else if(appErrorCode == 1401)
		{
			// handle here for Client is not authorized
		}
		else if(appErrorCode == 1500)
		{
			// handle here for Internal Server Error
		}
    }
}
String dbName = "<Your_DataBase_Name>";
String collectionName = "<Your_Collection_Name>"; 
String docId = "4faa3f1ac68df147a51f8bd7";
App42API.Initialize("API_KEY","SECRET_KEY");
StorageService storageService = App42API.BuildStorageService(); 
try
{
	Storage storage = storageService.FindDocumentById(dbName, collectionName, docId);
} 
catch(App42Exception exception)
{
	int appErrorCode = exception.GetAppErrorCode();
	int httpErrorCode = exception.GetHttpErrorCode();
	if(appErrorCode == 2600)
	{
		// Handle here for Not Found (Document by the Id '4faa3f1ac68df147a51f8bd7' does not exist.)
	}
	else if(appErrorCode  == 2606)
	{
		// Handle here for Bad Request (Document Id '4faa3f1ac68df147a' is not valid.)
	}
	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(); 
}          
$dbName = "<Your_DataBase_Name>";
$collectionName = "<Your_Collection_Name>"; 
$docId = "4faa3f1ac68df147a51f8bd7";
App42API::initialize("API_KEY","SECRET_KEY");  
$storageService = App42API::buildStorageService(); 
try
{
	$storage = $storageService->findDocumentById($dbName, $collectionName, $docId);
} 
catch(App42Exception $exception) 
{
	$appErrorCode = $exception->getAppErrorCode();
	$httpErrorCode = $exception->getHttpErrorCode();
	if($appErrorCode == 2600)
	{
		// Handle here for Not Found (Document by the Id '4faa3f1ac68df147a51f8bd7' does not exist.)
	}
	else if($appErrorCode  == 2606){
		// Handle here for Bad Request (Document Id '4faa3f1ac68df147' is not valid.)
	}
	else if($appErrorCode == 1401)
	{
		// handle here for Client is not authorized
	}
	else if($appErrorCode == 1500){
		// handle here for Internal Server Error
	}
	$jsonText = $exception->getMessage(); 
}
const char* dbName = "<Your_DataBase_Name>";
const char* collectionName = "<Your_Collection_Name>";    
const char* docId = "docId";
App42API::Initialize("API_KEY", "SECRET_KEY");
StorageService *storageService = App42API::BuildStorageService();
storageService->FindDocumentById(dbName, collectionName, docId, this, app42callfuncND_selector(Sample_Class::onStorageRequestCompleted));
void Sample_Class::onStorageRequestCompleted(App42CallBack *sender, void *response)
{
    App42StorageResponse *storageResponse = (App42StorageResponse*)response;
    printf("\ncode=%d",storageResponse->getCode());
    printf("\nResponse Body=%s",storageResponse->getBody().c_str());
    if (storageResponse->isSuccess)
    {
        //Handle Success Response here.
    }
    else
    {
        printf("\nerrordetails:%s",storageResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",storageResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",storageResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",storageResponse->httpErrorCode);
        
        int appErrorCode = storageResponse->appErrorCode;
        if(appErrorCode == 2600)
		{
			// Handle here for Not Found (Document by the Id '4faa3f1ac68df147a51f8bd7' does not exist.)
		}
		else if(appErrorCode  == 2606)
		{
			// Handle here for Bad Request (Document Id '4faa3f1ac68df147a' is not valid.)
		}
		else if(appErrorCode == 1401)
		{
			// handle here for Client is not authorized
		}
		else if(appErrorCode == 1500)
		{
			// handle here for Internal Server Error
		}
    }
}
Coming Soon
Coming Soon
Coming Soon
Coming Soon
Error Codes

Functions in Storage 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. 2600 - NOT FOUND - Document by the Id '@docId' does not exist. 2601 - NOT FOUND - Document by key '@key' and value '@value' does not exist. 2602 - NOT FOUND - No document in the collection '@collectionName' exists. 2603 - BAD REQUEST - The request parameters are invalid. Make Sure DB and collection name exists and functions are syntactically correct. 2604 - NOT FOUND - Storage with the name '@storageName' does not exist. 2605 - BAD REQUEST - Invalid Storage Query. 2606 - BAD REQUEST - Document Id '@docId' is not valid. 2608 - NOT FOUND - No document in the collection '@collectionName' exists for given query 2609 - NOT FOUND - The dataBase '@db' has no collections 2610 - BAD REQUEST - The request parameters are invalid. Storage '@storageName' already exists. 2611 - BAD REQUEST - The request parameters are invalid. Make Sure DB name Not contains special characters.