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.
Prerequisites
Create console app
- Create a new project.
- Select Console App and select Next.
- 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
- In Solution Explorer, right-click the project and select Manage NuGet Packages.
- With Browse selected, type BALKAN in the search box.
- In the search results, select the BALKAN package and select Install.
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: