QuickbaseDotNet.Extensions.DependencyInjection
0.1.0
dotnet add package QuickbaseDotNet.Extensions.DependencyInjection --version 0.1.0
NuGet\Install-Package QuickbaseDotNet.Extensions.DependencyInjection -Version 0.1.0
<PackageReference Include="QuickbaseDotNet.Extensions.DependencyInjection" Version="0.1.0" />
<PackageVersion Include="QuickbaseDotNet.Extensions.DependencyInjection" Version="0.1.0" />
<PackageReference Include="QuickbaseDotNet.Extensions.DependencyInjection" />
paket add QuickbaseDotNet.Extensions.DependencyInjection --version 0.1.0
#r "nuget: QuickbaseDotNet.Extensions.DependencyInjection, 0.1.0"
#:package QuickbaseDotNet.Extensions.DependencyInjection@0.1.0
#addin nuget:?package=QuickbaseDotNet.Extensions.DependencyInjection&version=0.1.0
#tool nuget:?package=QuickbaseDotNet.Extensions.DependencyInjection&version=0.1.0
QuickbaseNet
A .NET client for the Quickbase REST API v1 with typed record mapping, automatic paging, batched upserts and retries.
Unofficial library. Not affiliated with Quickbase, Inc.
dotnet add package QuickbaseDotNet
The package is QuickbaseDotNet and the namespace is QuickbaseNet.
Quick start
using QuickbaseNet;
var qb = new QuickbaseClient(new QuickbaseOptions { Realm = "acme", UserToken = token });
var page = await qb.Records.QueryAsync(new RecordQuery
{
From = "bqx7xre7m",
Select = [3, 6, 7],
Where = Filter.Fid(7).Is("Open").And(Filter.Fid(9).Over(1000)),
SortBy = [Sort.Asc(6)],
});
foreach (var record in page.Records)
{
Console.WriteLine($"{record.Rid}: {record.GetString(6)} ({record.GetDecimal(9):C})");
}
Operations are grouped by resource: qb.Records, qb.Reports, qb.Apps, qb.Tables and qb.Fields. Every async method takes a CancellationToken.
A Record is a read-only map of fid to JsonElement with the {"value": ...} wrapper already removed. The getters (GetString, GetDecimal, GetInt64, GetBoolean, GetDate, GetDateTime and Get<T>) return null for empty fields and accept numbers that Quickbase sends as strings, which formula fields often do.
Typed mapping
Put [Fid] on the properties of a partial class:
public sealed partial class Project
{
[Fid(3)] public long Rid { get; set; }
[Fid(6)] public string? Name { get; set; }
[Fid(7)] public string? Status { get; set; }
[Fid(9)] public decimal Budget { get; set; }
[Fid(10)] public DateOnly? Due { get; set; }
[Fid(12, ReadOnly = true)] public decimal? Spent { get; set; }
}
A source generator in the package writes the mapping code at compile time, so there is no reflection at runtime and the mapping works under trimming and Native AOT. The generic overloads select the mapped fids for you:
var open = await qb.Records.QueryAsync<Project>(new RecordQuery { From = tableId, Where = Filter.Fid(7).Is("Open") });
await foreach (var project in qb.Records.QueryAllAsync<Project>(new RecordQuery { From = tableId }))
{
Console.WriteLine($"{project.Name} is due {project.Due}");
}
ReadOnly = true fields are read but never written, which is what you want for lookups, formulas and summaries.
If a type cannot get a generated mapper you get a build warning that says why (QBN001 to QBN004): the type is not partial, a property type has no conversion or the type has no public parameterless constructor. For those cases there is a reflection fallback. It is marked [RequiresUnreferencedCode] so the trimmer tells you when you use it:
var mapper = RecordMapper.Reflection<LegacyProject>();
var page = await qb.Records.QueryAsync(new RecordQuery { From = tableId }, mapper);
On a 1,000 record benchmark the generated mapper reads about twice as fast as the reflection one and allocates about 40% less. Run benchmarks/QuickbaseNet.Benchmarks to see numbers for your machine.
Paging
QueryAllAsync returns IAsyncEnumerable<Record> and fetches pages as you enumerate:
var query = new RecordQuery
{
From = tableId,
Where = Filter.Fid(2).OnOrAfter(DateTimeOffset.UtcNow.AddDays(-1)),
Options = new QueryOptions { Top = 500 },
};
await foreach (var record in qb.Records.QueryAllAsync(query))
{
Console.WriteLine(record.Rid);
}
Top is the page size here, not a limit on the total. Quickbase caps each response by payload size as well, so a page can come back with fewer records than you asked for even when more remain. The pager moves skip forward by the number of records that actually arrived and stops when it reaches totalRecords or gets an empty page. Code that adds top to skip on every request silently drops records on wide tables; this is the most common bug in hand-written Quickbase paging.
Reports page the same way:
await foreach (var record in qb.Reports.RunAllAsync(tableId, reportId: "7", pageSize: 1000))
{
Console.WriteLine(record.GetString(6));
}
Upserts
var result = await qb.Records.UpsertAsync(tableId,
[
new RecordData { [6] = "Bridge retrofit", [7] = "Open", [9] = 125_000m, [10] = new DateOnly(2026, 9, 30) },
new RecordData { [6] = "Depot roof", [7] = "Planned" },
],
new UpsertOptions { MergeFieldId = 6, FieldsToReturn = [3] });
Console.WriteLine($"{result.CreatedRecordIds.Count} created, {result.UpdatedRecordIds.Count} updated");
foreach (var (row, errors) in result.LineErrors)
{
Console.WriteLine($"Row {row}: {string.Join("; ", errors)}");
}
Typed objects work too: await qb.Records.UpsertAsync(tableId, projects).
What the client does for you:
- Records go out in batches of
BatchSize(1,000 by default) and the results are merged. LineErrorsrow numbers point into the list you passed in. Quickbase numbers them per request, so without renumbering an error in the third batch would claim to be row 2.- Null values are skipped so a partly filled object never blanks out fields. Set
WriteNulls = trueto clear fields on purpose. - Fids 1, 2, 4 and 5 (Date Created, Date Modified, Record Owner, Last Modified By) are never sent.
- Record ID# (fid 3) is only sent when it is the merge field, either because
MergeFieldIdis 3 or because no merge field is set and the table's key field applies. - Dates are written as
yyyy-MM-ddand date/times as ISO 8601 in UTC.
Deletes
var deleted = await qb.Records.DeleteAsync(tableId, Filter.Fid(7).Is("Cancelled").And(Filter.Fid(2).Before(new DateOnly(2024, 1, 1))));
An empty where clause throws ArgumentException before anything is sent. If you really want to empty a table, say so with a filter like Filter.Fid(3).Over(0).
Filters
Filter builds Quickbase query strings and converts to string wherever a where clause is expected.
var where = Filter.All(
Filter.Fid(7).Is("Open"),
Filter.Any(Filter.Fid(8).Is("East"), Filter.Fid(8).Is("West")),
Filter.Fid(9).AtLeast(1000));
// {7.EX.'Open'}AND({8.EX.'East'}OR{8.EX.'West'})AND{9.GTE.'1000'}
| Method | Operator | Method | Operator |
|---|---|---|---|
Is |
EX | IsNot |
XEX |
Contains |
CT | DoesNotContain |
XCT |
StartsWith |
SW | DoesNotStartWith |
XSW |
Has |
HAS | DoesNotHave |
XHAS |
Under |
LT | AtMost |
LTE |
Over |
GT | AtLeast |
GTE |
Before |
BF | OnOrBefore |
OBF |
After |
AF | OnOrAfter |
OAF |
InRange |
IR | NotInRange |
XIR |
TrueValue |
TV | IsChecked / IsUnchecked |
EX 'true' / 'false' |
IsBlank |
EX '' | IsNotBlank |
XEX '' |
Mixed groups get parentheses, chains of the same joiner stay flat and Filter.Raw("...") wraps anything you wrote by hand. Numbers and dates are formatted with the invariant culture, so a server running in de-DE still sends 1234.5 and single quotes in values are escaped.
Dependency injection
dotnet add package QuickbaseDotNet.Extensions.DependencyInjection
builder.Services.AddQuickbase(builder.Configuration.GetSection("Quickbase"));
{
"Quickbase": {
"Realm": "acme",
"UserToken": "b1234_xyz",
"Retry": { "MaxRetries": 5 }
}
}
Options are validated at startup, so a missing realm or token fails the host instead of the first request. The client comes from IHttpClientFactory with RetryHandler attached. Inject QuickbaseClient anywhere.
For more than one realm, register names and resolve them as keyed services or through QuickbaseClientFactory:
builder.Services.AddQuickbase("east", builder.Configuration.GetSection("Quickbase:East"));
builder.Services.AddQuickbase("west", builder.Configuration.GetSection("Quickbase:West"));
public sealed class Reconciler([FromKeyedServices("east")] QuickbaseClient east, [FromKeyedServices("west")] QuickbaseClient west);
AddQuickbase returns the IHttpClientBuilder, so you can replace the built-in retries with Microsoft.Extensions.Http.Resilience:
builder.Services.AddQuickbase(builder.Configuration.GetSection("Quickbase"))
.RemoveRetryHandler()
.AddStandardResilienceHandler();
To pull the token from somewhere else at runtime, set TokenSource. It is called before each request, so cache inside it:
builder.Services.AddOptions<QuickbaseOptions>()
.Configure<VaultToken>((options, vault) => options.TokenSource = vault.GetAsync);
Azure Functions sample
samples/FunctionsSync is an isolated worker app on .NET 10. A timer trigger runs every 15 minutes, reads the projects changed since the last run and merges them into Azure SQL. The Function App's managed identity reads the Quickbase token from Key Vault and signs in to Azure SQL, so no secret sits in app settings.
Two files are worth reading. VaultToken.cs caches the secret for ten minutes so rotation needs no restart. SyncProjects.cs explains why the watermark uses OnOrAfter and why records edited mid-sync are not lost. sql/schema.sql has the tables.
Observability
Every call starts an Activity from the QuickbaseNet source with quickbase.realm, quickbase.operation and quickbase.table.id tags. The QuickbaseNet meter publishes:
| Instrument | Type | Unit |
|---|---|---|
quickbase.client.request.duration |
Histogram | s |
quickbase.client.retries |
Counter | {retry} |
quickbase.client.records.returned |
Counter | {record} |
builder.Services.AddOpenTelemetry()
.WithTracing(t => t.AddSource(QuickbaseTelemetry.ActivitySourceName))
.WithMetrics(m => m.AddMeter(QuickbaseTelemetry.MeterName));
Logs go through ILogger with the QuickbaseNet category. Requests log at Debug, retries at Information and failures at Warning. Tokens are never logged.
Error handling
Any non-success response becomes a QuickbaseException:
try
{
await qb.Records.QueryAsync(new RecordQuery { From = tableId, Where = "{99.EX.'x'}" });
}
catch (QuickbaseException ex) when (ex.StatusCode == HttpStatusCode.BadRequest)
{
Console.WriteLine($"{ex.QuickbaseMessage}: {ex.Description} (ray {ex.RequestId})");
}
RequestId is the QB-API-RAY header, which Quickbase support asks for. ResponseBody holds the raw body. Gateways in front of Quickbase sometimes answer with HTML instead of JSON; those bodies are kept as text and QuickbaseMessage falls back to the HTTP reason phrase.
Retries
RetryHandler retries 429, 502, 503 and 504. It honors Retry-After in either the seconds or the date form. Without that header it waits BaseDelay * 2^(attempt - 1), capped at MaxDelay, then picks a random point in the upper half of that window so a burst of throttled clients does not retry in lockstep. Request bodies are buffered so every attempt sends the same bytes. Waits go through TimeProvider, which is how the tests check timing without sleeping.
A POST that hit a 502 or 504 may have been processed before the gateway gave up. Upserts with a merge field are safe to repeat. Upserts that create records without one can create a duplicate on retry; set MergeFieldId or lower MaxRetries for those.
Options
| Option | Default | Notes |
|---|---|---|
Realm |
required | acme or acme.quickbase.com |
UserToken |
Sent as QB-USER-TOKEN |
|
TempToken |
Sent as QB-TEMP-TOKEN |
|
TokenSource |
Async callback for tokens from a vault. Set exactly one of the three token options | |
UserAgent |
Your app's product token, sent before QuickbaseNet/{version} |
|
BaseAddress |
https://api.quickbase.com/v1/ |
Change only for a proxy |
Timeout |
100 s | Applies when the client creates its own HttpClient or comes from DI |
Retry.MaxRetries |
3 | Zero turns retries off |
Retry.BaseDelay |
1 s | First backoff step |
Retry.MaxDelay |
30 s | Cap for backoff and for Retry-After |
Supported frameworks
The packages target net10.0 and netstandard2.0. That covers .NET 10 and later, the .NET 8 and 9 runtimes through netstandard2.0 and .NET Framework 4.6.2 and later. The net10.0 build is trimmable and Native AOT compatible. Generated mapping code compiles as C# 7.3, so it works in old-style .NET Framework projects too.
Roadmap
- Field and table management endpoints (create, update, delete)
- Temporary token exchange through
/auth/temporary - File attachment upload and download
- Formula evaluation through
/formula/run - An
IAsyncEnumerableoverload for upserts that streams batches from a source you do not want in memory
Building
dotnet build
dotnet test
dotnet pack -c Release -o artifacts
Integration tests run against a real realm only when QB_REALM, QB_TOKEN and QB_TABLE_ID are set and skip otherwise. Set QB_ALLOW_WRITES=1 as well to run the test that creates and deletes a record.
Every C# block in this README is compiled by tests/ReadmeSnippets on each build, so the examples cannot drift from the API.
See CONTRIBUTING.md before opening a pull request.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.15)
- Microsoft.Extensions.Http (>= 10.0.15)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.15)
- QuickbaseDotNet (>= 0.1.0)
-
net10.0
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.15)
- Microsoft.Extensions.Http (>= 10.0.15)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.15)
- QuickbaseDotNet (>= 0.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0 | 0 | 12/2/2026 |