Using App42 Push Notification – Backend as a Service
Posted on August 26, 2012 by Ajay Tiwari
namespace App42Windows { public class Callback : App42Callback { String fileName = "File Name"; Stream stream = "local file stream"; String description = "File Description"; ServiceAPI api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); UploadService uploadService = api.BuildUploadService(); uploadService.UploadFileForUser(fileName, userName, stream, "IMAGE", description, this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(object response) { Upload upload = (Upload) response; String jsonResponse = fileList.ToString(); } } }
String name = "TextFile007"; InputStream inputStream = null; /* get inputStream from your source. */ UploadFileType fileTypes = null; String description = "TextFile_123"; ServiceAPI api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); UploadService uploadService = api.buildUploadService(); Upload upload = uploadService.uploadFile(name,inputStream,fileTypes.IMAGE,description); String jsonResponse = upload.toString();
String name = "TextFile007"; String filePath = "Local file path"; UploadFileType fileTypes = null ; String description = "TextFile_123"; ServiceAPI api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); UploadService uploadService = api.buildUploadService(); Upload upload = uploadService.uploadFile(name,filePath,fileTypes.IMAGE,description); String jsonResponse = upload.toString();
NSString *name = @"TextFile007"; NSString *filePath = @"Local file path"; NSString *fileType = IMAGE; NSString *description = @"TextFile_123"; serviceAPIObj.apiKey = @"<API_KEY>"; serviceAPIObj.secretKey = @"<SECRET_KEY>"; UploadService *uploadService = [serviceAPIObj buildUploadService]; Upload *upload = [uploadService uploadFile:fileName filePath:filePath uploadFileType:fileType description:description]; NSString jsonResponse = [upload toString];
String name = "TextFile007"; String filePath = "Local file path"; String description = "TextFile_123"; ServiceAPI api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); UploadService uploadService = api.buildUploadService(); Upload upload = uploadService.uploadFile(name,filePath,UploadFileType.IMAGE,description); String jsonResponse = upload.toString();
String name = "TextFile007"; String filePath = "Local file path"; String description = "TextFile_123"; ServiceAPI api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); UploadService uploadService = api.BuildUploadService(); Upload upload = uploadService.UploadFile(name,filePath,UploadFileType.IMAGE,description); String jsonResponse = upload.ToString();
name = "TextFile007"; filePath = "Local file path"; fType = App42::Upload::UploadFileType.new(); description = "TextFile_123"; api = App42::ServiceAPI.new("<API_KEY>","<SECRET_KEY>"); uploadService = api.buildUploadService(); upload = uploadService.upload_file(fileName,filePath,fType.enum("IMAGE"),description); jsonResponse = upload.to_s();
The request format for uploadFile is URL : https://api.shephertz.com/cloud/1.0/upload Method : MULTIPART/Form-Data QueryParam : apiKey=<apiKey>&signature=<signature>&version=<version>×tamp=<UTC_FORMATED_TIME_STAMP> Accept : application/json Content-Type :image/jpeg
var upload = new App42Upload(); var name = "FileName"; var filePath = "Your file path"; var fileType = "IMAGE"; var description = "description"; var file = filePath.files[0]; // In order to use the various functions available under a particular API, a developer will have to call the // App42.initialize method by passing the apiKey and the secretKey. App42.initialize("<API_KEY>","<SECRET_KEY>"); upload.uploadFile(name, file, fileType,description, { success: function(object) { // Upload Object creation }, error: function(error) { // Upload exception handled } });
$fileName = "TextFile007"; $filePath = "Local file path"; $description = "TextFile_123"; $api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); $uploadService = $api->buildUploadService(); $upload = $uploadService->uploadFile($fileName, $filePath, $UploadFileType ::IMAGE, $description); $jsonResponse = $uploadService->toString();
String name = "TextFile"; App42Callback requestCallback = this; /* This function used the App42Callback interface */ ServiceAPI api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); UploadService uploadService = api.BuildUploadService(); uploadService.GetFileByName(name,requestCallback); OnSuccess(Object obj){ { Upload upload = (Upload) obj; String jsonResponse = upload.ToString(); } public class CallBack : App42Callback { public override void OnSuccess(Object obj) { Upload upload = (Upload) obj; //Do whatever you want with the object } public override void OnException(App42Exception e) { //Do whatever you want with the exception } }
String name = "TextFile01"; ServiceAPI api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); UploadService uploadService = api.buildUploadService(); Upload upload = uploadService.getFileByName(name); String jsonResponse = upload.toString();
String name = "TextFile01"; ServiceAPI api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); UploadService uploadService = api.buildUploadService(); Upload upload = uploadService.getFileByName(name); String jsonResponse = upload.toString();
NSString *name = @"TextFile01"; serviceAPIObj.apiKey = @"<API_KEY>"; serviceAPIObj.secretKey = @"<SECRET_KEY>"; UploadService *uploadService = [serviceAPIObj buildUploadService]; Upload *upload = [uploadService getFileByName:name]; NSString jsonResponse = [upload toString];
String name = "TextFile01"; ServiceAPI api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); UploadService uploadService = api.buildUploadService(); Upload upload = uploadService.getFileByName(name); String jsonResponse = upload.toString();
String name = "TextFile01"; ServiceAPI api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); UploadService uploadService = api.BuildUploadService(); Upload upload = uploadService.GetFileByName(name); String jsonResponse = upload.ToString();
name = "TextFile01"; api = App42::ServiceAPI.new("<API_KEY>","<SECRET_KEY>"); uploadService = api.buildUploadService(); upload = uploadService.get_file_by_name(name); jsonResponse = upload.to_s();
The request format for getFileByName is URL : https://api.shephertz.com/cloud/1.0/upload/{name} Method : GET QueryParam : apiKey=<apiKey>&signature=<signature>&version=<version>×tamp=<UTC_FORMATED_TIME_STAMP> Accept : application/json Content-Type : application/json
var upload = new App42Upload(); var name = "FileName" ; // In order to use the various functions available under a particular API, a developer will have to call the // App42.initialize method by passing the apiKey and the secretKey. App42.initialize("<API_KEY>","<SECRET_KEY>"); upload.getFileByName(name, { success: function(object) { // Upload Object creation }, error: function(error) { // Upload exception handled } });
$fileName = "TextFile01"; $api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); $uploadService = $api->buildUploadService(); $upload = $uploadService->getFileByName($fileName); $jsonResponse = $upload->toString();