After many years, zkBox will be discontinued on June 1st, 2024.
Please make sure to retrieve your data as soon as possible.
Thank you for being part of this journey.

C# client

In this area you'll find information on how to connect to the zkBox server using the C# client.
Usually you'll want to use this library when you're developing applications that are installed on your user's workstations.
Below there are all the C# zkBox client methods listed with a short call example and with the possible return results.
The library is available in the downloads section.

Get application info

This method is returning details about the calling zkBox application.

c# call

Applications.GetApplicationInfo result = api.Applications.GetInfo();

c# return

{
error: 0,
message: "Success",
Data:
{
usersCount: "2667",
objectsCount: "58928"
}
}

or, if the application is invalid

{
error: 102,
message: "Invalid application",
Data: null
}

Check user

This method is check if an user exists into the system.

c# call

Users.CheckUser result = api.Users.Check(

"john");

c# return

{
error: 0,
message: "Success",
Data:
{
exists: "false"
}
}

Add user

This method is adding a new user into the system.

c# call

Users.AddUser result = api.Users.Add(

"john",
"SeCrEtP@ssw0rd");

c# return

{
error: 0,
message: "Success",
Data: {}
}

or, if the user already exists

{
error: 100,
message: "The user already exists",
Data: null
}

Authenticate an user

This method is authenticating an user into the system.

c# call

Users.AuthenticateUser result = api.Users.Authenticate(

"john",
"SeCrEtP@ssw0rd");

c# return

{
error: 0,
message: "Success",
Data: {}
}

or, if there is an authentication issue

{
error: 101,
message: "Invalid username or password",
Data: null
}

Logout user

This method is logging out from the system a logged in user.

c# call

Users.LogoutUser result = api.Users.Logout();

c# return

{
error: 0,
message: "Success",
Data: {}
}

or, if there is an authentication issue

{
error: 101,
message: "Invalid username or password",
Data: null
}

Delete user

This method is deleting the calling user from the system.

c# call

Users.DeleteUser result = api.Users.Delete();

c# return

{
error: 0,
message: "Success",
Data: {}
}

or, if there is an authentication issue

{
error: 101,
message: "Invalid username or password",
Data: null
}

Add object

This method is adding an object into the system.

c# call

Objects.AddObject result = api.Objects.Add(

"expense",
new Expense { Title = "pizza at Jerry's", Amount = 32.5 });

c# return

{
error: 0,
message: "Success",
Data:
{
objectId: "A6HNCRFZMDMMC4VW"
}
}

Get object

This method is retrieving an existing object.

c# call

Objects.GetObject result = api.Objects.Get(

"A6HNCRFZMDMMC4VW");

c# return

{
error: 0,
message: "Success",
Data:
{
objectId: "A6HNCRFZMDMMC4VW",
type: "expense",
data: { Title = "pizza at Jerry's", Amount = 32.5 }
}
}

or, if the object is missing

{
error: 104,
message: "The object does not exist",
Data: null
}

Update object

This method is updating an existing object into the system.

c# call

Objects.UpdateObject result = api.Objects.Update(

"A6HNCRFZMDMMC4VW",
new Expense { Title = "Pizza at Jerry's", Amount = 38.9 });

c# return

{
error: 0,
message: "Success",
Data: {}
}

or, if the object is missing

{
error: 104,
message: "The object does not exist",
Data: null
}

Delete object

This method is deleting an existing object.

c# call

Objects.DeleteObject result = api.Objects.Delete(

"A6HNCRFZMDMMC4VW");

c# return

{
error: 0,
message: "Success",
Data: {}
}

or, if the object is missing

{
error: 104,
message: "The object does not exist",
Data: null
}