apiConnectorCore 1.0.12

dotnet add package apiConnectorCore --version 1.0.12
                    
NuGet\Install-Package apiConnectorCore -Version 1.0.12
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="apiConnectorCore" Version="1.0.12" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="apiConnectorCore" Version="1.0.12" />
                    
Directory.Packages.props
<PackageReference Include="apiConnectorCore" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add apiConnectorCore --version 1.0.12
                    
#r "nuget: apiConnectorCore, 1.0.12"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package apiConnectorCore@1.0.12
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=apiConnectorCore&version=1.0.12
                    
Install as a Cake Addin
#tool nuget:?package=apiConnectorCore&version=1.0.12
                    
Install as a Cake Tool

apiConnectorCore

Overview

The apiConnectorCore package is the .NET Core compatible successor to the legacy connector. It wraps authenticated HTTP requests against Net3000 APIs, supports typed responses, and includes asynchronous error forwarding that works with ASP.NET Core middleware and dependency injection.

Public API

<details> <summary>net3000.apiConnector</summary>

Member Summary Parameters
Task PostErrorDetailAsync(IExceptionHandlerPathFeature exceptionHandlerPathFeature, HttpContext context, string? customMessage) Post Error Detail Async. exceptionHandlerPathFeature (IExceptionHandlerPathFeature), context (HttpContext), customMessage (string?)
string getRawResponse(string url) Get Raw Response. url (string)
apiResponse getRequest(string url) Get Request. url (string)

</details>

Usage Notes

  • Set the configuration and myContext properties so that account headers and tokens are injected before calling getRequest.
  • Use the generic overload getRequest<T> when a typed API response is required.
  • PostErrorDetailAsync can be plugged into ASP.NET Core exception handlers to mirror legacy error logging behaviour.

Choosing the tenant from the URL (1.0.12+)

?accounttoken=, ?token= and ?account= select the tenant only on hosts that do not pin one. A site that sets account or accountToken (in AppSettings or in code) before the first myContext assignment keeps that tenant whatever the URL says. A host that pins a default tenant but serves other tenants by URL (views, DemoApplications) opts in:

"AppSettings": { "account": 4885, "acceptQueryAccountToken": true }

or connector.acceptQueryAccountToken = true in code.

When the api is down (1.0.10+)

Register the outage filter once so an api outage shows a 503 "temporarily unavailable" page instead of a 500:

builder.Services.AddControllersWithViews(options => options.Filters.Add<ApiOutageFilter>());
  • A call that gets no response (refused, DNS, TLS, or the 30-second timeout) throws ApiUnavailableException.
  • A 3xx the client gave up following, or a 5xx that is not a tenant suspension, sets connector.ApiUnavailable.
  • Either one is recorded on myContext, so set connector.myContext = HttpContext before calling the api.
  • With the filter registered, an action that throws, a view whose model is a failed apiResponse, or a view that throws during that request all get ApiOutage.RenderPage (503, Retry-After: 120, no api call).
  • A site's own message() can return connector.ServiceUnavailablePage() when connector.ApiUnavailable is true.

The outage page (1.0.11+)

Every site serves the same page, https://cdn.net3000.ca/themes/platform/outage.html (ApiOutage.PageUrl). It is fetched with a 3-second timeout and cached for an hour; when the CDN cannot be reached the embedded copy (Resources/outage.html) is served instead.

To change the page, edit Resources/outage.html and upload the same file:

az storage blob upload --account-name net3000cdn --container-name themes --name platform/outage.html \
  --file "Class Libraries/apiConnectorCore/Resources/outage.html" --content-type "text/html; charset=utf-8" \
  --content-cache-control "public, max-age=300" --overwrite --auth-mode key

Sites pick it up within an hour, with no release. Ship the edited file in the next package version too, so the fallback matches.

License

This library is proprietary to Net3000. Redistribution or use outside Net3000.ca solutions is not permitted.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on apiConnectorCore:

Package Downloads
net3000.mailingList

Mailing list management library for Net3000.ca applications. Subscriber management, campaigns, multi-platform integrations (SendGrid, MailChimp, Constant Contact), delivery tracking, and audience contact sources.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.12 78 10/29/2026
1.0.5 279 7/8/2026
1.0.4 161 7/4/2026
1.0.3 248 1/4/2026
1.0.1 361 7/15/2025
1.0.0.9 302 7/15/2025
1.0.0.8 306 7/15/2025
1.0.0.7 349 4/10/2025
1.0.0.6 351 4/9/2025
1.0.0.5 646 3/25/2025
1.0.0.4 653 3/25/2025
1.0.0.3 407 7/17/2023
1.0.0.2 720 4/14/2022
1.0.0.1 614 3/20/2022

1.0.12: Security (#5554): a site that pins its own tenant (account or accountToken set before myContext) no longer lets ?accounttoken=, ?token= or ?account= in the URL replace it, which since 1.0.6 let a shared link render another tenant's content on a customer domain and made unrelated ?token= links (login verify, device confirm) break api calls. Hosts that pin a default tenant but serve others by URL opt in with AppSettings:acceptQueryAccountToken=true (views, DemoApplications) or apiConnector.acceptQueryAccountToken. Hosts that pin nothing (iframes, accounts) are unchanged. 1.0.11: The outage page is one file on the CDN (https://cdn.net3000.ca/themes/platform/outage.html), fetched with a 3-second timeout and cached for an hour, so its copy can change without a release; the same file is embedded as the fallback. The card is centred vertically. ApiOutage.UnavailableHtml is replaced by PageHtml() / FallbackHtml. 1.0.10: Api outage handling for customer sites (#5554). ApiOutageFilter (register once) serves a 503 page with Retry-After when the api is down instead of a 500; apiConnector.ApiUnavailable and ServiceUnavailablePage(); a call that gets no response now throws ApiUnavailableException (was a nested AggregateException) and resets LastHttpStatusCode to 0; api requests time out after 30 seconds instead of 100. 1.0.9: Preserve a public tenant selector on shared sign-in/sign-up redirects as well as returnUrl (#5299), so fresh Business Directory sessions select the right account; SignUpUrlFromAuthQuery / SignInUrlFromAuthQuery keep the auth page's own tenant on the sign-in/sign-up cross-links. 1.0.8: Account suspension rendering for customer SSR sites (issue #3029 Part 3). postForm and apiConnector expose LastHttpStatusCode; AccountSuspension detects HTTP 503 / notActive (401) and renders the platform page with Retry-After and Cache-Control no-store; FetchSuspensionHtml pulls copy from GET /common/suspension with a hardcoded fallback. 1.0.7: Move AccountAreaPage, AccountClientPortalAttribute, and AccountPublicAuthAttribute into apiConnectorCore so customer sites have shared /account/* portal defaults without code duplication. 1.0.6: getRequest / getRequest<T> never return null when the API body is empty or JSON null — keep a seeded invalid apiResponse (success=false) so callers that touch response.success do not 500. 1.0.5: Error-reporting hardening + one-line wiring.