apiConnectorCore 1.0.14

dotnet add package apiConnectorCore --version 1.0.14
                    
NuGet\Install-Package apiConnectorCore -Version 1.0.14
                    
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.14" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="apiConnectorCore" Version="1.0.14" />
                    
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.14
                    
#r "nuget: apiConnectorCore, 1.0.14"
                    
#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.14
                    
#: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.14
                    
Install as a Cake Addin
#tool nuget:?package=apiConnectorCore&version=1.0.14
                    
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.

Public CMS language

When myContext carries an explicit visitor ?lang=, GET reads under cm/ on the configured API forward its normalized value. Existing account/token selectors, caller-supplied lang, other APIs, and reads without a visitor language keep their URLs. The API's Content-Language on a resolved page/category is recorded in HttpContext.Items[CmsLanguageRequest.ItemKey]; layout menu/banner fallbacks do not override it. Accounts and views use CmsLanguageRequest.HtmlTag to put that resolved language and direction on the server-rendered opening HTML tag while retaining theme attributes. Standalone sites consuming the NuGet package need a package upgrade and the same layout call to adopt that document metadata; this change does not publish a package or update sibling repositories.

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 (2)

Showing the top 2 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.

net3000.content.client

Typed client for the Content Management (cm) routes on api.net3000.ca. One method per live /cm/ route, returning the same apiResponse<T> models the api serialises, over the apiConnectorCore transport. A client website reads CMS pages, categories, menus, banners, videos, forms and testimonials with no database connection string.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.14 0 11/28/2026
1.0.12 180 10/29/2026
1.0.5 299 7/8/2026
1.0.4 178 7/4/2026
1.0.3 258 1/4/2026
1.0.1 373 7/15/2025
1.0.0.9 313 7/15/2025
1.0.0.8 317 7/15/2025
1.0.0.7 357 4/10/2025
1.0.0.6 359 4/9/2025
1.0.0.5 666 3/25/2025
1.0.0.4 666 3/25/2025
1.0.0.3 415 7/17/2023
1.0.0.2 733 4/14/2022
1.0.0.1 629 3/20/2022

1.0.14: The shared transport the typed client packages need, landed once (#8126, epic #8079). bearerToken sends a signed-in end user's JWT as Authorization: Bearer on every call, so the routes that answer for a signed-in client (the limo client portal, the corporate portal, the app checkout) are reachable from a client package without a second HTTP pipeline; tenant selection is unchanged and a caller that sets nothing sends no Authorization header. deleteRequest<T> / deleteRequest send a DELETE with no body, for the portal routes that delete by URL. sendRequest / sendRequest<T> send a body with any HTTP method, because a route only answers the verb it is declared with and the Almotawif surface has PUT /mt/reservation; use deleteRequest for a bodyless DELETE and sendRequest when a non-POST verb carries a body. postRawResponse is the POST twin of getRawResponse, for a write route that answers HTML, a redirect or a bare string rather than an apiResponse envelope. A non-generic postFilesRequest covers an upload route that answers a bare apiResponse with no data (deserialising such a reply as apiResponse<T> and handing it back as apiResponse reads data off the base class, which the generic subclass shadows, so it is always null). All of it reuses the existing tenant headers, outage detection and apiResponse deserialiser. Additive. Landed as one release rather than three because #8107, #8108 and #8110 each added an overlapping subset and all three claimed 1.0.14, so merging any two would have declared deleteRequest or postRawResponse twice. 1.0.13: Write and binary transport for the typed client packages (#8080, epic #8079). postRequest<T> / postRequest POST a JSON body, postFilesRequest<T> posts multipart/form-data, and getBytesResponse GETs a file without corrupting it through a string. All four reuse the existing tenant headers, outage detection and apiResponse deserialisation, so a client package never stands up an HttpClient of its own. A POST that gets no response throws ApiUnavailableException like a GET, instead of returning the exception message as if it were a body (the pre-existing postform did). LastContentType reports the last binary reply's type, and postFile gains an optional contentType. Additive. 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.