Table of Contents

open bi REST client

BiExcellence.OpenBi.Api.Client is the .NET client for the REST API of open bi server. It runs on netstandard2.0 and later - Windows, Linux, macOS, mobile and Blazor WebAssembly - and is trimming and AOT compatible on .NET 8 and later.

It replaces the BiExcellence.OpenBi.Api.* packages, which talk to the legacy command API. See Migrating from the command API client.

Getting started

Add the package reference to your project:

<PackageReference Include="BiExcellence.OpenBi.Api.Client" Version="*" />

Create a client for the server's REST API base address, which is /openbi/api/ on any port of the server, and log in:

using BiExcellence.OpenBi.Api;
using BiExcellence.OpenBi.Api.Auth;
using BiExcellence.OpenBi.Api.Users;

using var client = new OpenBiApiClient(new Uri("https://myserver/openbi/api/"));

await client.LoginAsync("username", "password", cancellationToken);

var me = await client.GetCurrentUserInfoAsync(cancellationToken);

var users = await client.GetUsersAsync(
    OpenBiListRequest.Create().Filter("lastname eq 'Smith'").OrderBy("firstname").Top(50).IncludeTotalCount(),
    cancellationToken);

Console.WriteLine($"{users.Count} of {users.TotalCount} users");

The client is OpenBiApiClient. Every call is an extension method on IOpenBiApiClient, grouped by area into one namespace each - a using for the namespace is what makes its calls available:

Namespace What it covers
BiExcellence.OpenBi.Api.Auth Logging in, API keys, single sign-on, the authorization code flow, refresh tokens
BiExcellence.OpenBi.Api.Users, BiExcellence.OpenBi.Api.Usergroups, BiExcellence.OpenBi.Api.Roles, BiExcellence.OpenBi.Api.Organisations, BiExcellence.OpenBi.Api.Permissions, BiExcellence.OpenBi.Api.AuthObjects Users and what they may do
BiExcellence.OpenBi.Api.ApiKeys, BiExcellence.OpenBi.Api.OAuthApps Integration with other applications
BiExcellence.OpenBi.Api.ConnectionTemplates, BiExcellence.OpenBi.Api.DataProviders, BiExcellence.OpenBi.Api.DataProviderStore, BiExcellence.OpenBi.Api.MasterData, BiExcellence.OpenBi.Api.BaseEntities, BiExcellence.OpenBi.Api.Entities, BiExcellence.OpenBi.Api.TableAttributes, BiExcellence.OpenBi.Api.MapDimensions, BiExcellence.OpenBi.Api.EtlTasks Data and reporting
BiExcellence.OpenBi.Api.HtmlItems, BiExcellence.OpenBi.Api.HostHeaders, BiExcellence.OpenBi.Api.WebFiles, BiExcellence.OpenBi.Api.LanguageTexts, BiExcellence.OpenBi.Api.Blog, BiExcellence.OpenBi.Api.Downloads, BiExcellence.OpenBi.Api.GridStyles, BiExcellence.OpenBi.Api.Files CMS and content
BiExcellence.OpenBi.Api.BatchJobs, BiExcellence.OpenBi.Api.Transport, BiExcellence.OpenBi.Api.ObjectLocks, BiExcellence.OpenBi.Api.Inquiries, BiExcellence.OpenBi.Api.SystemInfo Operations and administration

Using an HttpClient of your own

The client can wrap an existing HttpClient, for example one from IHttpClientFactory. Its BaseAddress has to be set:

services.AddHttpClient("openbi", c => c.BaseAddress = new Uri("https://myserver/openbi/api/"));

// later
var client = new OpenBiApiClient(httpClientFactory.CreateClient("openbi"));

It does not dispose that HttpClient unless it is told to (disposeHttpClient: true).

Next steps