Search Results for

    Show / Hide Table of Contents

    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:

    Test

    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

    Next: Create access

    In This Article
    Back to top Generated by BALKAN App