Becom.IBMi.SqlApiClient
0.2.6
dotnet add package Becom.IBMi.SqlApiClient --version 0.2.6
NuGet\Install-Package Becom.IBMi.SqlApiClient -Version 0.2.6
<PackageReference Include="Becom.IBMi.SqlApiClient" Version="0.2.6" />
<PackageVersion Include="Becom.IBMi.SqlApiClient" Version="0.2.6" />
<PackageReference Include="Becom.IBMi.SqlApiClient" />
paket add Becom.IBMi.SqlApiClient --version 0.2.6
#r "nuget: Becom.IBMi.SqlApiClient, 0.2.6"
#:package Becom.IBMi.SqlApiClient@0.2.6
#addin nuget:?package=Becom.IBMi.SqlApiClient&version=0.2.6
#tool nuget:?package=Becom.IBMi.SqlApiClient&version=0.2.6
Becom.IBMi.SqlApiClient
A .NET client library for communicating with the BECOM IBMi SQL API — a REST service that executes SQL statements on an IBM i (AS/400) system and returns structured JSON results.
Requirements
- .NET 10 or later
- A running BECOM IBMi SQL API endpoint
Installation
Install via NuGet:
dotnet add package Becom.IBMi.SqlApiClient
Configuration
The client is configured through an EndpointConfiguration object:
| Property | Type | Default | Description |
|---|---|---|---|
Api |
string |
"" |
Base URL of the SQL API endpoint |
Uname |
string |
"" |
Username for Basic authentication |
Password |
string |
"" |
Password for Basic authentication |
Base64 |
string |
"" |
Pre-encoded Base64 user:password string (takes precedence over Uname/Password) |
Timeout |
int |
20 |
HTTP request timeout in seconds |
appsettings.json
{
"SqlApiEndpoint": {
"Api": "https://your-ibmi-host/sqlapi/",
"Uname": "APIUSER",
"Password": "secret",
"Timeout": 30
}
}
Registration
Single instance — from appsettings.json
builder.Services.AddSqlApiClient(builder.Configuration);
Single instance — from code
builder.Services.AddSqlApiClient(new EndpointConfiguration
{
Api = "https://your-ibmi-host/sqlapi/",
Uname = "APIUSER",
Password = "secret"
});
Multiple named instances (keyed services)
Register multiple endpoints under different keys and resolve them by name at runtime:
builder.Services.AddSqlApiClient(new EndpointConfiguration
{
Api = "https://dev-ibmi/sqlapi/",
Uname = "devuser",
Password = "devpass"
}, "dev");
builder.Services.AddSqlApiClient(new EndpointConfiguration
{
Api = "https://prod-ibmi/sqlapi/",
Uname = "produser",
Password = "prodpass"
}, "prod");
Resolve by key:
// Constructor injection
public MyService([FromKeyedServices("prod")] IIBMiSQLApi sqlApi) { ... }
// Manual resolution
var prodApi = serviceProvider.GetRequiredKeyedService<IIBMiSQLApi>("prod");
Note: When only one instance is registered, it is also available without a key via
IIBMiSQLApi. When multiple instances are registered, keyless resolution returns the first registered instance.
Usage
Inject the service
public class MyService(IIBMiSQLApi sqlApi)
{
public async Task<List<Customer>> GetCustomersAsync()
{
return await sqlApi.CallSqlServiceAsync<Customer>(
"SELECT CUSTNR, NAME FROM CUSTLIB.CUSTTBL WHERE ACTIVE = 1"
);
}
}
Map results to a class
Define a plain class that matches the column names returned by the query:
public class Customer
{
public int CUSTNR { get; set; }
public string NAME { get; set; } = string.Empty;
}
Raw JSON
string json = await sqlApi.ExecuteSQLStatementAsync("SELECT * FROM MYLIB.MYTABLE");
Health check
bool isAlive = await sqlApi.TestEnpoint();
API Reference
IIBMiSQLApi
| Member | Description |
|---|---|
CallSqlServiceAsync<T>(string query) |
Executes a SQL query and deserializes the result into List<T> |
ExecuteSQLStatementAsync(string sql) |
Executes a SQL statement and returns the raw JSON string |
TestEnpoint() |
Calls the /ping endpoint; returns true if the API responds with pong |
EndpointConfiguration |
Exposes and allows runtime replacement of the active endpoint configuration |
AddSqlApiClient overloads
| Overload | Description |
|---|---|
AddSqlApiClient(IConfiguration, string name) |
Binds config from SqlApiEndpoint section |
AddSqlApiClient(EndpointConfiguration, string name) |
Registers with an explicit configuration object |
License
Copyright © BECOM Electronics GmbH. All rights reserved.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.5)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Http (>= 10.0.5)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Becom.IBMi.SqlApiClient:
| Package | Downloads |
|---|---|
|
Becom.EDI.PersonalDataExchange
.net Wrapper zur PersonalDataExchange SOAP EDI Schnittstelle" |
|
|
BecWinFormsTranslator
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.2.6 | 104 | 3/27/2026 |
| 0.2.5 | 85 | 3/26/2026 |
| 0.2.4 | 97 | 3/23/2026 |
| 0.2.3 | 82 | 3/23/2026 |
| 0.2.2 | 88 | 3/22/2026 |
| 0.2.1 | 80 | 3/22/2026 |
| 0.2.0 | 80 | 3/22/2026 |
| 0.1.27 | 252 | 12/10/2024 |
| 0.1.26 | 221 | 7/16/2024 |
| 0.1.25 | 164 | 7/16/2024 |
| 0.1.24 | 161 | 7/16/2024 |
| 0.1.22 | 232 | 2/6/2024 |
| 0.1.20 | 969 | 6/9/2022 |
| 0.1.19 | 605 | 4/19/2022 |
| 0.1.18 | 612 | 4/19/2022 |
| 0.1.17 | 885 | 4/12/2022 |
| 0.1.15 | 555 | 5/10/2021 |
| 0.1.13 | 513 | 5/10/2021 |
| 0.1.12 | 568 | 3/10/2021 |
| 0.0.35 | 79 | 3/22/2026 |