Search Results for

    Show / Hide Table of Contents

    Getting started

    BALKAN library provides a unified programmability model that you can use to access data in your BALKAN OrgChart account. You can automate processes like creating new employee, inviting users uploading images etc. Currently is available only in .NET and you can use the REST API if your project happens to be in another framework.

    Get Access API Key

    The Access API key contains information about your app and the permissions it has for the resources. To get an Access API key, login or create new account in your BALKAN OrgChart app, open information menu and copy the Access API key.

    API Access API key

    Prerequisites

    • Visual Studio
    • Visual Studio Code
    • Visual Studio dor Mac
    • Visual Studio 2019 16.4 or later
    • .NET Core 3.1 SDK or later
    • Visual Studio Code
    • C# for Visual Studio Code (latest version)
    • .NET Core 3.1 SDK or later
    • Visual Studio for Mac version 8.4 or later
    • .NET Core 3.1 SDK or later

    Create console app

    • Visual Studio
    • Visual Studio Code
    • Visual Studio dor Mac
    1. Create a new project.
    2. Select Console App and select Next.
    3. Type BALKANConsoleApp in the Project name field. Confirm the Location entry is correct or provide a location for the project. Select Create.

    In the Integrated Terminal (View > Terminal from the toolbar), execute the following commands:

    dotnet new console
    
    1. Create a new project.
    2. Select Console App and select Next.
    3. Type BALKANConsoleApp in the Project name field. Confirm the Location entry is correct or provide a location for the project. Select Create.

    Add BALKAN library to your project

    • Visual Studio
    • Visual Studio Code
    • Visual Studio dor Mac
    1. In Solution Explorer, right-click the project and select Manage NuGet Packages.
    2. With Browse selected, type BALKAN in the search box.
    3. In the search results, select the BALKAN package and select Install.

    In the Integrated Terminal (View > Terminal from the toolbar), execute the following commands:

    dotnet add Client package BALKAN
    
    1. In the Solution sidebar, right-click the project and select Manage NuGet Packages.
    2. With Browse selected, type BALKAN in the search box.
    3. In the search results, select the check box next to the BALKAN package and select Add Package.

    Hello Org Chart

    Add the following code to Program.cs file

    using System;
    using BALKAN;
    
    namespace BALKANConsoleApp
    {
        class Program
        {
            static void Main(string[] args)
            {
    
                Configuration.ApiAccessKey = "ak_8252286e-1af0-4f6c-a9a8-c572f7afbf74";
                //REPLACE ak_06d16bd3-6ac3-4097-ae77-42395a6da98c2 with your Access API Key
    
                HelloOrgChart();
            }
    
            public static void HelloOrgChart()
            {
                var chartService = new ChartService();
                var options = new OptionsCreateNewChart
                {
                    ChartId = "HelloOrgChart",
                    TemplateName = "Sofia"
                };
    
                var result = chartService.Create(options);
    
                if (result.IsSuccess)
                {
                    Console.WriteLine("Hello OrgChart. Successfully created chart with id HelloOrgChart and template Sofia!");
                }
                else
                {
                    Console.WriteLine(result.Error);
                    Console.WriteLine("Failed! Verify ApiAccessKey!");
                }
            }
        }
    }
    

    Replace ApiAccessKey with your key

    Now you are ready to Run and test the project

    If the call is succesfull the console witll display Hello OrgChart. Successfully created chart with id "HelloOrgChart" and template Sofia!



    Visual result:

    Test

    Next: Add emploees to the chart

    In This Article
    Back to top Generated by BALKAN App