Trax Platform APIv1

Building an nFocus site

Each organization's website is either a Duda website (see the Duda guide) or an nFocus site. The public registration portal itself serves an nFocus site, so the organization's pages and the registration flow (catalog, cart, forms, checkout, account) are one app with one look. This guide covers what the public portal needs from the API to serve one.

Which portal a request is for

An nFocus site is served at two kinds of address:

At the portal path, the path names the portal. On any other host, ask the API which portal that host serves:

Which portal a domain serves

GET https://api.nfocus.solutions/v1/sites/by-domain?domain=riverbend-central.sites.example.test → 200 OK, JSON

curl
curl -s 'https://api.nfocus.solutions/v1/sites/by-domain?domain=riverbend-central.sites.example.test'
JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/sites/by-domain?domain=riverbend-central.sites.example.test');
const data = await response.json();
C#
using var http = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Get, "https://api.nfocus.solutions/v1/sites/by-domain?domain=riverbend-central.sites.example.test");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();

GET …/config says whether the portal is also the organization's website: website.provider is nfocus, website.templateKey is the published template (null until the site first publishes), and website.primaryUrl is its primary address (the primary domain, else the portal path). For a Duda website it is duda with the Duda website's address. A portal with neither has no website. The pages themselves come from GET P/website (see Building an nFocus site from a template).

Sign-in

Both use authorization code with PKCE on the API's hosted sign-in pages (see Authentication and keys). An nFocus site needs no site key: the public portal calls the API without one.

What hosting does

The API decides which domains serve; it runs no DNS and issues no certificates. Hosting the public portal means: