This module allows you to upload files on the cloud that can later be accessed through their respective URLs. Uploading files on the cloud is specially useful for mobile/device apps as this minimizes the app footprint on the device.
import com.shephertz.app42.paas.sdk.android.ServiceAPI; 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.upload.Upload; import com.shephertz.app42.paas.sdk.android.upload.UploadFileType; import com.shephertz.app42.paas.sdk.android.upload.UploadService;using com.shephertz.app42.paas.sdk.windows; using com.shephertz.app42.paas.sdk.windows.upload;#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.ServiceAPI; 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.upload.Upload; import com.shephertz.app42.paas.sdk.java.upload.UploadFileType; import com.shephertz.app42.paas.sdk.java.upload.UploadService;using com.shephertz.app42.paas.sdk.csharp; using com.shephertz.app42.paas.sdk.csharp.upload;<script type="text/javascript" src="App42-all-x.x.x.min.js"></script>local App42API = require("App42-Lua-API.App42API") local ACL= require("App42-Lua-API.ACL") require("App42-Lua-API.UploadFileType") require("App42-Lua-API.Permission")#include "App42API.h"using com.shephertz.app42.paas.sdk.csharp; using com.shephertz.app42.paas.sdk.csharp.upload;include_once '../App42Response.php'; include_once '../App42Exception.php'; include_once '../App42BadParameterException.php'; include_once '../App42NotFoundException.php'; include_once '../App42Log.php'; include_once '../UploadService.php';Coming Soonrequire 'App42_Ruby_API'import com.shephertz.app42.paas.sdk.as3.App42API; import com.shephertz.app42.paas.sdk.as3.App42Response; import com.shephertz.app42.paas.sdk.as3.App42Exception; import com.shephertz.app42.paas.sdk.as3.App42BadParameterException; import com.shephertz.app42.paas.sdk.as3.App42NotFoundException; import com.shephertz.app42.paas.sdk.as3.upload.Upload; import com.shephertz.app42.paas.sdk.as3.upload.UploadFile; import com.shephertz.app42.paas.sdk.as3.upload.UploadService;Coming Soonimport com.shephertz.app42.paas.sdk.jme.ServiceAPI; 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.upload.Upload; import com.shephertz.app42.paas.sdk.jme.upload.UploadFileType; import com.shephertz.app42.paas.sdk.jme.upload.UploadService;
In order to use the various functions available in a specific API, the developer has to initialize with App42API by passing the apiKey and the secretKey which will become available after the app creation from AppHQ dashboard.
Required Parameters
apiKey - The Application key given when the application was created.
secretKey - The secret key corresponding to the application key given when the application was created.
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");App42API.Initialize("API_KEY","SECRET_KEY");[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];App42API.initializeWithAPIKey("API_KEY", andSecretKey: "SECRET_KEY")App42API.initialize("API_KEY","SECRET_KEY");App42API.Initialize("API_KEY","SECRET_KEY");App42.initialize("API_KEY","SECRET_KEY");App42API:initialize("API_KEY","SECRET_KEY");App42API::Initialize("API_KEY", "SECRET_KEY");App42API.Initialize("API_KEY","SECRET_KEY");App42API::initialize("API_KEY","SECRET_KEY");App42API::Initialize("API_KEY", "SECRET_KEY");api = App42::ServiceAPI.new("API_KEY","SECRET_KEY")App42API.initialize("API_KEY","SECRET_KEY");Coming SoonApp42API.initialize("API_KEY","SECRET_KEY");
After initialization, the developer will have to call the buildXXXService method on App42API to get the instance of the particular API that they wish to build. For example, to build an instance of UploadService, buildUploadService() method needs to be called.
UploadService uploadService = App42API.buildUploadService();UploadService uploadService = App42API.BuildUploadService();UploadService *uploadService = [App42API buildUploadService];uploadService:UploadService? = App42API.buildUploadServiceUploadService uploadService = App42API.buildUploadService();UploadService uploadService = App42API.BuildUploadService();var uploadService = new App42Upload();local uploadService = App42API:buildUploadService()UploadService *uploadService = App42API::BuildUploadService();UploadService uploadService = App42API.BuildUploadService();$uploadService = App42API::buildUploadService();Coming Soonupload_service = api.build_upload_servicevar uploadService:UploadService = App42API.buildUploadService();Coming SoonUploadService uploadService = App42API.buildUploadService();
Uploads file on the cloud.
Required Parameters
fileName - The name of the file which has to be saved. It is used to retrieve the file.
filePath - The local path for the file.
fileType - The type of the file. The file can be either Audio, Video, Image, Binary, Txt, xml, json, csv or other. Use the static constants such as UploadFileType.AUDIO, UploadFileType.XML etc.
description - Description of the file to be uploaded.
String fileName = "<Your_file_name>"; String description = "File Description"; String filePath = "Your Local File Path"; UploadFileType fileType = UploadFileType.IMAGE; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); uploadService.uploadFile(fileName, filePath, fileType, description, new App42CallBack() { public void onSuccess(Object response) { Upload upload = (Upload)response; ArrayList<Upload.File> fileList = upload.getFileList(); for(int i = 0; i < fileList.size();i++ ) { System.out.println("fileName is :" + fileList.get(i).getName()); System.out.println("fileType is :" + fileList.get(i).getType()); System.out.println("fileUrl is :" + fileList.get(i).getUrl()); System.out.println("Tiny Url is :"+fileList.get(i).getTinyUrl()); System.out.println("fileDescription is: " + fileList.get(i).getDescription()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });Not AvailableNSString *fileName = @"FileName.ext"; NSString *description = @"File Description"; NSString *filePath = @"Your Local File Path"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; UploadService *uploadService = [App42API buildUploadService]; [uploadService uploadFile:fileName filePath:filePath uploadFileType:IMAGE fileDescription:description completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Upload *upload = (Upload*)responseObj; NSMutableArray *fileList = upload.fileListArray; for (File *file in fileList) { NSLog(@"fileName is %@" , file.name); NSLog(@"fileType is %@" , file.type); NSLog(@"URL is %@" , file.url); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];var fileName = "FileName.ext" var description = "File Description" var filePath = "Your Local File Path" App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") var userService:UserService? = App42API.buildUploadService uploadService?.uploadFile(fileName, filePath:filePath, uploadFileType:IMAGE, fileDescription:description, completionBlock: (success, responseObj, exception) if (success) { var upload = responseObj as! Upload var fileList = upload.fileListArray for file in fileList { NSLog("%@" , file.name) NSLog("%@" , file.type) NSLog("%@" , file.url) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String fileName = "<Your_file_name>"; String description = "File Description"; String filePath = "Your Local File Path"; UploadFileType fileType = UploadFileType.IMAGE; App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); Upload upload = uploadService.uploadFile(fileName, filePath, fileType, description); ArrayList<Upload.File> fileList = upload.getFileList(); for(int i = 0; i < fileList.size();i++ ) { System.out.println("fileName is :" + fileList.get(i).getName()); System.out.println("fileType is :" + fileList.get(i).getType()); System.out.println("fileUrl is :" + fileList.get(i).getUrl()); System.out.println("Tiny Url is :"+fileList.get(i).getTinyUrl()); System.out.println("fileDescription is: " + fileList.get(i).getDescription()); }String fileName = "<Your_file_name>"; String description = "File Description"; String filePath = "Your Local File Path"; String fileType = "<Your_file_type>"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.UploadFile(fileName, filePath, fileType, description, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Upload upload = (Upload) response; IList<Upload.File> fileList = upload.GetFileList(); for(int i=0; i < fileList.Count; i++) { App42Log.Console("fileName is " + fileList[i].GetName()); App42Log.Console("fileType is " + fileList[i].GetType()); App42Log.Console("fileUrl is " + fileList[i].GetUrl()); App42Log.Console("TinyUrl Is : " + fileList[i].GetTinyUrl()); App42Log.Console("fileDescription is " + fileList[i].GetDescription()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var fileName = "<Your_file_name>", description = "File Description", filePath = "Your Local File Path", fileType = "<Your_file_type>"; result ; App42.initialize("API_KEY","SECRET_KEY"); var uploadService = new App42Upload(); uploadService.uploadFile(fileName, filePath, fileType, description,{ success: function(object) { var uploadObj = JSON.parse(object); console.log("name is " +uploadObj.app42.response.upload.files.file.name) console.log("file type is "+uploadObj.app42.response.upload.files.file.type) console.log("url is " +uploadObj.app42.response.upload.files.file.url) }, error: function(error) { } });local fileName = "<Your_file_name>"; local description = "File Description"; local filePath = "Your Local File Path"; local fileType = "<Your_file_type>"; local App42CallBack = {} App42API:initialize("API_KEY", "SECRET_KEY") local uploadService = App42API:buildUploadService() uploadService:uploadFile(fileName,filePath ,fileType,description,App42CallBack) function App42CallBack:onSuccess(object) print("fileName is :".. object:getFileList():getName()); print("Type is :".. object:getFileList():getType()); print("Url is :".. object:getFileList():getUrl()); print("fileDescription is: ".. object:getFileList():getDescription()); 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()) endconst char* fileName = "<Your_file_name>"; const char* filePath = "Your Local File Path"; const char* description = "File Description"; FileType fileType = IMAGE; App42API::Initialize("API_KEY", "SECRET_KEY"); UploadService *uploadService = App42API::BuildUploadService(); uploadService->UploadFile(fileName, filePath, fileType, description, app42callback(Sample_Class::onUploadRequestCompleted, this)); void Sample_Class::onUploadRequestCompleted(void *response) { App42UploadResponse *uploadResponse = (App42UploadResponse*)response; printf("\ncode=%d",uploadResponse->getCode()); printf("\nResponse Body=%s",uploadResponse->getBody().c_str()); if(uploadResponse->isSuccess) { for(std::vector<App42Upload>::iterator it = uploadResponse->uploadArray.begin(); it != uploadResponse->uploadArray.end(); ++it) { printf("\n Name=%s",it->name.c_str()); printf("\n Type=%s",it->type.c_str()); printf("\n Description=%s",it->description.c_str()); printf("\n Url=%s",it->url.c_str()); printf("\n CreatedOn=%s",it->createdOn.c_str()); } } else { printf("\nerrordetails :%s",uploadResponse->errorDetails.c_str()); printf("\nerrorMessage :%s",uploadResponse->errorMessage.c_str()); printf("\nappErrorCode :%d",uploadResponse->appErrorCode); printf("\nhttpErrorCode:%d",uploadResponse->httpErrorCode); } }String fileName = "<Your_file_name>"; String description = "File Description"; String filePath = "Your Local File Path"; String fileType = "<Your_file_type>"; App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); Upload upload = uploadService.UploadFile(fileName, filePath, fileType, description); IList<Upload.File> fileList = upload.GetFileList(); for(int i = 0; i < fileList.Count();i++ ) { Console.WriteLine("fileName is " + fileList[i].GetName()); Console.WriteLine("fileType is " + fileList[i].GetType()); Console.WriteLine("fileUrl is " + fileList[i].GetUrl()); Console.WriteLine("fileDescription is " + fileList[i].GetDescription()); }$fileName = "<Your_file_name>"; $fileType = "<Your_file_type>"; $filePath = "Your Local File Path"; $description = "File Description"; App42API::initialize("API_KEY","SECRET_KEY"); $uploadService = App42API::buildUploadService(); $upload = $uploadService->uploadFile($fileName, $filePath, $fileType, $description); $fileList = $upload->getFileList(); foreach($fileList as $files ) { print_r("FileName is : ".$files->getName()); print_r("Type is : ".$files->getType() ); print_r("Url is : ".$files->getUrl() ); print_r("TinyUrl is: ".$files->getTinyUrl() ); print_r("Description is: ".$files->getDescription()); } $jsonResponse = $upload->toString();Coming SoonfileName = "<Your_file_name>"; filePath = "Your Local File Path"; fileType = App42::Upload::UploadFileType.new(); api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY") upload_service = api.build_upload_service upload_file_type = fileType.enum("IMAGE"); description = "File Description"; upload = upload_service.upload_file(fileName,filePath,upload_file_type,description); fileList = Array.new(); for file in fileList do puts "fileName is #{file.name}"; puts "fileType is #{file.type}"; puts "url is #{file.url}"; puts "description is #{file.description}"; end jsonResponse = upload.to_s();var fileName:String = "<Your_file_name>"; var description:String = "File Description"; var filePath:String = "Your Local File Path"; App42API.initialize("API_KEY","SECRET_KEY"); var uploadService:UploadService = App42API.buildUploadService(); uploadService.uploadFile(fileName,filePath, UploadFileType.IMAGE , description,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var upload:Upload = Upload(response); if(upload.getFileList()!= null) { var fileList:Array = upload.getFileList(); for(var k:int=0;k<fileList.length;k++) { var file:File=File(fileList[k]); trace("File Name:"+file.getName()); trace("File Type:"+file.getType()); trace("file url:"+file.getUrl()); trace(" tiny Url:"+file.getTinyUrl()); trace(" Description:"+file.getDescription()); trace("Created On"+file.getCreatedOn()); } } } }Coming SoonNot Available
Get all the files for the App.
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); uploadService.getAllFiles(new App42CallBack() { public void onSuccess(Object response) { Upload upload = (Upload)response; ArrayList<Upload.File> fileList = upload.getFileList(); for(int i = 0; i < fileList.size();i++ ) { System.out.println("fileName is :" + fileList.get(i).getName()); System.out.println("fileType is :" + fileList.get(i).getType()); System.out.println("fileUrl is :" + fileList.get(i).getUrl()); System.out.println("Tiny Url is :"+fileList.get(i).getTinyUrl()); System.out.println("fileDescription is: " + fileList.get(i).getDescription()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.GetAllFiles(new Callback()); public class Callback : App42Callback { public void OnSuccess(Object response) { Upload upload = (Upload) response; IList<Upload.File> fileList = upload.GetFileList(); for(int i = 0; i < fileList.Count();i++ ) { Console.WriteLine("fileName is " + fileList[i].GetName()); Console.WriteLine("fileType is " + fileList[i].GetType()); Console.WriteLine("fileUrl is " + fileList[i].GetUrl()); Console.WriteLine("fileDescription is " + fileList[i].GetDescription()); } } public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } }[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; UploadService *uploadService = [App42API buildUploadService]; [uploadService getAllFiles:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Upload *upload = (Upload*)responseObj; NSMutableArray *fileList = upload.fileListArray; for (File *file in fileList) { NSLog(@"fileName is %@" , file.name); NSLog(@"fileType is %@" , file.type); NSLog(@"URL is %@" , file.url); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") var userService:UserService? = App42API.buildUploadService uploadService?.getAllFiles(success, responseObj, exception) { if (success) { var upload = responseObj as! Upload var fileList = upload.fileListArray for file in fileList { NSLog("%@" , file.name) NSLog("%@" , file.type) NSLog("%@" , file.url) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } }App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); Upload upload = uploadService.getAllFiles(); ArrayList<Upload.File> fileList = upload.getFileList(); for(int i = 0; i < fileList.size();i++ ) { System.out.println("fileName is :" + fileList.get(i).getName()); System.out.println("fileType is :" + fileList.get(i).getType()); System.out.println("fileUrl is :" + fileList.get(i).getUrl()); System.out.println("Tiny Url is :"+fileList.get(i).getTinyUrl()); System.out.println("fileDescription is: " + fileList.get(i).getDescription()); }App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.GetAllFiles(new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Upload upload = (Upload) response; IList<Upload.File> fileList = upload.GetFileList(); for(int i=0; i < fileList.Count; i++) { App42Log.Console("fileName is " + fileList[i].GetName()); App42Log.Console("fileType is " + fileList[i].GetType()); App42Log.Console("fileUrl is " + fileList[i].GetUrl()); App42Log.Console("TinyUrl Is : " + fileList[i].GetTinyUrl()); App42Log.Console("fileDescription is " + fileList[i].GetDescription()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var result; App42.initialize("API_KEY","SECRET_KEY"); var uploadService = new App42Upload(); uploadService.getAllFiles({ success: function(object) { var uploadObj = JSON.parse(object); result = uploadObj.app42.response.upload.files.file; for (var i = 0 ; i<result.length;i++){ console.log("name is " +result[i].name) console.log("file type is"+result[i].type) console.log(" url is" +result[i].url) } }, error: function(error) { } });local App42CallBack = {} App42API:initialize("API_KEY", "SECRET_KEY") local uploadService = App42API:buildUploadService() uploadService:getAllFiles(App42CallBack); function App42CallBack:onSuccess(object) if table.getn(object:getFileList()) >1 then for m=1,table.getn(object:getFileList()) do print("fileName is :".. object:getFileList()[m]:getName()); print("Type is :".. object:getFileList()[m]:getType()); print("Url is :".. object:getFileList()[m]:getUrl()); print("fileDescription is: ".. object:getFileList()[m]:getDescription()); end else print("fileName is :".. object:getFileList():getName()); print("Type is :".. object:getFileList():getType()); print("Url is :".. object:getFileList():getUrl()); print("fileDescription is: ".. object:getFileList():getDescription()); 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()) endApp42API::Initialize("API_KEY", "SECRET_KEY"); UploadService *uploadService = App42API::BuildUploadService(); uploadService->GetAllFiles(app42callback(Sample_Class::onUploadRequestCompleted, this)); void Sample_Class::onUploadRequestCompleted(void *response) { App42UploadResponse *uploadResponse = (App42UploadResponse*)response; printf("\ncode=%d",uploadResponse->getCode()); printf("\nResponse Body=%s",uploadResponse->getBody().c_str()); if(uploadResponse->isSuccess) { for(std::vector<App42Upload>::iterator it = uploadResponse->uploadArray.begin(); it != uploadResponse->uploadArray.end(); ++it) { printf("\n Name=%s",it->name.c_str()); printf("\n UserName=%s",it->userName.c_str()); printf("\n Type=%s",it->type.c_str()); printf("\n Description=%s",it->description.c_str()); printf("\n Url=%s",it->url.c_str()); } } else { printf("\nerrordetails :%s",uploadResponse->errorDetails.c_str()); printf("\nerrorMessage :%s",uploadResponse->errorMessage.c_str()); printf("\nappErrorCode :%d",uploadResponse->appErrorCode); printf("\nhttpErrorCode:%d",uploadResponse->httpErrorCode); } }Upload upload = uploadService.GetAllFiles(); App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); IList<Upload.File> fileList = upload.GetFileList(); for(int i = 0; i < fileList.Count();i++ ) { Console.WriteLine("fileName is " + fileList[i].GetName()); Console.WriteLine("fileType is " + fileList[i].GetType()); Console.WriteLine("fileUrl is " + fileList[i].GetUrl()); Console.WriteLine("fileDescription is " + fileList[i].GetDescription()); }App42API::initialize("API_KEY","SECRET_KEY"); $uploadService = App42API::buildUploadService(); $upload = $uploadService->getAllFiles(); $fileList = $upload->getFileList(); foreach ($fileList as $files) { print_r("FileName is : " . $files->getName()); print_r("Type is : " . $files->getType()); print_r("Url is : " . $files->getUrl()); print_r("TinyUrl is: " . $files->getTinyUrl()); print_r("Description is: " . $files->getDescription()); } $jsonResponse = $upload->toString();Coming Soonapi = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY") upload_service = api.build_upload_service upload = upload_service.get_all_files(); file_list = Array.new(); for file in file_list do puts "fileName is #{file.name}"; puts "fileType is #{file.type}"; end jsonResponse = upload.to_s();App42API.initialize("API_KEY","SECRET_KEY"); var uploadService:UploadService = App42API.buildUploadService(); uploadService.getAllFiles(new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var upload:Upload = Upload(response); if(upload.getFileList()!= null) { var fileList:Array = upload.getFileList(); for(var k:int=0;k<fileList.length;k++) { var file:File=File(fileList[k]); trace("File Name:"+file.getName()); trace("File Type:"+file.getType()); trace("fileList url:"+file.getUrl()) trace(" tiny Url:"+file.getTinyUrl()) trace(" Description:"+file.getDescription()) } } } }Coming SoonApp42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); Upload upload = uploadService.getAllFiles(); Vector fileList = upload.getFileList(); for(int i=0;i < fileList.size();i++) { Upload.File file = (Upload.File)fileList.elementAt(i); System.out.println("fileName is " + file.getName()); System.out.println("fileType is " + file.getType()); System.out.println("fileUrl is " + file.getUrl()); System.out.println("fileDescription is " + file.getDescription()); }
Get count of all the files for the App.
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); uploadService.getAllFilesCount(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()); } });App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.GetAllFilesCount(new Callback()); public class Callback : App42Callback { public void OnSuccess(Object response) { App42Response upload = (App42Response) response; String jsonResponse = upload.ToString(); } public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } }[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; UploadService *uploadService = [App42API buildUploadService]; [uploadService getAllFilesCount:^(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]); } }];App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") var userService:UserService? = App42API.buildUploadService uploadService?.getAllFilesCount(success, responseObj, exception) { if (success) { var response = response as! App42Response NSLog("%@", response.strResponse) NSLog("%@", response.isResponseSuccess) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } }App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); App42Response app42response = uploadService.getAllFilesCount(); System.out.println("Total Records : " + app42response.getTotalRecords()) ; boolean success = app42response.isResponseSuccess(); String jsonResponse = app42response.toString();App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.GetAllFilesCount(new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response app42Response = (App42Response) response; App42Log.Console("Response is : "app42Response.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var result ; App42.initialize("API_KEY","SECRET_KEY"); var uploadService = new App42Upload(); uploadService.getAllFilesCount({ success: function(object) { var uploadObj = JSON.parse(object); result = uploadObj.app42.response; console.log("success is : " + result.success) console.log("totalRecords is : " + result.totalRecords) }, error: function(error) { } });local App42CallBack = {} App42API:initialize("API_KEY", "SECRET_KEY") local uploadService = App42API:buildUploadService() uploadService:getAllFilesCount(App42CallBack) function App42CallBack:onSuccess(object) print("Total Records 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()) endApp42API::Initialize("API_KEY", "SECRET_KEY"); UploadService *uploadService = App42API::BuildUploadService(); uploadService->GetAllFilesCount(app42callback(Sample_Class::onUploadRequestCompleted, this)); void Sample_Class::onUploadRequestCompleted(void *response) { App42UploadResponse *uploadResponse = (App42UploadResponse*)response; printf("\ncode=%d",uploadResponse->getCode()); printf("\nResponse Body=%s",uploadResponse->getBody().c_str()); if(uploadResponse->isSuccess) { printf("\nTotalRecords=%d",uploadResponse->getTotalRecords()); } else { printf("\nerrordetails :%s",uploadResponse->errorDetails.c_str()); printf("\nerrorMessage :%s",uploadResponse->errorMessage.c_str()); printf("\nappErrorCode :%d",uploadResponse->appErrorCode); printf("\nhttpErrorCode:%d",uploadResponse->httpErrorCode); } }App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); App42Response response = uploadService.GetAllFilesCount(); Boolean success = response.IsResponseSuccess(); String jsonResponse = response.ToString();App42API::initialize("API_KEY","SECRET_KEY"); $uploadService = App42API::buildUploadService(); $response = $uploadService->getAllFilesCount(); print_r("Total Records :".$response->getTotalRecords()); $success = $response->isResponseSuccess(); $jsonResponse = $response->toString();Coming Soonapi = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY") upload_service = api.build_upload_service response = upload_service.get_all_files_count(); success = response.isResponseSuccess(); total_records = response.totalRecords(); jsonResponse = response.to_s();App42API.initialize("API_KEY","SECRET_KEY"); var uploadService:UploadService = App42API.buildUploadService(); uploadService.getAllFilesCount(new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var app42Response:App42Response = App42Response(response); trace("Totalrecords is : " + app42Response.getTotalRecords()); } }Coming SoonApp42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); App42Response response = uploadService.getAllFilesCount(); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();
Get all the files by paging for the App.
Required Parameters
max - Maximum number of records to be fetched.
offset - From where the records are to be fetched.
int max = 10; int offset = 0; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); uploadService.getAllFiles(max, offset, new App42CallBack() { public void onSuccess(Object response) { Upload upload = (Upload)response; ArrayList<Upload.File> fileList = upload.getFileList(); for(int i = 0; i < fileList.size();i++ ) { System.out.println("fileName is :" + fileList.get(i).getName()); System.out.println("fileType is :" + fileList.get(i).getType()); System.out.println("fileUrl is :" + fileList.get(i).getUrl()); System.out.println("Tiny Url is :"+fileList.get(i).getTinyUrl()); System.out.println("fileDescription is: " + fileList.get(i).getDescription()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });int max = 10; int offset = 0; App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.GetAllFiles(max,offset,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Upload upload = (Upload) response; IList<Upload.File> fileList = upload.GetFileList(); for(int i = 0; i < fileList.Count();i++ ) { Console.WriteLine("fileName is " + fileList[i].GetName()); Console.WriteLine("fileType is " + fileList[i].GetType()); Console.WriteLine("fileUrl is " + fileList[i].GetUrl()); Console.WriteLine("fileDescription is " + fileList[i].GetDescription()); } } }int max = 10; int offset = 0; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; UploadService *uploadService = [App42API buildUploadService]; [uploadService getAllFiles:max offset:offset completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Upload *upload = (Upload*)responseObj; NSMutableArray *fileList = upload.fileListArray; for (File *file in fileList) { NSLog(@"fileName is %@" , file.name); NSLog(@"fileType is %@" , file.type); NSLog(@"URL is %@" , file.url); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];var max = 10 var offset = 0 App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") var userService:UserService? = App42API.buildUploadService uploadService?.getAllFiles(max, offset:offset, completionBlock:{ (success, response, exception) -> Void in if (success) { var upload = responseObj as! Upload var fileList = upload.fileListArray for file in fileList { NSLog("%@" , file.name) NSLog("%@" , file.type) NSLog("%@" , file.url) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })int max = 10; int offset = 0; App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); Upload upload = uploadService.getAllFiles(max,offset); ArrayList<Upload.File> fileList = upload.getFileList(); for(int i = 0; i < fileList.size();i++ ) { System.out.println("fileName is :" + fileList.get(i).getName()); System.out.println("fileType is :" + fileList.get(i).getType()); System.out.println("fileUrl is :" + fileList.get(i).getUrl()); System.out.println("Tiny Url is :"+fileList.get(i).getTinyUrl()); System.out.println("fileDescription is: " + fileList.get(i).getDescription()); }int max = 10; int offset = 0; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.GetAllFiles(max, offset, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Upload upload = (Upload) response; IList<Upload.File> fileList = upload.GetFileList(); for(int i=0; i < fileList.Count; i++) { App42Log.Console("fileName is " + fileList[i].GetName()); App42Log.Console("fileType is " + fileList[i].GetType()); App42Log.Console("fileUrl is " + fileList[i].GetUrl()); App42Log.Console("TinyUrl Is : " + fileList[i].GetTinyUrl()); App42Log.Console("fileDescription is " + fileList[i].GetDescription()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var max = 10, offset = 0; var result ; App42.initialize("API_KEY","SECRET_KEY"); var uploadService = new App42Upload(); uploadService.getAllFilesByPaging(max,offset,{ success: function(object) { var uploadObj = JSON.parse(object); result = uploadObj.app42.response.upload.files.file; for (var i = 0 ; i<result.length;i++){ console.log("name is " +result[i].name) console.log("file type is"+result[i].type) console.log(" url is" +result[i].url) } }, error: function(error) { } });local max = 10; local offset = 0; local App42CallBack = {} App42API:initialize("API_KEY", "SECRET_KEY") local uploadService = App42API:buildUploadService() uploadService:getAllFilesByPaging(max,offset,App42CallBack); function App42CallBack:onSuccess(object) if table.getn(object:getFileList()) >1 then for m=1,table.getn(object:getFileList()) do print("fileName is :".. object:getFileList()[m]:getName()); print("Type is :".. object:getFileList()[m]:getType()); print("Url is :".. object:getFileList()[m]:getUrl()); print("fileDescription is: ".. object:getFileList()[m]:getDescription()); end else print("fileName is :".. object:getFileList():getName()); print("Type is :".. object:getFileList():getType()); print("Url is :".. object:getFileList():getUrl()); print("fileDescription is: ".. object:getFileList():getDescription()); 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()) endint max = 2; int offset = 0; App42API::Initialize("API_KEY", "SECRET_KEY"); UploadService *uploadService = App42API::BuildUploadService(); uploadService->GetAllFiles(max, offset,app42callback(Sample_Class::onUploadRequestCompleted, this)); void Sample_Class::onUploadRequestCompleted(void *response) { App42UploadResponse *uploadResponse = (App42UploadResponse*)response; printf("\ncode=%d",uploadResponse->getCode()); printf("\nResponse Body=%s",uploadResponse->getBody().c_str()); if(uploadResponse->isSuccess) { for(std::vector<App42Upload>::iterator it = uploadResponse->uploadArray.begin(); it != uploadResponse->uploadArray.end(); ++it) { printf("\n Name=%s",it->name.c_str()); printf("\n UserName=%s",it->userName.c_str()); printf("\n Type=%s",it->type.c_str()); printf("\n Description=%s",it->description.c_str()); printf("\n Url=%s",it->url.c_str()); } } else { printf("\nerrordetails :%s",uploadResponse->errorDetails.c_str()); printf("\nerrorMessage :%s",uploadResponse->errorMessage.c_str()); printf("\nappErrorCode :%d",uploadResponse->appErrorCode); printf("\nhttpErrorCode:%d",uploadResponse->httpErrorCode); } }int max = 10; int offset = 0; Upload upload = uploadService.GetAllFiles(max,offset); App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); IList<Upload.File> fileList = upload.GetFileList(); for(int i = 0; i < fileList.Count();i++ ) { Console.WriteLine("fileName is " + fileList[i].GetName()); Console.WriteLine("fileType is " + fileList[i].GetType()); Console.WriteLine("fileUrl is " + fileList[i].GetUrl()); Console.WriteLine("fileDescription is " + fileList[i].GetDescription()); }$max = 10; $offset = 0; App42API::initialize("API_KEY","SECRET_KEY"); $uploadService = App42API::buildUploadService(); $upload = $uploadService->getAllFiles($max,$offset); $fileList = $upload->getFileList(); foreach ($fileList as $files) { print_r("FileName is : " . $files->getName()); print_r("Type is : " . $files->getType()); print_r("Url is : " . $files->getUrl()); print_r("TinyUrl is: " . $files->getTinyUrl()); print_r("Description is: " . $files->getDescription()); } $jsonResponse = $upload->toString();Coming Soonmax = 10; offset = 0; api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY") upload_service = api.build_upload_service upload = upload_service.get_all_files_by_paging(max, offset); file_list = Array.new(); for file in file_list do puts "fileName is #{file.name}"; puts "fileType is #{file.type}"; end jsonResponse = upload.to_s();var max:int = 10; var offset:int = 0; App42API.initialize("API_KEY","SECRET_KEY"); var uploadService:UploadService = App42API.buildUploadService(); uploadService.getAllFilesByPaging(max,offset,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var upload:Upload = Upload(response); if(upload.getFileList()!= null) { var fileList:Array = upload.getFileList(); for(var k:int=0;k<fileList.length;k++) { var file:File=File(fileList[k]); trace("File Name:"+file.getName()); trace("File Type:"+file.getType()); trace("fileList url:"+file.getUrl()) trace(" tiny Url:"+file.getTinyUrl()) trace(" Description:"+file.getDescription()) } } } }Coming SoonInteger max = new Integer(10); Integer offset = new Integer(0); App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); Upload upload = uploadService.getAllFiles(max,offset); Vector fileList = upload.getFileList(); for(int i=0;i < fileList.size();i++) { Upload.File file = (Upload.File)fileList.elementAt(i); System.out.println("fileName is " + file.getName()); System.out.println("fileType is " + file.getType()); System.out.println("fileUrl is " + file.getUrl()); System.out.println("fileDescription is " + file.getDescription()); }
Get the file based on the file name.
Required Parameters
fileName - The name of the file which has to be retrieved.
String fileName = "<Your_file_name>"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); uploadService.getFileByName(fileName, new App42CallBack() { public void onSuccess(Object response) { Upload upload = (Upload)response; ArrayList<Upload.File> fileList = upload.getFileList(); for(int i = 0; i < fileList.size();i++ ) { System.out.println("fileName is :" + fileList.get(i).getName()); System.out.println("fileType is :" + fileList.get(i).getType()); System.out.println("fileUrl is :" + fileList.get(i).getUrl()); System.out.println("Tiny Url is :"+fileList.get(i).getTinyUrl()); System.out.println("fileDescription is: " + fileList.get(i).getDescription()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String fileName = "<Your_file_name>"; App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.GetFileByName(fileName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Upload upload = (Upload) response; IList<Upload.File> fileList = upload.GetFileList(); for(int i = 0; i < fileList.Count();i++ ) { Console.WriteLine("fileName is " + fileList[i].GetName()); Console.WriteLine("fileType is " + fileList[i].GetType()); Console.WriteLine("fileUrl is " + fileList[i].GetUrl()); Console.WriteLine("fileDescription is " + fileList[i].GetDescription()); } } }NSString *fileName = @"<Your_file_name>"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; UploadService *uploadService = [App42API buildUploadService]; [uploadService getFileByName:fileName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Upload *upload = (Upload*)responseObj; NSMutableArray *fileList = upload.fileListArray; for (File *file in fileList) { NSLog(@"fileName is %@" , file.name); NSLog(@"fileType is %@" , file.type); NSLog(@"URL is %@" , file.url); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];var fileName = "<Your_file_name>" App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") var userService:UserService? = App42API.buildUploadService uploadService?.getFileByName(fileName, completionBlock:{ (success, response, exception) -> Void in if (success) { var upload = responseObj as! Upload var fileList = upload.fileListArray for file in fileList { NSLog("%@" , file.name) NSLog("%@" , file.type) NSLog("%@" , file.url) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String fileName = "<Your_file_name>"; App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); Upload upload = uploadService.getFileByName(fileName); ArrayList<Upload.File> fileList = upload.getFileList(); for(int i = 0; i < fileList.size();i++ ) { System.out.println("fileName is :" + fileList.get(i).getName()); System.out.println("fileType is :" + fileList.get(i).getType()); System.out.println("fileUrl is :" + fileList.get(i).getUrl()); System.out.println("Tiny Url is :"+fileList.get(i).getTinyUrl()); System.out.println("fileDescription is: " + fileList.get(i).getDescription()); }String fileName = "<Your_file_name>"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.GetFileByName(fileName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Upload upload = (Upload) response; IList<Upload.File> fileList = upload.GetFileList(); for(int i=0; i < fileList.Count; i++) { App42Log.Console("fileName is " + fileList[i].GetName()); App42Log.Console("fileType is " + fileList[i].GetType()); App42Log.Console("fileUrl is " + fileList[i].GetUrl()); App42Log.Console("TinyUrl Is : " + fileList[i].GetTinyUrl()); App42Log.Console("fileDescription is " + fileList[i].GetDescription()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var fileName = "<Your_file_name>"; var result ; App42.initialize("API_KEY","SECRET_KEY"); var uploadService = new App42Upload(); uploadService.getFileByName(fileName,{ success: function(object) { var uploadObj = JSON.parse(object); result = uploadObj.app42.response.upload.files.file; console.log("name is " +result.name) console.log("file type is"+result.type) console.log(" url is" +result.url) }, error: function(error) { } });local fileName = "<Your_file_name>"; local App42CallBack = {} App42API:initialize("API_KEY", "SECRET_KEY") local uploadService = App42API:buildUploadService() uploadService:getFileByName(fileName,App42CallBack) function App42CallBack:onSuccess(object) print("fileName is :".. object:getFileList():getName()); print("Type is :".. object:getFileList():getType()); print("Url is :".. object:getFileList():getUrl()); print("Description is: ".. object:getFileList():getDescription()); 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()) endconst char* fileName = "<Your_file_name>"; App42API::Initialize("API_KEY", "SECRET_KEY"); UploadService *uploadService = App42API::BuildUploadService(); uploadService->GetFileByName(fileName,app42callback(Sample_Class::onUploadRequestCompleted, this)); void Sample_Class::onUploadRequestCompleted(void *response) { App42UploadResponse *uploadResponse = (App42UploadResponse*)response; printf("\ncode=%d",uploadResponse->getCode()); printf("\nResponse Body=%s",uploadResponse->getBody().c_str()); if(uploadResponse->isSuccess) { for(std::vector<App42Upload>::iterator it = uploadResponse->uploadArray.begin(); it != uploadResponse->uploadArray.end(); ++it) { printf("\n Name=%s",it->name.c_str()); printf("\n UserName=%s",it->userName.c_str()); printf("\n Type=%s",it->type.c_str()); printf("\n Description=%s",it->description.c_str()); printf("\n Url=%s",it->url.c_str()); } } else { printf("\nerrordetails :%s",uploadResponse->errorDetails.c_str()); printf("\nerrorMessage :%s",uploadResponse->errorMessage.c_str()); printf("\nappErrorCode :%d",uploadResponse->appErrorCode); printf("\nhttpErrorCode:%d",uploadResponse->httpErrorCode); } }String fileName = "<Your_file_name>"; Upload upload = uploadService.GetFileByName(fileName); App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); IList<Upload.File> fileList = upload.GetFileList(); for(int i = 0; i < fileList.Count();i++ ) { Console.WriteLine("fileName is " + fileList[i].GetName()); Console.WriteLine("fileType is " + fileList[i].GetType()); Console.WriteLine("fileUrl is " + fileList[i].GetUrl()); Console.WriteLine("fileDescription is " + fileList[i].GetDescription()); }$fileName = "<Your_file_name>"; App42API::initialize("API_KEY","SECRET_KEY"); $uploadService = App42API::buildUploadService(); $upload = $uploadService->getFileByName($fileName); $fileList = $upload->getFileList(); foreach ($fileList as $files) { print_r("FileName is : " . $files->getName()); print_r("Type is : " . $files->getType()); print_r("Url is : " . $files->getUrl()); print_r("TinyUrl is: " . $files->getTinyUrl()); print_r("Description is: " . $files->getDescription()); } $jsonResponse = $upload->toString();Coming SoonfileName = "<Your_file_name>"; api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY") upload_service = api.build_upload_service upload = uploadService.get_file_by_name(fileName); file_list = Array.new(); for file in file_list do puts "fileName is #{file.name}"; puts "fileType is #{file.type}"; puts "url is #{file.url}"; puts "description is #{file.description}"; end jsonResponse = upload.to_s();var fileName:String = "<Your_file_name>"; App42API.initialize("API_KEY","SECRET_KEY"); var uploadService:UploadService = App42API.buildUploadService(); uploadService.getFileByName(fileName,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var upload:Upload = Upload(response); if(upload.getFileList()!= null) { var fileList:Array = upload.getFileList(); for(var k:int=0;k<fileList.length;k++) { var file:File=File(fileList[k]); trace("File Name:"+file.getName()); trace("File Type:"+file.getType()); trace("fileList url:"+file.getUrl()) trace(" tiny Url:"+file.getTinyUrl()) trace(" Description:"+file.getDescription()) } } } }Coming SoonString fileName = "<Your_file_name>"; App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); Upload upload = uploadService.getFileByName(fileName); Vector fileList = upload.getFileList(); for(int i=0;i < fileList.size();i++) { Upload.File file = (Upload.File)fileList.elementAt(i); System.out.println("fileName is " + file.getName()); System.out.println("fileType is " + file.getType()); System.out.println("fileUrl is " + file.getUrl()); System.out.println("fileDescription is " + file.getDescription()); }
Get the files based on the file type.
Required Parameters
fileType - Type of the file such as UploadFileType.AUDIO, UploadFileType.XML etc.
UploadFileType fileType = UploadFileType.IMAGE; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); uploadService.getFilesByType(fileType, new App42CallBack() { public void onSuccess(Object response) { Upload upload = (Upload)response; ArrayList<Upload.File> fileList = upload.getFileList(); for(int i = 0; i < fileList.size();i++ ) { System.out.println("fileName is :" + fileList.get(i).getName()); System.out.println("fileType is :" + fileList.get(i).getType()); System.out.println("fileUrl is :" + fileList.get(i).getUrl()); System.out.println("Tiny Url is :"+fileList.get(i).getTinyUrl()); System.out.println("fileDescription is: " + fileList.get(i).getDescription()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String fileType = "<Your_file_type>"; App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.GetFilesByType(fileType,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Upload upload = (Upload) response; IList<Upload.File> fileList = upload.GetFileList(); for(int i = 0; i < fileList.Count();i++ ) { Console.WriteLine("fileName is " + fileList[i].GetName()); Console.WriteLine("fileType is " + fileList[i].GetType()); Console.WriteLine("fileUrl is " + fileList[i].GetUrl()); Console.WriteLine("fileDescription is " + fileList[i].GetDescription()); } } }NSString *fileType = @"<Your_file_type>"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; UploadService *uploadService = [App42API buildUploadService]; [uploadService getFilesByType:fileType completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Upload *upload = (Upload*)responseObj; NSMutableArray *fileList = upload.fileListArray; for (File *file in fileList) { NSLog(@"fileName is %@" , file.name); NSLog(@"fileType is %@" , file.type); NSLog(@"URL is %@" , file.url); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];var fileType = "<Your_file_type>" App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") var userService:UserService? = App42API.buildUploadService uploadService?.getFilesByType(fileType, completionBlock:{ (success, response, exception) -> Void in if (success) { var upload = responseObj as! Upload var fileList = upload.fileListArray for file in fileList { NSLog("%@" , file.name) NSLog("%@" , file.type) NSLog("%@" , file.url) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); UploadFileType fileType = UploadFileType.IMAGE; Upload upload = uploadService.getFilesByType(fileType); ArrayList<Upload.File> fileList = upload.getFileList(); for(int i = 0; i < fileList.size();i++ ) { System.out.println("fileName is :" + fileList.get(i).getName()); System.out.println("fileType is :" + fileList.get(i).getType()); System.out.println("fileUrl is :" + fileList.get(i).getUrl()); System.out.println("Tiny Url is :"+fileList.get(i).getTinyUrl()); System.out.println("fileDescription is: " + fileList.get(i).getDescription()); }String fileType = "<Your_file_type>"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.GetFilesByType(fileType, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Upload upload = (Upload) response; IList<Upload.File> fileList = upload.GetFileList(); for(int i=0; i < fileList.Count; i++) { App42Log.Console("fileName is " + fileList[i].GetName()); App42Log.Console("fileType is " + fileList[i].GetType()); App42Log.Console("fileUrl is " + fileList[i].GetUrl()); App42Log.Console("TinyUrl Is : " + fileList[i].GetTinyUrl()); App42Log.Console("fileDescription is " + fileList[i].GetDescription()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var fileType = "<Your_file_type>"; var result ; App42.initialize("API_KEY","SECRET_KEY"); var uploadService = new App42Upload(); uploadService.getFilesByType(fileType,{ success: function(object) { var uploadObj = JSON.parse(object); result = uploadObj.app42.response.upload.files.file; if(result.length == undefined) { console.log(result.name) } else for(var i = 0;i<result.length;i++){ console.log("fileName is" +result[i].name) console.log("Url is" +result[i].url) console.log("type is"+result[i].type) } }, error: function(error) { } });local fileType = "<Your_file_type>"; local App42CallBack = {} App42API:initialize("API_KEY", "SECRET_KEY") local uploadService = App42API:buildUploadService() uploadService:getFilesByType(fileType,App42CallBack) function App42CallBack:onSuccess(object) if table.getn(object:getFileList()) >1 then for m=1,table.getn(object:getFileList()) do print("fileName is :".. object:getFileList()[m]:getName()); print("Type is :".. object:getFileList()[m]:getType()); print("Url is :".. object:getFileList()[m]:getUrl()); print("fileDescription is: ".. object:getFileList()[m]:getDescription()); end else print("fileName is :".. object:getFileList():getName()); print("Type is :".. object:getFileList():getType()); print("Url is :".. object:getFileList():getUrl()); print("fileDescription is: ".. object:getFileList():getDescription()); 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()) endFileType fileType = IMAGE; App42API::Initialize("API_KEY", "SECRET_KEY"); UploadService *uploadService = App42API::BuildUploadService(); uploadService->GetFilesByType(fileType,app42callback(Sample_Class::onUploadRequestCompleted, this)); void Sample_Class::onUploadRequestCompleted(void *response) { App42UploadResponse *uploadResponse = (App42UploadResponse*)response; printf("\ncode=%d",uploadResponse->getCode()); printf("\nResponse Body=%s",uploadResponse->getBody().c_str()); if(uploadResponse->isSuccess) { for(std::vector<App42Upload>::iterator it = uploadResponse->uploadArray.begin(); it != uploadResponse->uploadArray.end(); ++it) { printf("\n Name=%s",it->name.c_str()); printf("\n UserName=%s",it->userName.c_str()); printf("\n Type=%s",it->type.c_str()); printf("\n Description=%s",it->description.c_str()); printf("\n Url=%s",it->url.c_str()); } } else { printf("\nerrordetails :%s",uploadResponse->errorDetails.c_str()); printf("\nerrorMessage :%s",uploadResponse->errorMessage.c_str()); printf("\nappErrorCode :%d",uploadResponse->appErrorCode); printf("\nhttpErrorCode:%d",uploadResponse->httpErrorCode); } }String fileType = "<Your_file_type>"; Upload upload = uploadService.GetFilesByType(fileType); App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); IList<Upload.File> fileList = upload.GetFileList(); for(int i = 0; i < fileList.Count();i++ ) { Console.WriteLine("fileName is " + fileList[i].GetName()); Console.WriteLine("fileType is " + fileList[i].GetType()); Console.WriteLine("fileUrl is " + fileList[i].GetUrl()); Console.WriteLine("fileDescription is " + fileList[i].GetDescription()); }$fileType = "<Your_file_type>"; App42API::initialize("API_KEY","SECRET_KEY"); $uploadService = App42API::buildUploadService(); $upload = $uploadService->getFilesByType($fileType); $fileList = $upload->getFileList(); foreach ($fileList as $files) { print_r("FileName is : " . $files->getName()); print_r("Type is : " . $files->getType()); print_r("Url is : " . $files->getUrl()); print_r("TinyUrl is: " . $files->getTinyUrl()); print_r("Description is: " . $files->getDescription()); } $jsonResponse = $upload->toString();Coming SoonfileType = App42::Upload::UploadFileType.new(); api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY") upload_service = api.build_upload_service upload_file_type = fileType.enum("IMAGE"); upload = upload_service.get_files_by_type(upload_file_type); fileList = Array.new(); for file in fileList do puts "fileName is #{file.name}"; puts "fileType is #{file.type}"; puts "url is #{file.url}"; puts "description is #{file.description}"; end jsonResponse = upload.to_s();var fileType:String = "<Your_file_type>"; App42API.initialize("API_KEY","SECRET_KEY"); var uploadService:UploadService = App42API.buildUploadService(); uploadService.getFilesByType(fileType,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var upload:Upload = Upload(response); if(upload.getFileList()!= null) { var fileList:Array = upload.getFileList(); for(var k:int=0;k<fileList.length;k++) { var file:File=File(fileList[k]); trace("File Name:"+file.getName()); trace("File Type:"+file.getType()); trace("fileList url:"+file.getUrl()) trace(" tiny Url:"+file.getTinyUrl()) trace(" Description:"+file.getDescription()) } } } }Coming SoonUploadFileType fileType = UploadFileType.IMAGE; App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); Upload upload = uploadService.getFilesByType(fileType); Vector fileList = upload.getFileList(); for(int i=0;i < fileList.size();i++) { Upload.File file = (Upload.File)fileList.elementAt(i); System.out.println("fileName is " + file.getName()); System.out.println("fileType is " + file.getType()); System.out.println("fileUrl is " + file.getUrl()); System.out.println("fileDescription is " + file.getDescription()); }
Get the count of files based on the file type.
Required Parameters
fileType - Type of the file e.g. UploadFileType.AUDIO, UploadFileType.XML etc.
UploadFileType fileType = UploadFileType.IMAGE; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); uploadService.getFilesCountByType(fileType, 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 fileType = "<Your_file_type>"; App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.GetFilesCountByType(fileType,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { App42Response upload = (App42Response) response; String jsonResponse = upload.ToString(); } }NSString *fileType = @"<Your_file_type>"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; UploadService *uploadService = [App42API buildUploadService]; [uploadService getFilesCountByType:fileType 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]); } }];var fileType = "<Your_file_type>" App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") var userService:UserService? = App42API.buildUploadService uploadService?.getFilesCountByType(fileType, completionBlock:(success, responseObj, exception) if (success) { var response = response as! App42Response NSLog("%@", response.strResponse) NSLog("%@", response.isResponseSuccess) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } )App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); UploadFileType fileType = UploadFileType.IMAGE; App42Response app42response = uploadService.getFilesCountByType(fileType); System.out.println("Total Records : " + app42response.getTotalRecords()) ; boolean success = app42response.isResponseSuccess(); String jsonResponse = app42response.toString();String fileType = "<Your_file_type>"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.GetFilesCountByType(fileType, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response app42Response = (App42Response) response; App42Log.Console("app42Response is : " + app42Response.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var fileType = "<Your_file_type>", result ; App42.initialize("API_KEY","SECRET_KEY"); var uploadService = new App42Upload(); uploadService.getFilesCountByType(fileType,{ success: function(object) { var uploadObj = JSON.parse(object); result = uploadObj.app42.response; console.log("success is : " + result.success) console.log("totalRecords is : " + result.totalRecords) }, error: function(error) { } });local fileType = "<Your_file_type>"; local App42CallBack = {} App42API:initialize("API_KEY", "SECRET_KEY") local uploadService = App42API:buildUploadService() uploadService:getFilesCountByType(fileType,App42CallBack) function App42CallBack:onSuccess(object) print("Total Records 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()) endFileType fileType = IMAGE; App42API::Initialize("API_KEY", "SECRET_KEY"); UploadService *uploadService = App42API::BuildUploadService(); uploadService->GetFilesCountByType(fileType,app42callback(Sample_Class::onUploadRequestCompleted, this)); void Sample_Class::onUploadRequestCompleted(void *response) { App42UploadResponse *uploadResponse = (App42UploadResponse*)response; printf("\ncode=%d",uploadResponse->getCode()); printf("\nResponse Body=%s",uploadResponse->getBody().c_str()); if(uploadResponse->isSuccess) { printf("\nTotalRecords=%d",uploadResponse->getTotalRecords()); } else { printf("\nerrordetails :%s",uploadResponse->errorDetails.c_str()); printf("\nerrorMessage :%s",uploadResponse->errorMessage.c_str()); printf("\nappErrorCode :%d",uploadResponse->appErrorCode); printf("\nhttpErrorCode:%d",uploadResponse->httpErrorCode); } }String fileType = "<Your_file_type>"; App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); App42Response response = uploadService.GetFilesCountByType(fileType); Boolean success = response.IsResponseSuccess(); String jsonResponse = response.ToString();$fileType = "<Your_file_type>"; App42API::initialize("API_KEY","SECRET_KEY"); $uploadService = App42API::buildUploadService(); $response = $uploadService->getFilesCountByType($fileType); print_r("Response is : ".$response->getTotalRecords()); $success = $response->isResponseSuccess(); $jsonResponse = $response->toString();Coming SoonfileType = App42::Upload::UploadFileType.new(); api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY") upload_service = api.build_upload_service upload_file_type = fileType.enum("IMAGE"); response = upload_service.get_files_count_by_type(upload_file_type); success = response.isResponseSuccess(); totalRecords = response.totalRecords(); jsonResponse = response.to_s();var fileType:String = "<Your_file_type>"; App42API.initialize("API_KEY","SECRET_KEY"); var uploadService:UploadService = App42API.buildUploadService(); uploadService.getFilesCountByType(fileType,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var app42Response:App42Response = App42Response(response); trace("Totalrecords is : " + app42Response.getTotalRecords()); } }Coming SoonString fileType = "<Your_file_type>"; App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); App42Response response = uploadService.getFilesCountByType(fileType); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();
Get the files based on file type by paging.
Required Parameters
fileType - Type of the file e.g. UploadFileType.AUDIO, UploadFileType.XML etc.
max - Maximum number of records to be fetched.
offset - From where the records are to be fetched.
UploadFileType fileType = UploadFileType.IMAGE; int max = 10; int offset = 0; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); uploadService.getFilesByType(fileType, max, offset, new App42CallBack() { public void onSuccess(Object response) { Upload upload = (Upload)response; ArrayList<Upload.File> fileList = upload.getFileList(); for(int i = 0; i < fileList.size();i++ ) { System.out.println("fileName is :" + fileList.get(i).getName()); System.out.println("fileType is :" + fileList.get(i).getType()); System.out.println("fileUrl is :" + fileList.get(i).getUrl()); System.out.println("Tiny Url is :"+fileList.get(i).getTinyUrl()); System.out.println("fileDescription is: " + fileList.get(i).getDescription()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String fileType = "<Your_file_type>"; int max = 10; int offset = 0; App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.GetFilesByType(fileType,max,offset,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Upload upload = (Upload) response; IList<Upload.File> fileList = upload.GetFileList(); for(int i = 0; i < fileList.Count();i++ ) { Console.WriteLine("fileName is " + fileList[i].GetName()); Console.WriteLine("fileType is " + fileList[i].GetType()); Console.WriteLine("fileUrl is " + fileList[i].GetUrl()); Console.WriteLine("fileDescription is " + fileList[i].GetDescription()); } } }NSString *fileType = @"<Your_file_type>"; int max = 10; int offset = 0; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; UploadService *uploadService = [App42API buildUploadService]; [uploadService getFilesByType:fileType max:max offset:offset completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Upload *upload = (Upload*)responseObj; NSMutableArray *fileList = upload.fileListArray; for (File *file in fileList) { NSLog(@"fileName is %@" , file.name); NSLog(@"fileType is %@" , file.type); NSLog(@"URL is %@" , file.url); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];var fileType = "<Your_file_type>" int max = 10 int offset = 0 App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") var userService:UserService? = App42API.buildUploadService uploadService?.getFilesByType(fileType, max:max, offset:offset, completionBlock:(success, responseObj, exception) { if (success) { var upload = responseObj as! Upload var fileList = upload.fileListArray for file in fileList { NSLog("%@" , file.name) NSLog("%@" , file.type) NSLog("%@" , file.url) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } )}App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); UploadFileType fileType = UploadFileType.IMAGE; int max = 10; int offset = 0; Upload upload = uploadService.getFilesByType(fileType,max,offset); ArrayList<Upload.File> fileList = upload.getFileList(); for(int i = 0; i < fileList.size();i++ ) { System.out.println("fileName is :" + fileList.get(i).getName()); System.out.println("fileType is :" + fileList.get(i).getType()); System.out.println("fileUrl is :" + fileList.get(i).getUrl()); System.out.println("Tiny Url is :"+fileList.get(i).getTinyUrl()); System.out.println("fileDescription is: " + fileList.get(i).getDescription()); }String fileType = "<Your_file_type>"; int max = 10; int offset = 0; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.GetFilesByType(fileType, max, offset, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Upload upload = (Upload) response; IList<Upload.File> fileList = upload.GetFileList(); for(int i=0; i < fileList.Count; i++) { App42Log.Console("fileName is " + fileList[i].GetName()); App42Log.Console("fileType is " + fileList[i].GetType()); App42Log.Console("fileUrl is " + fileList[i].GetUrl()); App42Log.Console("TinyUrl Is : " + fileList[i].GetTinyUrl()); App42Log.Console("fileDescription is " + fileList[i].GetDescription()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var fileType = "<Your_file_type>", max = 10, offset = 1, result ; App42.initialize("API_KEY","SECRET_KEY"); var uploadService = new App42Upload(); uploadService.getFilesByTypeByPaging(fileType,max,offset,{ success: function(object) { var uploadObj = JSON.parse(object); result = uploadObj.app42.response.upload.files.file; if(result.length == undefined) { console.log(result.name) } else for(var i = 0;i<result.length;i++){ console.log("fileName is" +result[i].name) console.log("Url is" +result[i].url) console.log("type is"+result[i].type) } }, error: function(error) { } });local fileType = "<Your_file_type>"; local max = 10; local offset = 0; local App42CallBack = {} App42API:initialize("API_KEY", "SECRET_KEY") local uploadService = App42API:buildUploadService() uploadService:getFilesByTypeByPaging(fileType,max,offset,App42CallBack) function App42CallBack:onSuccess(object) if table.getn(object:getFileList()) >1 then for m=1,table.getn(object:getFileList()) do print("fileName is :".. object:getFileList()[m]:getName()); print("Type is :".. object:getFileList()[m]:getType()); print("Url is :".. object:getFileList()[m]:getUrl()); print("fileDescription is: ".. object:getFileList()[m]:getDescription()); end else print("fileName is :".. object:getFileList():getName()); print("Type is :".. object:getFileList():getType()); print("Url is :".. object:getFileList():getUrl()); print("fileDescription is: ".. object:getFileList():getDescription()); 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()) endint max = 2; int offset = 0; FileType fileType = IMAGE; App42API::Initialize("API_KEY", "SECRET_KEY"); UploadService *uploadService = App42API::BuildUploadService(); uploadService->GetFilesByType(fileType,max,offset,app42callback(Sample_Class::onUploadRequestCompleted, this)); void Sample_Class::onUploadRequestCompleted(void *response) { App42UploadResponse *uploadResponse = (App42UploadResponse*)response; printf("\ncode=%d",uploadResponse->getCode()); printf("\nResponse Body=%s",uploadResponse->getBody().c_str()); if(uploadResponse->isSuccess) { for(std::vector<App42Upload>::iterator it = uploadResponse->uploadArray.begin(); it != uploadResponse->uploadArray.end(); ++it) { printf("\n Name=%s",it->name.c_str()); printf("\n UserName=%s",it->userName.c_str()); printf("\n Type=%s",it->type.c_str()); printf("\n Description=%s",it->description.c_str()); printf("\n Url=%s",it->url.c_str()); } } else { printf("\nerrordetails :%s",uploadResponse->errorDetails.c_str()); printf("\nerrorMessage :%s",uploadResponse->errorMessage.c_str()); printf("\nappErrorCode :%d",uploadResponse->appErrorCode); printf("\nhttpErrorCode:%d",uploadResponse->httpErrorCode); } }String fileType = "<Your_file_type>"; int max = 10; int offset = 0; App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); Upload upload = uploadService.GetFilesByType(fileType,max,offset); IList<Upload.File> fileList = upload.GetFileList(); for(int i = 0; i < fileList.Count();i++ ) { Console.WriteLine("fileName is " + fileList[i].GetName()); Console.WriteLine("fileType is " + fileList[i].GetType()); Console.WriteLine("fileUrl is " + fileList[i].GetUrl()); Console.WriteLine("fileDescription is " + fileList[i].GetDescription()); }$fileType = "<Your_file_type>"; $max = 10; $offset = 0; App42API::initialize("API_KEY","SECRET_KEY"); $uploadService = App42API::buildUploadService(); $upload = $uploadService->getFilesByType($fileType,$max,$offset); $fileList = $upload->getFileList(); foreach ($fileList as $files) { print_r("FileName is : " . $files->getName()); print_r("Type is : " . $files->getType()); print_r("Url is : " . $files->getUrl()); print_r("TinyUrl is: " . $files->getTinyUrl()); print_r("Description is: " . $files->getDescription()); } $jsonResponse = $upload->toString();Coming SoonfileType = App42::Upload::UploadFileType.new(); api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY") upload_service = api.build_upload_service upload_file_type = fileType.enum("IMAGE"); max = 10; offset = 0; upload = upload_service.get_files_by_type_by_paging(upload_file_type, max, offset); fileList = Array.new(); for file in fileList do puts "fileName is #{file.name}"; puts "fileType is #{file.type}"; puts "url is #{file.url}"; puts "description is #{file.description}"; end jsonResponse = upload.to_s();var fileType:String = "<Your_file_type>"; var max:int = 10; var offset:int = 0; App42API.initialize("API_KEY","SECRET_KEY"); var uploadService:UploadService = App42API.buildUploadService(); uploadService.getFilesByTypeByPaging(fileType, max, offset,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var upload:Upload = Upload(response); if(upload.getFileList()!= null) { var fileList:Array = upload.getFileList(); for(var k:int=0;k<fileList.length;k++) { var file:File=File(fileList[k]); trace("File Name:"+file.getName()); trace("File Type:"+file.getType()); trace("fileList url:"+file.getUrl()) trace(" tiny Url:"+file.getTinyUrl()) trace("Description:"+file.getDescription()) } } } }Coming SoonUploadFileType fileType = UploadFileType.IMAGE; Integer max = new Integer(1); Integer offset = new Integer(0); App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); Upload upload = uploadService.getFilesByType(fileType,max,offset); Vector fileList = upload.getFileList(); for(int i=0;i < fileList.size();i++) { Upload.File file = (Upload.File)fileList.elementAt(i); System.out.println("fileName is " + file.getName()); System.out.println("fileType is " + file.getType()); System.out.println("fileUrl is " + file.getUrl()); System.out.println("fileDescription is " + file.getDescription()); }
Remove the file based on the file name.
Required Parameters
fileName - The name of the file which has to be removed.
String fileName = "<Your_file_name>"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); uploadService.removeFileByName(fileName, 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 fileName = "<Your_file_name>"; App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.RemoveFileByName(fileName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { App42Response upload = (App42Response) response; String jsonResponse = upload.ToString(); } }NSString *fileName = @"<Your_file_name>"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; UploadService *uploadService = [App42API buildUploadService]; [uploadService removeFileByName:fileName 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]); } }];var fileName = "<Your_file_name>" App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") var userService:UserService? = App42API.buildUploadService uploadService?.removeFileByName(fileName, completionBlock:{ (success, response, exception) -> Void in if (success) { var response = response as! App42Response NSLog("%@", response.strResponse) NSLog("%@", response.isResponseSuccess) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String fileName = "<Your_file_name>"; App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); App42Response app42response = uploadService.removeFileByName(fileName); System.out.println("response is " + app42response) ; boolean success = app42response.isResponseSuccess(); String jsonResponse = app42response.toString();String fileName = "<Your_file_name>"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.RemoveFileByName(fileName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response app42Response = (App42Response) response; App42Log.Console("app42Response is : " + app42Response.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var fileName = "<Your_file_name>", result ; App42.initialize("API_KEY","SECRET_KEY"); var uploadService = new App42Upload(); uploadService.removeFileByName(fileName,{ success: function(object) { var uploadObj = JSON.parse(object); result = uploadObj.app42.response; console.log("success is : " + result.success) }, error: function(error) { } });local fileName = "<Your_file_name>"; local App42CallBack = {} App42API:initialize("API_KEY", "SECRET_KEY") local uploadService = App42API:buildUploadService() uploadService:removeFileByName(fileName,App42CallBack) function App42CallBack:onSuccess(object) print("Response is :"..object:getStrResponse()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* fileName = "<Your_file_name>"; App42API::Initialize("API_KEY", "SECRET_KEY"); UploadService *uploadService = App42API::BuildUploadService(); uploadService->RemoveFileByName(fileName,app42callback(Sample_Class::onUploadRequestCompleted, this)); void Sample_Class::onUploadRequestCompleted(void *response) { App42UploadResponse *uploadResponse = (App42UploadResponse*)response; printf("\ncode=%d",uploadResponse->getCode()); printf("\nResponse Body=%s",uploadResponse->getBody().c_str()); if(uploadResponse->isSuccess) { for(std::vector<App42Upload>::iterator it = uploadResponse->uploadArray.begin(); it != uploadResponse->uploadArray.end(); ++it) { printf("\n Name=%s",it->name.c_str()); printf("\n UserName=%s",it->userName.c_str()); printf("\n Type=%s",it->type.c_str()); printf("\n Description=%s",it->description.c_str()); printf("\n Url=%s",it->url.c_str()); } } else { printf("\nerrordetails :%s",uploadResponse->errorDetails.c_str()); printf("\nerrorMessage :%s",uploadResponse->errorMessage.c_str()); printf("\nappErrorCode :%d",uploadResponse->appErrorCode); printf("\nhttpErrorCode:%d",uploadResponse->httpErrorCode); } }String fileName = "<Your_file_name>"; App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); App42Response response = uploadService.RemoveFileByName(fileName); Boolean success = response.IsResponseSuccess(); String jsonResponse = response.ToString();$fileName = "<Your_file_name>"; App42API::initialize("API_KEY","SECRET_KEY"); $uploadService = App42API::buildUploadService(); $response = $uploadService->removeFileByName($fileName); print_r("Response is :". $response->toString()); $success = $response->isResponseSuccess(); $jsonResponse = $response->toString();Coming SoonfileName = "<Your_file_name>"; api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY") upload_service = api.build_upload_service response = upload_service.remove_file_by_name(fileName); success = response.isResponseSuccess(); jsonResponse = response.to_s();var fileName:String = "<Your_file_name>"; App42API.initialize("API_KEY","SECRET_KEY"); var uploadService:UploadService = App42API.buildUploadService(); uploadService.removeFileByName(fileName,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var app42response :App42Response= App42Response(response); trace("response is " + app42response) } }Coming SoonString fileName = "<Your_file_name>"; App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); App42Response response = uploadService.removeFileByName(fileName); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();
Removes all the files for the App.
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); uploadService.removeAllFiles(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()); } });App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.RemoveAllFiles(new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { App42Response upload = (App42Response) response; String jsonResponse = upload.ToString(); } }[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; UploadService *uploadService = [App42API buildUploadService]; [uploadService removeAllFiles:^(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]); } }];App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") var userService:UserService? = App42API.buildUploadService uploadService?.removeAllFiles(success, responseObj, exception) { if (success) { var response = response as! App42Response NSLog("%@", response.strResponse) NSLog("%@", response.isResponseSuccess) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } }App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); App42Response app42response = uploadService.removeAllFiles(); System.out.println("response is " + app42response) ; boolean success = app42response.isResponseSuccess(); String jsonResponse = app42response.toString();App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.RemoveAllFiles(new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response app42Response = (App42Response) response; App42Log.Console("app42Response is : " + app42Response.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var result ; App42.initialize("API_KEY","SECRET_KEY"); var uploadService = new App42Upload(); uploadService.removeAllFiles({ success: function(object) { var uploadObj = JSON.parse(object); result = uploadObj.app42.response; console.log("success is : " + result.success) }, error: function(error) { } });local App42CallBack = {} App42API:initialize("API_KEY", "SECRET_KEY") local uploadService = App42API:buildUploadService() uploadService:removeAllFiles(App42CallBack) function App42CallBack:onSuccess(object) print("Response is :"..object:getStrResponse()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endApp42API::Initialize("API_KEY", "SECRET_KEY"); UploadService *uploadService = App42API::BuildUploadService(); uploadService->RemoveAllFiles(app42callback(Sample_Class::onUploadRequestCompleted, this)); void Sample_Class::onUploadRequestCompleted(void *response) { App42UploadResponse *uploadResponse = (App42UploadResponse*)response; printf("\ncode=%d",uploadResponse->getCode()); printf("\nResponse Body=%s",uploadResponse->getBody().c_str()); if(uploadResponse->isSuccess) { for(std::vector<App42Upload>::iterator it = uploadResponse->uploadArray.begin(); it != uploadResponse->uploadArray.end(); ++it) { printf("\n Name=%s",it->name.c_str()); printf("\n UserName=%s",it->userName.c_str()); printf("\n Type=%s",it->type.c_str()); printf("\n Description=%s",it->description.c_str()); printf("\n Url=%s",it->url.c_str()); } } else { printf("\nerrordetails :%s",uploadResponse->errorDetails.c_str()); printf("\nerrorMessage :%s",uploadResponse->errorMessage.c_str()); printf("\nappErrorCode :%d",uploadResponse->appErrorCode); printf("\nhttpErrorCode:%d",uploadResponse->httpErrorCode); } }App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); App42Response response = uploadService.RemoveAllFiles(); Boolean success = response.IsResponseSuccess(); String jsonResponse = response.ToString();App42API::initialize("API_KEY","SECRET_KEY"); $uploadService = App42API::buildUploadService(); $response = $uploadService->removeAllFiles(); print_r("Response is :". $response->toString()); $success = $response->isResponseSuccess(); $jsonResponse = $response->toString();Coming Soonapi = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY") upload_service = api.build_upload_service response = upload_service.remove_all_files(); success = response.isResponseSuccess(); jsonResponse = response.to_s();App42API.initialize("API_KEY","SECRET_KEY"); var uploadService:UploadService = App42API.buildUploadService(); uploadService.removeAllFiles(new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var app42response :App42Response= App42Response(response); trace("response is " + app42response) } }Coming SoonApp42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); App42Response response = uploadService.removeAllFiles(); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();
Upload file in the cloud for a particular user.
Required Parameters
fileName - The name of the file which has to be saved. It is used to retrieve the file.
userName - The name of the user for whom file has to be saved.
filePath - The local path for the file.
fileType - The type of the file. File can be either Audio, Video, Image, Binary, Txt, xml, json, csv or other Use the static constants such as UploadFileType.AUDIO, UploadFileType.XML etc.
description - Description of the file to be uploaded.
String fileName = "<Your_file_name>"; String userName = "Nick"; String description = "File Description"; String filePath = "Your Local File Path"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); UploadFileType fileType = UploadFileType.IMAGE; uploadService.uploadFileForUser(fileName,userName, filePath, fileType, description, new App42CallBack() { public void onSuccess(Object response) { Upload upload = (Upload)response; ArrayList<Upload.File> fileList = upload.getFileList(); for(int i = 0; i < fileList.size();i++ ) { System.out.println("fileName is :" + fileList.get(i).getName()); System.out.println("fileType is :" + fileList.get(i).getType()); System.out.println("fileUrl is :" + fileList.get(i).getUrl()); System.out.println("Tiny Url is :"+fileList.get(i).getTinyUrl()); System.out.println("fileDescription is: " + fileList.get(i).getDescription()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });Not AvailableNSString *fileName = @"FileName.ext"; NSString *userName = @"Nick"; NSString *description = @"File Description"; NSString *filePath = @"Your Local File Path"; NSString *fileType = @"<Your_file_type>"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; UploadService *uploadService = [App42API buildUploadService]; [uploadService uploadFileForUser:fileName userName:userName filePath:filePath uploadFileType:fileType fileDescription:description completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Upload *upload = (Upload*)responseObj; NSMutableArray *fileList = upload.fileListArray; for (File *file in fileList) { NSLog(@"fileName is %@" , file.name); NSLog(@"fileType is %@" , file.type); NSLog(@"URL is %@" , file.url); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];var fileName = "FileName.ext" VAR userName = "Nick" var description = "File Description" var filePath = "Your Local File Path" VAR fileType = "<Your_file_type>" App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") var userService:UserService? = App42API.buildUploadService uploadService?.uploadFileForUser(fileName, userName:userName, filePath:filePath, uploadFileType:fileType, fileDescription:description, completionBlock:{ (success, response, exception) -> Void in if (success) { var upload = responseObj as! Upload var fileList = upload.fileListArray for file in fileList { NSLog("%@" , file.name) NSLog("%@" , file.type) NSLog("%@" , file.url) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String fileName = "<Your_file_name>"; String userName = "Nick"; String description = "File Description"; String filePath = "Your Local File Path"; UploadFileType fileType = UploadFileType.IMAGE; App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); Upload upload = uploadService.uploadFileForUser(fileName, userName, filePath, fileType, description); ArrayList<Upload.File> fileList = upload.getFileList(); for(int i = 0; i < fileList.size();i++ ) { System.out.println("fileName is :" + fileList.get(i).getName()); System.out.println("fileType is :" + fileList.get(i).getType()); System.out.println("fileUrl is :" + fileList.get(i).getUrl()); System.out.println("Tiny Url is :"+fileList.get(i).getTinyUrl()); System.out.println("fileDescription is: " + fileList.get(i).getDescription()); }String fileName = "<Your_file_name>"; String userName = "Nick"; String description = "File Description"; String filePath = "Your Local File Path"; String fileType = "<Your_file_type>"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.UploadFileForUser(fileName, userName, filePath, fileType, description, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Upload upload = (Upload) response; IList<Upload.File> fileList = upload.GetFileList(); for(int i=0; i < fileList.Count; i++) { App42Log.Console("fileName is " + fileList[i].GetName()); App42Log.Console("fileType is " + fileList[i].GetType()); App42Log.Console("fileUrl is " + fileList[i].GetUrl()); App42Log.Console("TinyUrl Is : " + fileList[i].GetTinyUrl()); App42Log.Console("fileDescription is " + fileList[i].GetDescription()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var fileName = "<Your_file_name>", userName = "Nick", description = "File Description", filePath = "Your Local File Path", fileType = "<Your_file_type>", result ; App42.initialize("API_KEY","SECRET_KEY"); var uploadService = new App42Upload(); uploadService.uploadFileForUser(fileName,userName,filePath,fileType,description,{ success: function(object) { var uploadObj = JSON.parse(object); console.log("name is " +uploadObj.app42.response.upload.files.file.name) console.log("file type is"+uploadObj.app42.response.upload.files.file.type) console.log(" url is" +uploadObj.app42.response.upload.files.file.url) }, error: function(error) { } });local fileName = "<Your_file_name>"; local userName = "Nick"; local description = "File Description"; local filePath = "Your Local File Path"; local fileType = "<Your_file_type>"; local App42CallBack = {} App42API:initialize("API_KEY", "SECRET_KEY") local uploadService = App42API:buildUploadService() uploadService:uploadFileForUser(fileName,userName,filePath ,fileType,description,App42CallBack) function App42CallBack:onSuccess(object) print("FileName is :".. object:getFileList():getName()); print("UserName is :".. object:getFileList():getUserName()); print("Type is :".. object:getFileList():getType()); print("Url is :".. object:getFileList():getUrl()); print("Description is: ".. object:getFileList():getDescription()); 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()) endconst char* fileName = "<Your_file_name>"; const char* userName = "Nick"; const char* filePath = "Your Local File Path"; FileType fileType = IMAGE; const char* description = "File Description"; App42API::Initialize("API_KEY", "SECRET_KEY"); UploadService *uploadService = App42API::BuildUploadService(); uploadService->UploadFileForUser(fileName,userName, filePath, fileType, description, app42callback(Sample_Class::onUploadRequestCompleted, this)); void Sample_Class::onUploadRequestCompleted(void *response) { App42UploadResponse *uploadResponse = (App42UploadResponse*)response; printf("\ncode=%d",uploadResponse->getCode()); printf("\nResponse Body=%s",uploadResponse->getBody().c_str()); if(uploadResponse->isSuccess) { for(std::vector<App42Upload>::iterator it = uploadResponse->uploadArray.begin(); it != uploadResponse->uploadArray.end(); ++it) { printf("\n Name=%s",it->name.c_str()); printf("\n UserName=%s",it->userName.c_str()); printf("\n Type=%s",it->type.c_str()); printf("\n Description=%s",it->description.c_str()); printf("\n Url=%s",it->url.c_str()); printf("\n CreatedOn=%s",it->createdOn.c_str()); } } else { printf("\nerrordetails :%s",uploadResponse->errorDetails.c_str()); printf("\nerrorMessage :%s",uploadResponse->errorMessage.c_str()); printf("\nappErrorCode :%d",uploadResponse->appErrorCode); printf("\nhttpErrorCode:%d",uploadResponse->httpErrorCode); } }String fileName = "<Your_file_name>"; String userName = "Nick"; String description = "File Description"; String filePath = "Your Local File Path"; String fileType = "<Your_file_type>"; App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); Upload upload = uploadService.UploadFileForUser(fileName,userName,filePath,fileType,description); IList<Upload.File> fileList = upload.GetFileList(); for(int i = 0; i < fileList.Count();i++ ) { Console.WriteLine("fileName is " + fileList[i].GetName()); Console.WriteLine("fileType is " + fileList[i].GetType()); Console.WriteLine("fileUrl is " + fileList[i].GetUrl()); Console.WriteLine("fileDescription is " + fileList[i].GetDescription()); }$fileName = "<Your_file_name>"; $userName = "Nick"; $fileType = "IMAGE"; $filePath = "Your Local File Path"; $description = "File Description"; App42API::initialize("API_KEY","SECRET_KEY"); $uploadService = App42API::buildUploadService(); $upload = $uploadService->uploadFileForUser($fileName,$userName, $filePath, $fileType, $description); $fileList = $upload->getFileList(); foreach ($fileList as $files) { print_r("FileName is : " . $files->getName()); print_r("UserName is : " . $files->getUserName()); print_r("Type is : " . $files->getType()); print_r("Url is : " . $files->getUrl()); print_r("TinyUrl is: " . $files->getTinyUrl()); print_r("Description is: " . $files->getDescription()); } $jsonResponse = $upload->toString();Coming SoonfileName = "<Your_file_name>"; userName = "Nick"; filePath = "Your Local File Path"; fileType = App42::Upload::UploadFileType.new(); upload_file_type = file_type.enum("IMAGE"); description = "File Description"; api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY") upload_service = api.build_upload_service upload = uploadService.upload_file_for_user(fileName,userName,filePath,upload_file_type,description); file_list = Array.new(); for file in file_list do puts "fileName is #{file.name}"; puts "fileType is #{file.type}"; puts "url is #{file.url}"; puts "description is #{file.description}"; end jsonResponse = upload.to_s();var fileName:String = "<Your_file_name>"; var userName:String = "Nick"; var description:String = "File Description"; var filePath:String = "Your Local File Path"; var fileType:String = "<Your_file_type>"; App42API.initialize("API_KEY","SECRET_KEY"); var uploadService:UploadService = App42API.buildUploadService(); uploadService.uploadFileForUser(fileName,userName, filePath,fileType,description,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var upload:Upload = Upload(response); if(upload.getFileList()!= null) { var fileList:Array = upload.getFileList(); for(var k:int=0;k<fileList.length;k++) { var file:File=File(fileList[k]); trace("File Name:"+file.getName()); trace("File Type:"+file.getType()); trace("file url:"+file.getUrl()); trace(" tiny Url:"+file.getTinyUrl()); trace("Description:"+file.getDescription()); trace("Created On"+file.getCreatedOn()); } } } }Coming SoonNot Available
Get the file based on the file name of a user.
Required Parameters
fileName - The name of the file which has to be retrieved.
userName - The name of the user for whom file has to be retrieved.
String fileName = "<Your_file_name>"; String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); uploadService.getFileByUser(fileName, userName, new App42CallBack() { public void onSuccess(Object response) { Upload upload = (Upload)response; ArrayList<Upload.File> fileList = upload.getFileList(); for(int i = 0; i < fileList.size();i++ ) { System.out.println("fileName is :" + fileList.get(i).getName()); System.out.println("fileType is :" + fileList.get(i).getType()); System.out.println("fileUrl is :" + fileList.get(i).getUrl()); System.out.println("Tiny Url is :"+fileList.get(i).getTinyUrl()); System.out.println("fileDescription is: " + fileList.get(i).getDescription()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String fileName = "<Your_file_name>"; String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.GetFileByUser(fileName,userName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Upload upload = (Upload) response; IList<Upload.File> fileList = upload.GetFileList(); for(int i = 0; i < fileList.Count();i++ ) { Console.WriteLine("fileName is " + fileList[i].GetName()); Console.WriteLine("fileType is " + fileList[i].GetType()); Console.WriteLine("fileUrl is " + fileList[i].GetUrl()); Console.WriteLine("fileDescription is " + fileList[i].GetDescription()); } } }NSString *fileName = @"<Your_file_name>"; NSString *userName = @"Nick"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; UploadService *uploadService = [App42API buildUploadService]; [uploadService getFileByUser:fileName userName:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Upload *upload = (Upload*)responseObj; NSMutableArray *fileList = upload.fileListArray; for (File *file in fileList) { NSLog(@"fileName is %@" , file.name); NSLog(@"fileType is %@" , file.type); NSLog(@"URL is %@" , file.url); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];var fileName = "<Your_file_name>" VAR userName = "Nick" App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") var userService:UserService? = App42API.buildUploadService uploadService?.getFileByUser(fileName, userName:userName, completionBlock:{ (success, response, exception) -> Void in if (success) { var upload = responseObj as! Upload var fileList = upload.fileListArray for file in fileList { NSLog("%@" , file.name) NSLog("%@" , file.type) NSLog("%@" , file.url) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String fileName = "<Your_file_name>"; String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); Upload upload = uploadService.getFileByUser(fileName,userName); ArrayList<Upload.File> fileList = upload.getFileList(); for(int i = 0; i < fileList.size();i++ ) { System.out.println("fileName is :" + fileList.get(i).getName()); System.out.println("fileType is :" + fileList.get(i).getType()); System.out.println("fileUrl is :" + fileList.get(i).getUrl()); System.out.println("Tiny Url is :"+fileList.get(i).getTinyUrl()); System.out.println("fileDescription is: " + fileList.get(i).getDescription()); }String fileName = "<Your_file_name>"; String userName = "Nick"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.GetFileByUser(fileName, userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Upload upload = (Upload) response; IList<Upload.File> fileList = upload.GetFileList(); for(int i=0; i < fileList.Count; i++) { App42Log.Console("fileName is " + fileList[i].GetName()); App42Log.Console("fileType is " + fileList[i].GetType()); App42Log.Console("fileUrl is " + fileList[i].GetUrl()); App42Log.Console("TinyUrl Is : " + fileList[i].GetTinyUrl()); App42Log.Console("fileDescription is " + fileList[i].GetDescription()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var fileName = "<Your_file_name>", userName = "Nick"; var result ; App42.initialize("API_KEY","SECRET_KEY"); var uploadService = new App42Upload(); uploadService.getFileByUser(fileName,userName,{ success: function(object) { var uploadObj = JSON.parse(object); console.log("name is " +uploadObj.app42.response.upload.files.file.name) console.log("file type is"+uploadObj.app42.response.upload.files.file.type) console.log(" url is" +uploadObj.app42.response.upload.files.file.url) }, error: function(error) { } });local fileName = "<Your_file_name>"; local userName = "Nick"; local App42CallBack = {} App42API:initialize("API_KEY", "SECRET_KEY") local uploadService = App42API:buildUploadService() uploadService:getFileByUser(fileName, userName,App42CallBack) function App42CallBack:onSuccess(object) print("FileName is :".. object:getFileList():getName()); print("UserName is :".. object:getFileList():getUserName()); print("Type is :".. object:getFileList():getType()); print("Url is :".. object:getFileList():getUrl()); print("Description is: ".. object:getFileList():getDescription()); 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()) endconst char* fileName = "<Your_file_name>"; const char* userName = "Nick"; App42API::Initialize("API_KEY", "SECRET_KEY"); UploadService *uploadService = App42API::BuildUploadService(); uploadService->GetFileByUser(fileName, userName,app42callback(Sample_Class::onUploadRequestCompleted, this)); void Sample_Class::onUploadRequestCompleted(void *response) { App42UploadResponse *uploadResponse = (App42UploadResponse*)response; printf("\ncode=%d",uploadResponse->getCode()); printf("\nResponse Body=%s",uploadResponse->getBody().c_str()); if(uploadResponse->isSuccess) { for(std::vector<App42Upload>::iterator it = uploadResponse->uploadArray.begin(); it != uploadResponse->uploadArray.end(); ++it) { printf("\n Name=%s",it->name.c_str()); printf("\n UserName=%s",it->userName.c_str()); printf("\n Type=%s",it->type.c_str()); printf("\n Description=%s",it->description.c_str()); printf("\n Url=%s",it->url.c_str()); } } else { printf("\nerrordetails :%s",uploadResponse->errorDetails.c_str()); printf("\nerrorMessage :%s",uploadResponse->errorMessage.c_str()); printf("\nappErrorCode :%d",uploadResponse->appErrorCode); printf("\nhttpErrorCode:%d",uploadResponse->httpErrorCode); } }String fileName = "<Your_file_name>"; String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); Upload upload = uploadService.GetFileByUser(fileName,userName); IList<Upload.File> fileList = upload.GetFileList(); for(int i = 0; i < fileList.Count();i++ ) { Console.WriteLine("fileName is " + fileList[i].GetName()); Console.WriteLine("fileType is " + fileList[i].GetType()); Console.WriteLine("fileUrl is " + fileList[i].GetUrl()); Console.WriteLine("fileDescription is " + fileList[i].GetDescription()); }$fileName = "<Your_file_name>"; $userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $uploadService = App42API::buildUploadService(); $upload = $uploadService->getFileByUser($fileName,$userName); $fileList = $upload->getFileList(); foreach ($fileList as $files) { print_r("FileName is : " . $files->getName()); print_r("UserName is : " . $files->getUserName()); print_r("Type is : " . $files->getType()); print_r("Url is : " . $files->getUrl()); print_r("TinyUrl is: " . $files->getTinyUrl()); print_r("Description is: " . $files->getDescription()); } $jsonResponse = $upload->toString();Coming SoonfileName = "<Your_file_name>"; userName = "Nick"; api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY") upload_service = api.build_upload_service upload = upload_service.get_file_by_user(fileName,userName); file_list = Array.new(); for file in file_list do puts "fileName is #{file.name}"; puts "fileType is #{file.type}"; puts "url is #{file.url}"; puts "description is #{file.description}"; end jsonResponse = upload.to_s();var fileName:String = "<Your_file_name>"; var userName:String = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); var uploadService:UploadService = App42API.buildUploadService(); uploadService.getFileByUser(fileName,userName,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var upload:Upload = Upload(response); if(upload.getFileList()!= null) { var fileList:Array = upload.getFileList(); for(var k:int=0;k<fileList.length;k++) { var file:File=File(fileList[k]); trace("File Name:"+file.getName()); trace("File Type:"+file.getType()); trace("fileList url:"+file.getUrl()) trace(" tiny Url:"+file.getTinyUrl()) trace(" Description:"+file.getDescription()) } } } }Coming SoonString fileName = "<Your_file_name>"; String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); Upload upload = uploadService.getFileByUser(fileName,userName); Vector fileList = upload.getFileList(); for(int i=0;i < fileList.size();i++) { Upload.File file = (Upload.File)fileList.elementAt(i); System.out.println("fileName is " + file.getName()); System.out.println("fileType is " + file.getType()); System.out.println("fileUrl is " + file.getUrl()); System.out.println("fileDescription is " + file.getDescription()); }
Get all the files based on user name.
Required Parameters
userName - The name of the user for which file has to be retrieved.
String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); uploadService.getAllFilesByUser(userName, new App42CallBack() { public void onSuccess(Object response) { Upload upload = (Upload)response; ArrayList<Upload.File> fileList = upload.getFileList(); for(int i = 0; i < fileList.size();i++ ) { System.out.println("fileName is :" + fileList.get(i).getName()); System.out.println("fileType is :" + fileList.get(i).getType()); System.out.println("fileUrl is :" + fileList.get(i).getUrl()); System.out.println("Tiny Url is :"+fileList.get(i).getTinyUrl()); System.out.println("fileDescription is: " + fileList.get(i).getDescription()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.GetAllFilesByUser(userName,new Callback()); public class Callback : App42Callback { public void OnSuccess(Object response) { Upload upload = (Upload) response; IList<Upload.File> fileList = upload.GetFileList(); for(int i = 0; i < fileList.Count();i++ ) { Console.WriteLine("fileName is " + fileList[i].GetName()); Console.WriteLine("fileType is " + fileList[i].GetType()); Console.WriteLine("fileUrl is " + fileList[i].GetUrl()); Console.WriteLine("fileDescription is " + fileList[i].GetDescription()); } } public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } }NSString *userName = @"Nick"; [uploadService getAllFilesByUser:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Upload *upload = (Upload*)responseObj; NSMutableArray *fileList = upload.fileListArray; for (File *file in fileList) { NSLog(@"fileName is %@" , file.name); NSLog(@"fileType is %@" , file.type); NSLog(@"URL is %@" , file.url); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];var userName = "Nick" App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") var userService:UserService? = App42API.buildUploadService uploadService?.getAllFilesByUser(userName, completionBlock:{ (success, response, exception) -> Void in if (success) { var upload = responseObj as! Upload var fileList = upload.fileListArray for file in fileList { NSLog("%@" , file.name) NSLog("%@" , file.type) NSLog("%@" , file.url) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); Upload upload = uploadService.getAllFilesByUser(userName); ArrayList<Upload.File> fileList = upload.getFileList(); for(int i = 0; i < fileList.size();i++ ) { System.out.println("fileName is :" + fileList.get(i).getName()); System.out.println("fileType is :" + fileList.get(i).getType()); System.out.println("fileUrl is :" + fileList.get(i).getUrl()); System.out.println("Tiny Url is :"+fileList.get(i).getTinyUrl()); System.out.println("fileDescription is: " + fileList.get(i).getDescription()); }String userName = "Nick"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.GetAllFilesByUser(userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Upload upload = (Upload) response; IList<Upload.File> fileList = upload.GetFileList(); for(int i=0; i < fileList.Count; i++) { App42Log.Console("fileName is " + fileList[i].GetName()); App42Log.Console("fileType is " + fileList[i].GetType()); App42Log.Console("fileUrl is " + fileList[i].GetUrl()); App42Log.Console("TinyUrl Is : " + fileList[i].GetTinyUrl()); App42Log.Console("fileDescription is " + fileList[i].GetDescription()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick"; var result ; App42.initialize("API_KEY","SECRET_KEY"); var uploadService = new App42Upload(); uploadService.getAllFilesByUser(userName,{ success: function(object) { var uploadObj = JSON.parse(object); result = uploadObj.app42.response.upload.files.file; if(result.length == undefined) { console.log(result.name) } else for(var i = 0;i<result.length;i++){ console.log(result[i].name) console.log(result[i].url) console.log(result[i].type) } }, error: function(error) { } });local userName = "Nick"; local App42CallBack = {} App42API:initialize("API_KEY", "SECRET_KEY") local uploadService = App42API:buildUploadService() uploadService:getAllFilesByUser(userName,App42CallBack) function App42CallBack:onSuccess(object) if table.getn(object:getFileList()) >1 then for m=1,table.getn(object:getFileList()) do print("fileName is :".. object:getFileList()[m]:getName()); print("Username is :".. object:getFileList()[m]:getUserName()); print("Type is :".. object:getFileList()[m]:getType()); print("Url is :".. object:getFileList()[m]:getUrl()); print("Description is: ".. object:getFileList()[m]:getDescription()); end else print("fileName is :".. object:getFileList():getName()); print("Username is :".. object:getFileList():getUserName()); print("Type is :".. object:getFileList():getType()); print("Url is :".. object:getFileList():getUrl()); print("fileDescription is: ".. object:getFileList():getDescription()); 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()) endconst char* userName = "Nick"; App42API::Initialize("API_KEY", "SECRET_KEY"); UploadService *uploadService = App42API::BuildUploadService(); uploadService->GetAllFilesByUser(userName, app42callback(Sample_Class::onUploadRequestCompleted, this)); void Sample_Class::onUploadRequestCompleted(void *response) { App42UploadResponse *uploadResponse = (App42UploadResponse*)response; printf("\ncode=%d",uploadResponse->getCode()); printf("\nResponse Body=%s",uploadResponse->getBody().c_str()); if(uploadResponse->isSuccess) { for(std::vector<App42Upload>::iterator it = uploadResponse->uploadArray.begin(); it != uploadResponse->uploadArray.end(); ++it) { printf("\n Name=%s",it->name.c_str()); printf("\n UserName=%s",it->userName.c_str()); printf("\n Type=%s",it->type.c_str()); printf("\n Description=%s",it->description.c_str()); printf("\n Url=%s",it->url.c_str()); } } else { printf("\nerrordetails :%s",uploadResponse->errorDetails.c_str()); printf("\nerrorMessage :%s",uploadResponse->errorMessage.c_str()); printf("\nappErrorCode :%d",uploadResponse->appErrorCode); printf("\nhttpErrorCode:%d",uploadResponse->httpErrorCode); } }String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); Upload upload = uploadService.GetAllFilesByUser(userName); IList<Upload.File> fileList = upload.GetFileList(); for(int i = 0; i < fileList.Count();i++ ) { Console.WriteLine("fileName is " + fileList[i].GetName()); Console.WriteLine("fileType is " + fileList[i].GetType()); Console.WriteLine("fileUrl is " + fileList[i].GetUrl()); Console.WriteLine("fileDescription is " + fileList[i].GetDescription()); }$userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $uploadService = App42API::buildUploadService(); $upload = $uploadService->getAllFilesByUser($userName); $fileList = $upload->getFileList(); foreach ($fileList as $files) { print_r("FileName is : " . $files->getName()); print_r("UserName is : " . $files->getUserName()); print_r("Type is : " . $files->getType()); print_r("Url is : " . $files->getUrl()); print_r("TinyUrl is: " . $files->getTinyUrl()); print_r("Description is: " . $files->getDescription()); } $jsonResponse = $upload->toString();Coming SoonuserName = "Nick"; api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY") upload_service = api.build_upload_service upload = upload_service.get_all_files_by_user(userName); file_list = Array.new(); for file in file_list do puts "fileName is #{file.name}"; puts "fileType is #{file.type}"; puts "url is #{file.url}"; puts "description is #{file.description}"; end jsonResponse = upload.to_s();var userName:String = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); var uploadService:UploadService = App42API.buildUploadService(); uploadService.getAllFilesByUser(userName,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var upload:Upload = Upload(response); if(upload.getFileList()!= null) { var fileList:Array = upload.getFileList(); for(var k:int=0;k<fileList.length;k++) { var file:File=File(fileList[k]); trace("File Name:"+file.getName()); trace("File Type:"+file.getType()); trace("fileList url:"+file.getUrl()) trace(" tiny Url:"+file.getTinyUrl()) trace(" Description:"+file.getDescription()) } } } }Coming SoonString userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); Upload upload = uploadService.getAllFilesByUser(userName); Vector fileList = upload.getFileList(); for(int i=0;i < fileList.size();i++) { Upload.File file = (Upload.File)fileList.elementAt(i); System.out.println("fileName is " + file.getName()); System.out.println("fileType is " + file.getType()); System.out.println("fileUrl is " + file.getUrl()); System.out.println("fileDescription is " + file.getDescription()); }
Get the count of files based on user name.
Required Parameters
userName - The name of the user for which file has to be retrieved.
String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); uploadService.getAllFilesCountByUser(userName,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 userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.GetAllFilesCountByUser(userName,new Callback()); public class Callback : App42Callback { public void OnSuccess(Object response) { App42Response upload = (App42Response) response; String jsonResponse = upload.ToString(); } public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } }NSString *userName = @"Nick"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; UploadService *uploadService = [App42API buildUploadService]; [uploadService getAllFilesCountByUser:userName 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]); } }];var userName = "Nick" App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") var userService:UserService? = App42API.buildUploadService uploadService?.getAllFilesCountByUser(userName, completionBlock:{ (success, response, exception) -> Void in if (success) { var response = response as! App42Response NSLog("%@", response.strResponse) NSLog("%@", response.isResponseSuccess) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); App42Response app42response = uploadService.getAllFilesCountByUser(userName); System.out.println("Total Records : " + app42response.getTotalRecords()) ; boolean success = app42response.isResponseSuccess(); String jsonResponse = app42response.toString();String userName = "Nick"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.GetAllFilesCountByUser(userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response app42Response = (App42Response) response; App42Log.Console("app42Response is : " + app42Response.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", result ; App42.initialize("API_KEY","SECRET_KEY"); var uploadService = new App42Upload(); uploadService.getAllFilesCountByUser(userName, { success: function(object) { var uploadObj = JSON.parse(object); result = uploadObj.app42.response; console.log("success is : " + result.success) }, error: function(error) { } });local userName = "Nick"; local App42CallBack = {} App42API:initialize("API_KEY", "SECRET_KEY") local uploadService = App42API:buildUploadService() uploadService:getAllFilesCountByUser(userName,App42CallBack) function App42CallBack:onSuccess(object) print("Total Records 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()) endconst char* userName = "Nick"; App42API::Initialize("API_KEY", "SECRET_KEY"); UploadService *uploadService = App42API::BuildUploadService(); uploadService->GetAllFilesCountByUser(userName,app42callback(Sample_Class::onUploadRequestCompleted, this)); void Sample_Class::onUploadRequestCompleted(void *response) { App42UploadResponse *uploadResponse = (App42UploadResponse*)response; printf("\ncode=%d",uploadResponse->getCode()); printf("\nResponse Body=%s",uploadResponse->getBody().c_str()); if(uploadResponse->isSuccess) { printf("\nTotalRecords=%d",uploadResponse->getTotalRecords()); } else { printf("\nerrordetails :%s",uploadResponse->errorDetails.c_str()); printf("\nerrorMessage :%s",uploadResponse->errorMessage.c_str()); printf("\nappErrorCode :%d",uploadResponse->appErrorCode); printf("\nhttpErrorCode:%d",uploadResponse->httpErrorCode); } }String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); App42Response response = uploadService.GetAllFilesCountByUser(userName); Boolean success = response.IsResponseSuccess(); String jsonResponse = response.ToString();$userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $uploadService = App42API::buildUploadService(); $response = $uploadService->getAllFilesCountByUser($userName); print_r("TotalRecords is ".$response->getTotalRecords()); $success = $response->isResponseSuccess(); $jsonResponse = $response->toString();Coming SoonuserName = "Nick"; api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY") upload_service = api.build_upload_service response = upload_service.get_all_files_count_by_user(userName); success = response.isResponseSuccess(); total_records = response.totalRecords(); jsonResponse = response.to_s();var userName:String = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); var uploadService:UploadService = App42API.buildUploadService(); uploadService.getAllFilesCountByUser(userName,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var app42Response:App42Response = App42Response(response); trace("Totalrecords is : " + app42Response.getTotalRecords()); } }Coming SoonString userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); App42Response response = uploadService.getAllFilesCountByUser(userName); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();
Get all the files based on user name by paging.
Required Parameters
max - Maximum number of records to be fetched.
offset - From where the records are to be fetched.
userName - The name of the user for which file has to be retrieved.
String userName = "Nick"; int max = 10; int offset = 0; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); uploadService.getAllFilesByUser(userName,max,offset,new App42CallBack() { public void onSuccess(Object response) { Upload upload = (Upload)response; ArrayList<Upload.File> fileList = upload.getFileList(); for(int i = 0; i < fileList.size();i++ ) { System.out.println("fileName is :" + fileList.get(i).getName()); System.out.println("fileType is :" + fileList.get(i).getType()); System.out.println("fileUrl is :" + fileList.get(i).getUrl()); System.out.println("Tiny Url is :"+fileList.get(i).getTinyUrl()); System.out.println("fileDescription is: " + fileList.get(i).getDescription()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; int max = 10; int offset = 0; App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.GetAllFilesByUser(userName,max,offset,new Callback()); public class Callback : App42Callback { public void OnSuccess(Object response) { Upload upload = (Upload) response; IList<Upload.File> fileList = upload.GetFileList(); for(int i = 0; i < fileList.Count();i++ ) { Console.WriteLine("fileName is " + fileList[i].GetName()); Console.WriteLine("fileType is " + fileList[i].GetType()); Console.WriteLine("fileUrl is " + fileList[i].GetUrl()); Console.WriteLine("fileDescription is " + fileList[i].GetDescription()); } } public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } }NSString *userName = @"Nick"; int max = 10; int offset = 0; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; UploadService *uploadService = [App42API buildUploadService]; [uploadService getAllFilesByUser:userName max:max offset:offset completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Upload *upload = (Upload*)responseObj; NSMutableArray *fileList = upload.fileListArray; for (File *file in fileList) { NSLog(@"fileName is %@" , file.name); NSLog(@"fileType is %@" , file.type); NSLog(@"URL is %@" , file.url); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];int max = 10 int offset = 0 var userName = "Nick" App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") var userService:UserService? = App42API.buildUploadService uploadService?.getAllFilesByUser(userName, max:max, offset:offset, completionBlock:{ (success, response, exception) -> Void in if (success) { var upload = responseObj as! Upload var fileList = upload.fileListArray for file in fileList { NSLog("%@" , file.name) NSLog("%@" , file.type) NSLog("%@" , file.url) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; int max = 10; int offset = 0; App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); Upload upload = uploadService.getAllFilesByUser(userName,max,offset); ArrayList<Upload.File> fileList = upload.getFileList(); for(int i = 0; i < fileList.size();i++ ) { System.out.println("fileName is :" + fileList.get(i).getName()); System.out.println("fileType is :" + fileList.get(i).getType()); System.out.println("fileUrl is :" + fileList.get(i).getUrl()); System.out.println("Tiny Url is :"+fileList.get(i).getTinyUrl()); System.out.println("fileDescription is: " + fileList.get(i).getDescription()); } String jsonResponse = upload.toString();String userName = "Nick"; int max = 10; int offset = 0; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.GetAllFilesByUser(userName, max, offset, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Upload upload = (Upload) response; IList<Upload.File> fileList = upload.GetFileList(); for(int i=0; i < fileList.Count; i++) { App42Log.Console("fileName is " + fileList[i].GetName()); App42Log.Console("fileType is " + fileList[i].GetType()); App42Log.Console("fileUrl is " + fileList[i].GetUrl()); App42Log.Console("TinyUrl Is : " + fileList[i].GetTinyUrl()); App42Log.Console("fileDescription is " + fileList[i].GetDescription()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", max = 10, offset = 0; var result ; App42.initialize("API_KEY","SECRET_KEY"); var uploadService = new App42Upload(); uploadService.getAllFilesByUserWithPaging(userName,max,offset,{ success: function(object) { var uploadObj = JSON.parse(object); result = uploadObj.app42.response.upload.files.file; if(result.length == undefined) { console.log(result.name) } else for(var i = 0;i<result.length;i++){ console.log(result[i].name) console.log(result[i].url) console.log(result[i].type) } }, error: function(error) { } });local userName = "Nick"; local max = 10; local offset = 0; local App42CallBack = {} App42API:initialize("API_KEY", "SECRET_KEY") local uploadService = App42API:buildUploadService() uploadService:getAllFilesByUserByPaging(userName,max, offset,App42CallBack) function App42CallBack:onSuccess(object) if table.getn(object:getFileList()) >1 then for m=1,table.getn(object:getFileList()) do print("fileName is :".. object:getFileList()[m]:getName()); print("Username is :".. object:getFileList()[m]:getUserName()); print("Type is :".. object:getFileList()[m]:getType()); print("Url is :".. object:getFileList()[m]:getUrl()); print("Description is: ".. object:getFileList()[m]:getDescription()); end else print("fileName is :".. object:getFileList():getName()); print("Username is :".. object:getFileList():getUserName()); print("Type is :".. object:getFileList():getType()); print("Url is :".. object:getFileList():getUrl()); print("fileDescription is: ".. object:getFileList():getDescription()); 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()) endconst char* userName = "Nick"; int max = 2; int offset = 0; App42API::Initialize("API_KEY", "SECRET_KEY"); UploadService *uploadService = App42API::BuildUploadService(); uploadService->GetAllFilesByUser(userName, max,offset, app42callback(Sample_Class::onUploadRequestCompleted, this)); void Sample_Class::onUploadRequestCompleted(void *response) { App42UploadResponse *uploadResponse = (App42UploadResponse*)response; printf("\ncode=%d",uploadResponse->getCode()); printf("\nResponse Body=%s",uploadResponse->getBody().c_str()); if(uploadResponse->isSuccess) { for(std::vector<App42Upload>::iterator it = uploadResponse->uploadArray.begin(); it != uploadResponse->uploadArray.end(); ++it) { printf("\n Name=%s",it->name.c_str()); printf("\n UserName=%s",it->userName.c_str()); printf("\n Type=%s",it->type.c_str()); printf("\n Description=%s",it->description.c_str()); printf("\n Url=%s",it->url.c_str()); } } else { printf("\nerrordetails :%s",uploadResponse->errorDetails.c_str()); printf("\nerrorMessage :%s",uploadResponse->errorMessage.c_str()); printf("\nappErrorCode :%d",uploadResponse->appErrorCode); printf("\nhttpErrorCode:%d",uploadResponse->httpErrorCode); } }String userName = "Nick"; int max = 10; int offset = 0; App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); Upload upload = uploadService.GetAllFilesByUser(userName,max,offset); IList<Upload.File> fileList = upload.GetFileList(); for(int i = 0; i < fileList.Count();i++ ) { Console.WriteLine("fileName is " + fileList[i].GetName()); Console.WriteLine("fileType is " + fileList[i].GetType()); Console.WriteLine("fileUrl is " + fileList[i].GetUrl()); Console.WriteLine("fileDescription is " + fileList[i].GetDescription()); }$userName = "Nick"; $max = 10; $offset = 0; App42API::initialize("API_KEY","SECRET_KEY"); $uploadService = App42API::buildUploadService(); $upload = $uploadService->getAllFilesByUser($userName,$max,$offset); $fileList = $upload->getFileList(); foreach ($fileList as $files) { print_r("FileName is : " . $files->getName()); print_r("UserName is : " . $files->getUserName()); print_r("Type is : " . $files->getType()); print_r("Url is : " . $files->getUrl()); print_r("TinyUrl is: " . $files->getTinyUrl()); print_r("Description is: " . $files->getDescription()); } $jsonResponse = $upload->toString();Coming Soonuser_name = "Nick"; max = 10; offset = 0; api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY") upload_service = api.build_upload_service upload = upload_service.get_all_files_by_user_by_paging(user_name, max, offset); file_list = Array.new(); for file in file_list do puts "fileName is #{file.name}"; puts "fileType is #{file.type}"; puts "url is #{file.url}"; puts "description is #{file.description}"; end jsonResponse = upload.to_s();var userName:String = "Nick"; var max:int = 10; var offset:int = 0; App42API.initialize("API_KEY","SECRET_KEY"); var uploadService:UploadService = App42API.buildUploadService(); uploadService.getAllFilesByUserByPaging(userName,max,offset,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var upload:Upload = Upload(response); if(upload.getFileList()!= null) { var fileList:Array = upload.getFileList(); for(var k:int=0;k<fileList.length;k++) { var file:File=File(fileList[k]); trace("File Name:"+file.getName()); trace("File Type:"+file.getType()); trace("fileList url:"+file.getUrl()) trace(" tiny Url:"+file.getTinyUrl()) trace(" Description:"+file.getDescription()) } } } }Coming SoonString userName = "Nick"; Integer max = new Integer(1); Integer offset = new Integer(0); App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); Upload upload = uploadService.getAllFilesByUser(userName,max,offset); Vector fileList = upload.getFileList(); for(int i=0;i < fileList.size();i++) { Upload.File file = (Upload.File)fileList.elementAt(i); System.out.println("fileName is " + file.getName()); System.out.println("fileType is " + file.getType()); System.out.println("fileUrl is " + file.getUrl()); System.out.println("fileDescription is " + file.getDescription()); }
Remove the file based on file name and user name.
Required Parameters
fileName - The name of the file which has to be removed.
userName - The name of the user for which file has to be removed.
String userName = "Nick"; String fileName = "<Your_file_name>"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); uploadService.removeFileByUser(fileName, userName, new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("Response is : " + app42response) ; } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String fileName = "<Your_file_name>"; App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.RemoveFileByUser(fileName,userName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { App42Response upload = (App42Response) response; String jsonResponse = upload.ToString(); } }NSString *userName = @"Nick"; NSString *fileName = @"<Your_file_name>"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; UploadService *uploadService = [App42API buildUploadService]; [uploadService removeFileByUser:fileName userName:userName 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]); } }];var userName = "Nick" var fileName = "FileName.ext" App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") var userService:UserService? = App42API.buildUploadService uploadService?.removeFileByUser(fileName, userName:userName, completionBlock:{ (success, response, exception) -> Void in if (success) { var response = response as! App42Response NSLog("%@", response.strResponse) NSLog("%@", response.isResponseSuccess) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String fileName = "<Your_file_name>"; App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); App42Response app42response = uploadService.removeFileByUser(fileName,userName); System.out.println("Response is : " + app42response) ; boolean success = app42response.isResponseSuccess(); String jsonResponse = app42response.toString();String fileName = "<Your_file_name>"; String userName = "Nick"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.RemoveFileByUser(fileName, userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response app42Response = (App42Response) response; App42Log.Console("app42Response is : " + app42Response.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", fileName = "<Your_file_name>", result ; App42.initialize("API_KEY","SECRET_KEY"); var uploadService = new App42Upload(); uploadService.removeFileByUser(fileName,userName, { success: function(object) { var uploadObj = JSON.parse(object); result = uploadObj.app42.response; console.log("success is : " + result.success) }, error: function(error) { } });local fileName = "<Your_file_name>"; local userName = "Nick"; local App42CallBack = {} App42API:initialize("API_KEY", "SECRET_KEY") local uploadService = App42API:buildUploadService() uploadService:removeFileByUser( fileName, userName,App42CallBack) function App42CallBack:onSuccess(object) print("Response is :"..object:getStrResponse()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* fileName = "<Your_file_name>"; const char* userName = "Nick"; App42API::Initialize("API_KEY", "SECRET_KEY"); UploadService *uploadService = App42API::BuildUploadService(); uploadService->RemoveFileByUser(fileName,userName,app42callback(Sample_Class::onUploadRequestCompleted, this)); void Sample_Class::onUploadRequestCompleted(void *response) { App42UploadResponse *uploadResponse = (App42UploadResponse*)response; printf("\ncode=%d",uploadResponse->getCode()); printf("\nResponse Body=%s",uploadResponse->getBody().c_str()); if(uploadResponse->isSuccess) { for(std::vector<App42Upload>::iterator it = uploadResponse->uploadArray.begin(); it != uploadResponse->uploadArray.end(); ++it) { printf("\n Name=%s",it->name.c_str()); printf("\n UserName=%s",it->userName.c_str()); printf("\n Type=%s",it->type.c_str()); printf("\n Description=%s",it->description.c_str()); printf("\n Url=%s",it->url.c_str()); } } else { printf("\nerrordetails :%s",uploadResponse->errorDetails.c_str()); printf("\nerrorMessage :%s",uploadResponse->errorMessage.c_str()); printf("\nappErrorCode :%d",uploadResponse->appErrorCode); printf("\nhttpErrorCode:%d",uploadResponse->httpErrorCode); } }String userName = "Nick"; String fileName = "<Your_file_name>"; App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); App42Response response = uploadService.RemoveFileByUser(fileName,userName); Boolean success = response.IsResponseSuccess(); String jsonResponse = response.ToString();$userName = "Nick"; $fileName = "<Your_file_name>"; App42API::initialize("API_KEY","SECRET_KEY"); $uploadService = App42API::buildUploadService(); $response = $uploadService->removeFileByUser($fileName,userName); print_r("Response is : ".$response->toString()); $success = $response->isResponseSuccess(); $jsonResponse = $response->toString();Coming SoonfileName = "File03"; userName = "Nick"; api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY") upload_service = api.build_upload_service response = upload_service.remove_file_by_user(fileName, userName); success = response.isResponseSuccess(); jsonResponse = response.to_s();var userName:String = "Nick"; var fileName:String = "<Your_file_name>"; App42API.initialize("API_KEY","SECRET_KEY"); var uploadService:UploadService = App42API.buildUploadService(); uploadService.removeFileByUser(fileName,userName,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var app42response :App42Response= App42Response(response); trace("response is " + app42response) } }Coming SoonString userName = "Nick"; String fileName = "<Your_file_name>"; App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); App42Response response = uploadService.removeFileByUser(fileName,userName); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();
Removes all files based on user name.
Required Parameters
userName - The name of the user for which files have to be removed.
String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); uploadService.removeAllFilesByUser(userName,new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("Response is : " + app42response) ; } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.RemoveAllFilesByUser(userName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { App42Response upload = (App42Response) response; String jsonResponse = upload.ToString(); } }NSString *userName = @"Nick"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; UploadService *uploadService = [App42API buildUploadService]; [uploadService removeAllFilesByUser:userName 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]); } }];var userName = "Nick" App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") var userService:UserService? = App42API.buildUploadService uploadService?.removeAllFilesByUser(userName, completionBlock:{ (success, response, exception) -> Void in if (success) { var response = response as! App42Response NSLog("%@", response.strResponse) NSLog("%@", response.isResponseSuccess) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); App42Response app42response = uploadService.removeAllFilesByUser(userName); System.out.println("Response is : " + app42response) ; boolean success = app42response.isResponseSuccess(); String jsonResponse = app42response.toString();String userName = "Nick"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.RemoveAllFilesByUser(userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response app42Response = (App42Response) response; App42Log.Console("app42Response is : " + app42Response.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick", result ; App42.initialize("API_KEY","SECRET_KEY"); var uploadService = new App42Upload(); uploadService.removeAllFilesByUser(userName, { success: function(object) { var uploadObj = JSON.parse(object); result = uploadObj.app42.response; console.log("success is : " + result.success) }, error: function(error) { } });local userName = "Nick"; local App42CallBack = {} App42API:initialize("API_KEY", "SECRET_KEY") local uploadService = App42API:buildUploadService() uploadService:removeAllFilesByUser(userName,App42CallBack) function App42CallBack:onSuccess(object) print("Response is :"..object:getStrResponse()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endconst char* userName = "Nick"; App42API::Initialize("API_KEY", "SECRET_KEY"); UploadService *uploadService = App42API::BuildUploadService(); uploadService->RemoveAllFilesByUser(userName,app42callback(Sample_Class::onUploadRequestCompleted, this)); void Sample_Class::onUploadRequestCompleted(void *response) { App42UploadResponse *uploadResponse = (App42UploadResponse*)response; printf("\ncode=%d",uploadResponse->getCode()); printf("\nResponse Body=%s",uploadResponse->getBody().c_str()); if(uploadResponse->isSuccess) { for(std::vector<App42Upload>::iterator it = uploadResponse->uploadArray.begin(); it != uploadResponse->uploadArray.end(); ++it) { printf("\n Name=%s",it->name.c_str()); printf("\n UserName=%s",it->userName.c_str()); printf("\n Type=%s",it->type.c_str()); printf("\n Description=%s",it->description.c_str()); printf("\n Url=%s",it->url.c_str()); } } else { printf("\nerrordetails :%s",uploadResponse->errorDetails.c_str()); printf("\nerrorMessage :%s",uploadResponse->errorMessage.c_str()); printf("\nappErrorCode :%d",uploadResponse->appErrorCode); printf("\nhttpErrorCode:%d",uploadResponse->httpErrorCode); } }String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); App42Response response = uploadService.RemoveAllFilesByUser(userName); Boolean success = response.IsResponseSuccess(); String jsonResponse = response.ToString();$userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $uploadService = App42API::buildUploadService(); $response = $uploadService->removeAllFilesByUser($userName); print_r("Response is : ".$response->toString()); $success = $response->isResponseSuccess(); $jsonResponse = $response->toString();Coming SoonuserName = "Nick"; api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY") upload_service = api.build_upload_service response = upload_service.remove_all_files_by_user(userName); success = response.isResponseSuccess(); jsonResponse = response.to_s();var userName:String = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); var uploadService:UploadService = App42API.buildUploadService(); uploadService.removeAllFilesByUser(userName,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var app42response :App42Response= App42Response(response); trace("response is " + app42response) } }Coming SoonString userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); App42Response response = uploadService.removeAllFilesByUser(userName); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();
Upload file in the cloud for a particular user via Stream.
Required Parameters
fileName - The name of the file which has to be uploaded. It is used to retrieve the file.
userName - The name of the user for which file has to be uploaded.
inputStream - InputStream of the file to be uploaded.
fileType - The type of the file. File can be either Audio, Video, Image, Binary, Txt, xml, json, csv or other Use the static constants e.g. UploadFileType.AUDIO, UploadFileType.XML etc.
description - Description of the file to be uploaded.
String fileName = "FileName.ext"; String userName = "Nick"; String description = "File Description"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); UploadFileType fileType = UploadFileType.IMAGE; InputStream inputStream = null; /* Get input stream from your source */ uploadService.uploadFileForUser(fileName, userName, inputStream, fileType, description, new App42CallBack() { public void onSuccess(Object response) { Upload upload = (Upload)response; ArrayList<Upload.File> fileList = upload.getFileList(); for(int i = 0; i < fileList.size();i++ ) { System.out.println("fileName is :" + fileList.get(i).getName()); System.out.println("fileType is :" + fileList.get(i).getType()); System.out.println("fileUrl is :" + fileList.get(i).getUrl()); System.out.println("Tiny Url is :"+fileList.get(i).getTinyUrl()); System.out.println("fileDescription is: " + fileList.get(i).getDescription()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String fileName = "FileName.ext"; String userName = "Nick"; String description = "File Description"; String fileType = "<Your_file_type>"; Stream inputStream = null; /* Get input stream from your source */ App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.UploadFileForUser(fileName,userName,inputStream, fileType,description,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Upload upload = (Upload) response; IList<Upload.File> fileList = upload.GetFileList(); for(int i = 0; i < fileList.Count();i++ ) { Console.WriteLine("fileName is " + fileList[i].GetName()); Console.WriteLine("fileType is " + fileList[i].GetType()); Console.WriteLine("fileUrl is " + fileList[i].GetUrl()); Console.WriteLine("fileDescription is " + fileList[i].GetDescription()); } } }NSString *userName = @"Nick"; NSString *fileName = @"<Enter_file_name>"; NSString *fileType = IMAGE; NSString *description = @"<Enter_file_description>"; NSData *fileData = nil; /*Get file data from your source*/ [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; UploadService *uploadService = [App42API buildUploadService]; [uploadServiceObject uploadFileForUser:fileName userName:userName fileData:fileData uploadFileType:fileType fileDescription:description completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Upload *upload = (Upload*)responseObj; NSMutableArray *fileList = upload.fileListArray; for (File *file in fileList) { NSLog(@"fileName is %@" , file.name); NSLog(@"fileType is %@" , file.type); NSLog(@"URL is %@" , file.url); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];var fileName = "FileName.ext" var userName = "Nick" var description = "File Description" VAR fileType = "<Your_file_type>" App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") var userService:UserService? = App42API.buildUploadService uploadService?.uploadFileForUser(fileName, userName:userName, fileData:fileData, uploadFileType:fileType, fileDescription:description, completionBlock:{ (success, response, exception) -> Void in if (success) { var upload = responseObj as! Upload var fileList = upload.fileListArray for file in fileList { NSLog("%@" , file.name) NSLog("%@" , file.type) NSLog("%@" , file.url) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String fileName = "FileName.ext"; String userName = "Nick"; String description = "File Description"; App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); UploadFileType fileType = UploadFileType.IMAGE; InputStream inputStream = null; /* Get input stream from your source */ Upload upload = uploadService.uploadFileForUser(fileName, userName,inputStream,fileType,description); ArrayList<Upload.File> fileList = upload.getFileList(); for(int i = 0; i < fileList.size();i++ ) { System.out.println("fileName is :" + fileList.get(i).getName()); System.out.println("fileType is :" + fileList.get(i).getType()); System.out.println("fileUrl is :" + fileList.get(i).getUrl()); System.out.println("Tiny Url is :"+fileList.get(i).getTinyUrl()); System.out.println("fileDescription is: " + fileList.get(i).getDescription()); }String fileName = "<Your_file_name>"; String userName = "Nick"; String description = "File Description"; String filePath = "Your Local File Path"; String fileType = "<Your_file_type>"; Stream stream = new FileStream(filePath, FileMode.Open); App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.UploadFileForUser(fileName, userName, stream, fileType, description, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Upload upload = (Upload) response; IList<Upload.File> fileList = upload.GetFileList(); for(int i=0; i < fileList.Count; i++) { App42Log.Console("fileName is " + fileList[i].GetName()); App42Log.Console("fileType is " + fileList[i].GetType()); App42Log.Console("fileUrl is " + fileList[i].GetUrl()); App42Log.Console("TinyUrl Is : " + fileList[i].GetTinyUrl()); App42Log.Console("fileDescription is " + fileList[i].GetDescription()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableComing Soonconst char* fileName = "FileName.ext"; const char* userName = "Nick"; FileType fileType = IMAGE; const char* description = "File Description"; unsigned char* inputStream = nullptr; /* Get input stream from your source */ int inputStreamSize = <input_stream_size>; App42API::Initialize("API_KEY", "SECRET_KEY"); UploadService *uploadService = App42API::BuildUploadService(); uploadService->UploadFileForUser(fileName,userName, inputStream,inputStreamSize, fileType, description, app42callback(Sample_Class::onUploadRequestCompleted, this)); void Sample_Class::onUploadRequestCompleted(void *response) { App42UploadResponse *uploadResponse = (App42UploadResponse*)response; printf("\ncode=%d",uploadResponse->getCode()); printf("\nResponse Body=%s",uploadResponse->getBody().c_str()); if(uploadResponse->isSuccess) { for(std::vector<App42Upload>::iterator it = uploadResponse->uploadArray.begin(); it != uploadResponse->uploadArray.end(); ++it) { printf("\n Name=%s",it->name.c_str()); printf("\n UserName=%s",it->userName.c_str()); printf("\n Type=%s",it->type.c_str()); printf("\n Description=%s",it->description.c_str()); printf("\n Url=%s",it->url.c_str()); printf("\n CreatedOn=%s",it->createdOn.c_str()); } } else { printf("\nerrordetails :%s",uploadResponse->errorDetails.c_str()); printf("\nerrorMessage :%s",uploadResponse->errorMessage.c_str()); printf("\nappErrorCode :%d",uploadResponse->appErrorCode); printf("\nhttpErrorCode:%d",uploadResponse->httpErrorCode); } }String fileName = "FileName.ext"; String userName = "Nick"; String description = "File Description"; String fileType = "<Your_file_type>"; Stream inputStream = null; /* Get input stream from your source */ App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); Upload upload = uploadService.UploadFileForUser(fileName, userName,inputStream,fileType,description); IList<Upload.File> fileList = upload.GetFileList(); for(int i = 0; i < fileList.Count();i++ ) { Console.WriteLine("fileName is " + fileList[i].GetName()); Console.WriteLine("fileType is " + fileList[i].GetType()); Console.WriteLine("fileUrl is " + fileList[i].GetUrl()); Console.WriteLine("fileDescription is " + fileList[i].GetDescription()); }Not AvailableComing SoonfileName = "FileName.ext"; userName = "Nick"; inputStream = File.open('localPath', 'r'); fileType = App42::Upload::UploadFileType.new(); upload_file_type = fileType.enum("IMAGE"); description = "File Description"; api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY") upload_service = api.build_upload_service upload = upload_service.upload_file_for_user_by_stream(fileName, userName, inputStream, upload_file_type, description); file_list = Array.new(); for file in file_list do puts "fileName is #{file.name}"; puts "fileType is #{file.type}"; puts "url is #{file.url}"; puts "description is #{file.description}"; end jsonResponse = upload.to_s();Coming SoonComing SoonString fileName = "FileName.ext"; String userName = "Nick"; String description = "File Description"; UploadFileType fileType = UploadFileType.IMAGE; InputStream inputStream = null ; /* Get inputStream from your source. */ App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); Upload upload = uploadService.uploadFileForUser(fileName, userName,inputStream, fileType, description); Vector fileList = upload.getFileList(); for(int i=0;i < fileList.size();i++) { Upload.File file = (Upload.File)fileList.elementAt(i); System.out.println("fileName is " + file.getName()); System.out.println("fileType is " + file.getType()); System.out.println("fileUrl is " + file.getUrl()); System.out.println("fileDescription is " + file.getDescription()); }
Uploads file on the cloud via Stream.
Required Parameters
name - The name of the file which has to be saved. It is used to retrieve the file.
inputStream - InputStream of the file to be uploaded.
fileType - The type of the file. File can be either Audio, Video, Image, Binary, Txt, xml, json, csv or other Use the static constants e.g. UploadFileType.AUDIO, UploadFileType.XML etc.
description - Description of the file to be uploaded.
String fileName = "FileName.ext"; String description = "File Description"; UploadFileType fileType = UploadFileType.IMAGE; InputStream inputStream = null; /* Get input stream from your source */ App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); uploadService.uploadFile(fileName,inputStream, fileType , description, new App42CallBack() { public void onSuccess(Object response) { Upload upload = (Upload)response; ArrayList<Upload.File> fileList = upload.getFileList(); for(int i = 0; i < fileList.size();i++ ) { System.out.println("fileName is :" + fileList.get(i).getName()); System.out.println("fileType is :" + fileList.get(i).getType()); System.out.println("fileUrl is :" + fileList.get(i).getUrl()); System.out.println("Tiny Url is :"+fileList.get(i).getTinyUrl()); System.out.println("fileDescription is: " + fileList.get(i).getDescription()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String fileName = "FileName.ext"; String description = "File Description"; String fileType = "<Your_file_type>"; Stream inputStream = null; /* Get input stream from your source */ App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.UploadFile(fileName,userName,inputStream,fileType,description,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Upload upload = (Upload) response; IList<Upload.File> fileList = upload.GetFileList(); for(int i = 0; i < fileList.Count();i++ ) { Console.WriteLine("fileName is " + fileList[i].GetName()); Console.WriteLine("fileType is " + fileList[i].GetType()); Console.WriteLine("fileUrl is " + fileList[i].GetUrl()); Console.WriteLine("fileDescription is " + fileList[i].GetDescription()); } } }NSString *fileName = @"<Enter_file_name>"; NSString *description = @"<Enter_file_description>"; NSString *fileType = IMAGE; NSData *fileData = nil; /*Get file data from your source*/ [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; UploadService *uploadService = [App42API buildUploadService]; [uploadServiceObject uploadFile:fileName fileData:fileData uploadFileType:fileType fileDescription:description completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Upload *upload = (Upload*)responseObj; NSMutableArray *fileList = upload.fileListArray; for (File *file in fileList) { NSLog(@"fileName is %@" , file.name); NSLog(@"fileType is %@" , file.type); NSLog(@"URL is %@" , file.url); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];var fileData = nil /*Get file data from your source*/ var fileName = "<Enter_file_name>" var description = "File Description" VAR fileType = "<Your_file_type>" App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") var userService:UserService? = App42API.buildUploadService uploadService?.uploadFile(fileName, fileData:fileData, uploadFileType:fileType, fileDescription:description, completionBlock: (success, responseObj, exception) { if (success) { var upload = responseObj as! Upload var fileList = upload.fileListArray for file in fileList { NSLog("%@" , file.name) NSLog("%@" , file.type) NSLog("%@" , file.url) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } )}String fileName = "FileName.ext"; String description = "File Description"; App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); UploadFileType fileType = UploadFileType.IMAGE; InputStream inputStream = null; /* Get input stream from your source */ Upload upload = uploadService.uploadFile(fileName,inputStream,fileType,description); ArrayList<Upload.File> fileList = upload.getFileList(); for(int i = 0; i < fileList.size();i++ ) { System.out.println("fileName is :" + fileList.get(i).getName()); System.out.println("fileType is :" + fileList.get(i).getType()); System.out.println("fileUrl is :" + fileList.get(i).getUrl()); System.out.println("Tiny Url is :"+fileList.get(i).getTinyUrl()); System.out.println("fileDescription is: " + fileList.get(i).getDescription()); }String fileName = "<Your_file_name>"; String description = "File Description"; String filePath = "Your Local File Path"; String fileType = "<Your_file_type>"; Stream stream = new FileStream(filePath, FileMode.Open); App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.UploadFile(fileName, stream, fileType, description, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Upload upload = (Upload) response; IList<Upload.File> fileList = upload.GetFileList(); for(int i=0; i < fileList.Count; i++) { App42Log.Console("fileName is " + fileList[i].GetName()); App42Log.Console("fileType is " + fileList[i].GetType()); App42Log.Console("fileUrl is " + fileList[i].GetUrl()); App42Log.Console("TinyUrl Is : " + fileList[i].GetTinyUrl()); App42Log.Console("fileDescription is " + fileList[i].GetDescription()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableComing Soonconst char* fileName = "FileName.ext"; FileType fileType = IMAGE; const char* description = "File Description"; unsigned char* inputStream = nullptr; /* Get input stream from your source */ int inputStreamSize = <input_stream_size>; App42API::Initialize("API_KEY", "SECRET_KEY"); UploadService *uploadService = App42API::BuildUploadService(); uploadService->UploadFile(fileName, inputStream,inputStreamSize, fileType, description, app42callback(Sample_Class::onUploadRequestCompleted, this)); void Sample_Class::onUploadRequestCompleted(void *response) { App42UploadResponse *uploadResponse = (App42UploadResponse*)response; printf("\ncode=%d",uploadResponse->getCode()); printf("\nResponse Body=%s",uploadResponse->getBody().c_str()); if(uploadResponse->isSuccess) { for(std::vector<App42Upload>::iterator it = uploadResponse->uploadArray.begin(); it != uploadResponse->uploadArray.end(); ++it) { printf("\n Name=%s",it->name.c_str()); printf("\n UserName=%s",it->userName.c_str()); printf("\n Type=%s",it->type.c_str()); printf("\n Description=%s",it->description.c_str()); printf("\n Url=%s",it->url.c_str()); printf("\n CreatedOn=%s",it->createdOn.c_str()); } } else { printf("\nerrordetails :%s",uploadResponse->errorDetails.c_str()); printf("\nerrorMessage :%s",uploadResponse->errorMessage.c_str()); printf("\nappErrorCode :%d",uploadResponse->appErrorCode); printf("\nhttpErrorCode:%d",uploadResponse->httpErrorCode); } }String fileName = "<Your_file_name>"; String description = "File Description"; String fileType = "<Your_file_type>"; Stream inputStream = null; /* Get input stream from your source */ App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); Upload upload = uploadService.UploadFile(fileName,inputStream,fileType,description); IList<Upload.File> fileList = upload.GetFileList(); for(int i = 0; i < fileList.Count();i++ ) { Console.WriteLine("fileName is " + fileList[i].GetName()); Console.WriteLine("fileType is " + fileList[i].GetType()); Console.WriteLine("fileUrl is " + fileList[i].GetUrl()); Console.WriteLine("fileDescription is " + fileList[i].GetDescription()); }Not AvailableComing SoonfileName = "FileName.ext"; inputStream = File.open('localPath', 'r'); fileType = App42::Upload::UploadFileType.new(); upload_file_type = fileType.enum("IMAGE"); description = "File Description"; api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY") upload_service = api.build_upload_service upload = uploadService.upload_file_by_stream(fileName, inputStream, upload_file_type, description); file_list = Array.new(); for file in file_list do puts "fileName is #{file.name}"; puts "fileType is #{file.type}"; puts "url is #{file.url}"; puts "description is #{file.description}"; end jsonResponse = upload.to_s();Coming SoonComing SoonString name = "<Your_file_name>"; String description = "File Description"; UploadFileType fileType = UploadFileType.IMAGE; InputStream inputStream = null ; /* Get inputStream from your source. */ App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); Upload upload = uploadService.uploadFile(name,inputStream,fileType,description); Vector fileList = upload.getFileList(); for(int i=0;i < fileList.size();i++) { Upload.File file = (Upload.File)fileList.elementAt(i); System.out.println("fileName is " + file.getName()); System.out.println("fileType is " + file.getType()); System.out.println("fileUrl is " + file.getUrl()); System.out.println("fileDescription is " + file.getDescription()); }
This function allows you to revoke permission specified in the ACL list for a user on a given file by the mentioned user. The permission can only be revoked by the userName who owns the file.
Required Parameters
fileName - Name of the file from which access has to be revoked.
userName - Name of the user who wants to revoke the access.
aclList - The 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.
String userName = "Nick"; String fileName = "<Your_file_name>"; HashSet<ACL> aclList = new HashSet<ACL>(); aclList.add(new ACL("PUBLIC", Permission.READ)); App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); uploadService.revokeAccess(fileName, userName, aclList,new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("Response is : " + app42response) ; } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String fileName = "<Your_file_name>"; IList<ACL> aclList = new List<ACL>(); aclList.Add(new ACL("PUBLIC", Permission.READ)); App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.RevokeAccess(fileName, userName, aclList,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 *userName = @"Nick"; NSString *fileName = @"<Your_file_name>"; ACL *acl = [[ACL alloc] initWithUserName:@"PUBLIC" andPermission:APP42_READ]; NSArray *aclList = [NSArray arrayWithObject:acl]; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; UploadService *uploadService = [App42API buildUploadService]; [uploadService revokeAccessOnFile:fileName ofUser:userName withAclList:aclList 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]); } }];var userName = "Nick" var fileName = "<Your_file_name>" var acl:ACL = (initWithUserName:"PUBLIC", andPermission:APP42_READ) as! ACL alloc var aclList = arrayWithObject:acl as! NSArray App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") var userService:UserService? = App42API.buildUploadService uploadService?.revokeAccessOnFile(fileName, ofUser:userName, withAclList:aclList, completionBlock:{ (success, response, exception) -> Void in if (success) { var response = response as! App42Response NSLog("%@", response.strResponse) NSLog("%@", response.isResponseSuccess) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String fileName = "<Your_file_name>"; HashSet<ACL> aclList = new HashSet<ACL>(); aclList.add(new ACL("PUBLIC", Permission.READ)); App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); App42Response app42response = uploadService.revokeAccess(fileName, userName, aclList); System.out.println("Response is : " + app42response) ; String jsonResponse = app42response.toString();String userName = "Nick"; String fileName = "<Your_file_name>"; HashSet<ACL> aclList = new HashSet<ACL>(); aclList.Add(new ACL("PUBLIC", Permission.READ)); App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.RevokeAccess(fileName, userName, aclList, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response app42Response = (App42Response) response; App42Log.Console("app42Response is : " + app42Response.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick"; var fileName = "<Your_file_name>"; var aclList = new Array(); var result; var ACL = { user: "PUBLIC", permission: Permission.READ }; aclList.push(ACL); App42.initialize("API_KEY", "SECRET_KEY"); var uploadService = new App42Upload(); uploadService.revokeAccess(fileName, userName, aclList, { success: function (object) { var uploadObj = JSON.parse(object); result = uploadObj.app42.response.success; console.log("App42Response Success : " + result) }, error: function(error) { } });String userName = "Nick"; String fileName = "<Your_file_name>"; local aclList = {} local acl = ACL:new() acl:setUser("PUBLIC") acl:setPermission(Permission.READ) aclList[1] = acl App42.initialize("API_KEY","SECRET_KEY"); var uploadService = new App42Upload(); App42API:initialize("API_KEY", "SECRET_KEY") local uploadService = App42API:buildUploadService() uploadService:revokeAccess(fileName, userName,aclList,App42CallBack) function App42CallBack:onSuccess(object) print("Response is :"..object:getStrResponse()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endComing SoonString userName = "Nick"; String fileName = "<Your_file_name>"; HashSet<ACL> aclList = new HashSet<ACL>(); aclList.Add(new ACL("PUBLIC", Permission.READ)); App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); App42Response success = uploadService.RevokeAccess(fileName, userName, aclList); String jsonResponse = success.ToString();Coming SoonComing SoonComing SoonComing SoonComing SoonString userName = "Nick"; String fileName = "<Your_file_name>"; Hashtable aclList = new Hashtable(); aclList.put(new ACL("PUBLIC", ACL.PERMISSION_READ)); App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); App42Response success = uploadService.revokeAccess(fileName, userName, aclList); String jsonResponse = success.toString();
This function allows you to grant permission specified in the ACL list to a user on a given file by the mentioned user. The permission can only be granted to the userName who owns the file.
Required Parameters
fileName - Name of the file for which access has to be granted.
userName - Name of the user who wants to grant the access.
aclList - The 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.
String userName = "Nick"; String fileName = "<Your_file_name>"; HashSet<ACL> aclList = new HashSet<ACL>(); aclList.add(new ACL("PUBLIC", Permission.READ)); App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); uploadService.grantAccess(fileName, userName, aclList, new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("Response is : " + app42response) ; } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; String fileName = "<Your_file_name>"; IList<ACL> aclList = new List<ACL>(); aclList.Add(new ACL("PUBLIC", Permission.READ)); App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.GrantAccess(fileName, userName, aclList,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 *userName = @"Nick"; NSString *fileName = @"<Your_file_name>"; ACL *acl = [[ACL alloc] initWithUserName:@"PUBLIC" andPermission:APP42_READ]; NSArray *aclList = [NSArray arrayWithObject:acl]; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; UploadService *uploadService = [App42API buildUploadService]; [uploadService grantAccessOnFile:fileName ofUser:userName withAclList:aclList 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]); } }];var userName = "Nick" var fileName = "<Your_file_name>" var acl:ACL = (initWithUserName:"PUBLIC", andPermission:APP42_READ) as! ACL alloc var aclList = arrayWithObject:acl as! NSArray App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") var userService:UserService? = App42API.buildUploadService uploadService?.grantAccessOnFile(fileName, ofUser:userName, withAclList:aclList, completionBlock:{ (success, response, exception) -> Void in if (success) { var response = response as! App42Response NSLog("%@", response.strResponse) NSLog("%@", response.isResponseSuccess) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; String fileName = "<Your_file_name>"; HashSet<ACL> aclList = new HashSet<ACL>(); aclList.add(new ACL("PUBLIC", Permission.READ)); App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); App42Response app42response = uploadService.grantAccess(fileName, userName, aclList); System.out.println("Response is : " + app42response) ; String jsonResponse = app42response.toString();String userName = "Nick"; String fileName = "<Your_file_name>"; HashSet<ACL> aclList = new HashSet<ACL>(); aclList.Add(new ACL("PUBLIC", Permission.READ)); App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.GrantAccess(fileName, userName, aclList, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response app42Response = (App42Response) response; App42Log.Console("app42Response is : " + app42Response.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }var userName = "Nick"; var fileName = "<Your_file_name>"; var aclList = new Array(); var result; var ACL = { user: "PUBLIC", permission: Permission.READ }; aclList.push(ACL); App42.initialize("API_KEY", "SECRET_KEY"); var uploadService = new App42Upload(); uploadService.grantAccess(fileName, userName, aclList, { success: function (object) { var uploadObj = JSON.parse(object); result = uploadObj.app42.response.success; console.log("App42Response Success : " + result) }, error: function(error) { } });String userName = "Nick"; String fileName = "<Your_file_name>"; local aclList = {} local acl = ACL:new() acl:setUser("PUBLIC") acl:setPermission(Permission.READ) aclList[1] = acl App42API:initialize("API_KEY", "SECRET_KEY") local uploadService = App42API:buildUploadService() uploadService:grantAccess(fileName, userName,aclList,App42CallBack) function App42CallBack:onSuccess(object) print("Response is :"..object:getStrResponse()); end function App42CallBack:onException(exception) print("Message is : "..exception:getMessage()) print("App Error code is : "..exception:getAppErrorCode()) print("Http Error code is "..exception:getHttpErrorCode()) print("Detail is : "..exception:getDetails()) endComing SoonString userName = "Nick"; String fileName = "<Your_file_name>"; HashSet<ACL> aclList = new HashSet<ACL>(); aclList.Add(new ACL("PUBLIC", Permission.READ)); App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); App42Response success = uploadService.GrantAccess(fileName, userName, aclList); String jsonResponse = success.ToString();Coming SoonComing SoonComing SoonComing SoonComing SoonString userName = "Nick"; String fileName = "<Your_file_name>"; Hashtable aclList = new Hashtable(); aclList.put(new ACL("PUBLIC", ACL.PERMISSION_READ)); App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); App42Response success = uploadService.grantAccess(fileName, userName, aclList); String jsonResponse = success.toString();
The functions available under File Upload API can throw some exceptions in abnormal conditions. For example, if a developer is requesting for the files by type which is not in a database, the function will throw the App42Exception (as shown below) with the message as “Not Found” and the appErrorCode as “2102” and the details as “Files for the user ‘Nick’ do not exist”.
String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); uploadService.getAllFilesByUser(userName, new App42CallBack() { public void onSuccess(Object response) { Upload upload = (Upload)response; ArrayList<Upload.File> fileList = upload.getFileList(); for(int i = 0; i < fileList.size();i++ ) { System.out.println("fileName is :" + fileList.get(i).getName()); System.out.println("fileType is :" + fileList.get(i).getType()); System.out.println("fileUrl is :" + fileList.get(i).getUrl()); System.out.println("Tiny Url is :"+fileList.get(i).getTinyUrl()); System.out.println("fileDescription is: " + fileList.get(i).getDescription()); } } public void onException(Exception ex) { App42Exception exception = (App42Exception)ex; int appErrorCode = exception.getAppErrorCode(); int httpErrorCode = exception.getHttpErrorCode(); if(appErrorCode == 2102) { // Handle here for Not found (Files for the User 'Nick' does not Exist ) } else if(appErrorCode == 1401){ // handle here for Client is not authorized } else if(appErrorCode == 1500){ // handle here for Internal Server Error } String jsonText = ex.getMessage(); } });String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.GetAllFilesByUser(userName, 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 == 2102) { // Handle here for Not found (Files for the User 'Nick' does not Exist ) } 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) { Upload upload = (Upload) response; String jsonResponse = upload.ToString(); } }NSString *userName = @"Nick"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; UploadService *uploadService = [App42API buildUploadService]; [uploadService getAllFilesByUser:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Upload *upload = (Upload*)responseObj; NSMutableArray *fileList = upload.fileListArray; for (File *file in fileList) { NSLog(@"fileName is %@" , file.name); NSLog(@"fileType is %@" , file.type); NSLog(@"URL is %@" , file.url); } } else { int appErrorCode = exception.appErrorCode; int httpErrorCode = exception.httpErrorCode; if(appErrorCode == 2102) { // Handle here for Not found (Files for the User 'Nick' does not Exist ) } 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; } }];var userName = "Nick" App42API.initializeWithAPIKey("APP_KEY", andSecretKey:"SECRET_KEY") uploadService:UploadService? = App42API.buildUploadService uploadService getAllFilesByUser(userName, completionBlock:{ (success, response, exception) -> Void in if (success) { var upload = responseObj as! Upload var fileList = upload.fileListArray for file in fileList { NSLog("%@" , file.name) NSLog("%@" , file.type) NSLog("%@" , file.url) } } else { var appErrorCode = exception.appErrorCode var httpErrorCode = exception.httpErrorCode if(appErrorCode == 2102) { // Handle here for Not found (Files for the User 'Nick' does not Exist ) } else if(appErrorCode == 1401){ // handle here for Client is not authorized } else if(appErrorCode == 1500){ // handle here for Internal Server Error } var jsonText = exception.reason } })String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); try { Upload upload = uploadService.getAllFilesByUser(userName); } catch(App42Exception ex) { int appErrorCode = ex.getAppErrorCode(); int httpErrorCode = ex.getHttpErrorCode(); if(appErrorCode == 2102) { // Handle here for Not found (Files for the User 'Nick' does not Exist ) } else if(appErrorCode == 1401){ // handle here for Client is not authorized } else if(appErrorCode == 1500){ // handle here for Internal Server Error } String jsonText = ex.getMessage(); }String userName = "Nick"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); uploadService.GetAllFilesByUser(userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnException(Exception e) { App42Exception ex = (App42Exception)e; int appErrorCode = ex.GetAppErrorCode(); int httpErrorCode = ex.GetHttpErrorCode(); if(appErrorCode == 2102) { // Handle here for Not found (Files for the User 'Nick' does not Exist ) } 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 userName = "Nick", appErrorCode ; App42.initialize("API_KEY","SECRET_KEY"); var uploadService = new App42Upload(); uploadService.getAllFilesByUser(userName,{ success: function(object){ }, error: function(error) { var uploadObj = JSON.parse(error); appErrorCode = uploadObj.app42Fault.appErrorCode; if(appErrorCode == 2102) { // Handle here for Not found (Files for the User 'Nick' does not Exist ) } else if(appErrorCode == 1401){ // handle here for Client is not authorized } else if(appErrorCode == 1500){ // handle here for Internal Server Error } } });String userName = "Nick"; local App42CallBack = {} App42API:initialize("API_KEY", "SECRET_KEY") local uploadService = App42API:buildUploadService() uploadService:getAllFilesByUser(userName,App42CallBack) function App42CallBack:onSuccess(object) print("Response Success is "..object:getResponseSuccess()) end function App42CallBack:onException(exception) local appErrorCode = exception:getAppErrorCode() if appErrorCode == 2102 then -- Handle here for Not found (Files for the User 'Nick' does not Exist ) elseif appErrorCode == 1401 then -- handle here for Client is not authorized elseif appErrorCode == 1500 then -- handle here for Internal Server Error end endconst char* userName = "Nick"; App42API::Initialize("API_KEY", "SECRET_KEY"); UploadService *uploadService = App42API::BuildUploadService(); uploadService->GetAllFilesByUser(userName, app42callback(Sample_Class::onUploadRequestCompleted, this)); void Sample_Class::onUploadRequestCompleted(void *response) { App42UploadResponse *uploadResponse = (App42UploadResponse*)response; printf("\ncode=%d",uploadResponse->getCode()); printf("\nResponse Body=%s",uploadResponse->getBody().c_str()); if(uploadResponse->isSuccess) { // Handle Success Response here } else { printf("\nerrordetails :%s",uploadResponse->errorDetails.c_str()); printf("\nerrorMessage :%s",uploadResponse->errorMessage.c_str()); printf("\nappErrorCode :%d",uploadResponse->appErrorCode); printf("\nhttpErrorCode:%d",uploadResponse->httpErrorCode); if(uploadResponse->appErrorCode == 2102) { // Handle here for Not found (Files for the User 'Nick' does not Exist ) } else if(uploadResponse->appErrorCode == 1401){ // handle here for Client is not authorized } else if(uploadResponse->appErrorCode == 1500){ // handle here for Internal Server Error } } }String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.BuildUploadService(); try { Upload upload = uploadService.GetAllFilesByUser(userName); } catch(App42Exception exception) { int appErrorCode = exception.GetAppErrorCode(); int httpErrorCode = exception.GetHttpErrorCode(); if(appErrorCode == 2102) { // Handle here for Not found (Files for the User 'Nick' does not Exist ) } 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(); }$userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $uploadService = App42API::buildUploadService(); try { $upload = $uploadService->getAllFilesByUser($userName); } catch(App42Exception $exception) { $appErrorCode =$exception->getAppErrorCode(); $httpErrorCode = $exception->getHttpErrorCode(); if($appErrorCode == 2102) { // Handle here for Not found (Files for the User 'Nick' does not Exist ) } else if($appErrorCode == 1401){ // handle here for Client is not authorized } else if($appErrorCode == 1500){ // handle here for Internal Server Error } $jsonText = $exception->getMessage(); }Coming SoonuserName = "Nick"; begin api = App42RubyAPI::ServiceAPI.new("API_KEY","SECRET_KEY") upload_service = api.build_upload_service upload = uploadService.get_all_files_by_user(userName); rescue App42Exception => ex appErrorCode = ex.app_error_code; httpErrorCode = ex.http_error_code; if(appErrorCode == 2102) #Handle here for Not found (Files for the user <userName> do not exist.) elsif(appErrorCode == 1401) #handle here for Client is not authorized else(appErrorCode == 1500) #handle here for Internal Server Error end jsonText = ex.getMessage(); endvar userName:String = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); var uploadService:UploadService = App42API.buildUploadService(); uploadService.getAllFilesByUser(userName,new callback()); public class callback implements App42CallBack { public function onSuccess(response:Object):void { var upload:Upload = Upload(response); trace("Response is " + upload) } public function onException(exception:App42Exception):void { var appErrorCode:int = exception.getAppErrorCode(); var httpErrorCode:int = exception.getHttpErrorCode(); if(appErrorCode == 2102) { // Handle here for Not found (Files for the User 'Nick' does not Exist ) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } } }Coming SoonString userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); UploadService uploadService = App42API.buildUploadService(); try { Upload upload = uploadService.getAllFilesByUser(userName); } catch(App42Exception ex) { int appErrorCode = ex.getAppErrorCode(); int httpErrorCode = ex.getHttpErrorCode(); if(appErrorCode == 2102) { // Handle here for Not found (Files for the User 'Nick' does not Exist ) } 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(); }
Functions in Upload 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.
2100 - BAD REQUEST - The Request parameters are invalid. File by the name '${name}' already Exists
2101 - NOT FOUND - Files do not exist.
2102 - NOT FOUND - Files for the user '@userName' do not exist.
2103 - NOT FOUND - The file with the name '@name' does not exist.
2104 - NOT FOUND - There are no files to remove.
2105 - NOT FOUND - The file with type '@type' does not exist.
2106 - NOT FOUND - The number of files are less than the specified offset : + "offset".
2107 - NOT FOUND - The number of files for the user '@userName' are less than the specified offset : + "offset".
2108 - NOT FOUND - The number of files with type '@type' are less than the specified offset : + "offset".
2110 - NOT FOUND - Group by the name '@groupName' for user '@userName' does not exist.'
2111 - NOT FOUND - Group by the name '@groupName' friends does not exist.'
2112 - NOT FOUND - User by the name '@userName' friends does not exist.'
2113 - NOT FOUND - User by the name '@userName' friends does not exist.'
2114 - NOT FOUND - User by the name '@userName' friends does not exist.'