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();