Image service
Warning
Before you begin set the Access API Key as described in Getting started
Here is an example how you can upload an image and set "Photo" field of the first node to point to the new uploaded image
public static void Upload()
{
Charts.CreateTestChart("ImageUploadChart");
var imageService = new ImageService();
var resultUpload = imageService.Upload(new List<string> { "alf.jpg" });
if (!resultUpload.IsSuccess)
{
Console.WriteLine(resultUpload.Error);
}
else
{
foreach (var image in resultUpload.Images)
{
Console.WriteLine(image.OriginalFileName);
Console.WriteLine(image.NewFileName);
Console.WriteLine(image.Url);
}
var imageUrl = resultUpload.Images[0].Url;
var chartService = new ChartService();
var resultUpdateNode = chartService.UpdateNode(new OptionsUpdateNode
{
ChartId = "ImageUploadChart",
Node = new Dictionary<string, string>
{
{ "id", "_sfWf" },
{ "Name", "Alexandar Smith" },
{ "Photo", imageUrl }
}
});
}
}
Visual result:
Limits:
- You can upload up to 10 images in one request
- Maximum size of an image should be less then 100 KB
If you want to delete all images call "Empty" method
Note
The demo is located at GitHub