sgcREST Feature Matrix: REST Server & OpenAPI | eSeGeCe

sgcREST Feature Matrix

Everything sgcREST does, mapped across the REST server and its companions, the OpenAPI server engine and the OpenAPI client family. Every capability works the same in Delphi and C++ Builder, and every license ships full source code. Component subpages are not published yet for this launch, each entry below is self-contained on this page.

REST Server

CORS, stats, tenancy & users

OpenAPI Server

Spec-first & code-first

OpenAPI Client

Consume any OpenAPI-described API

Standards & Platforms

Delphi 7 to 13, C++ Builder

sgcREST is self-contained. It ships with the sgcWebSockets Core runtime bundled in, so it is not an add-on, and it runs on the standard Indy library that ships with RAD Studio.

Code-first OpenAPI needs Delphi XE7 or later. Generating a spec from an attributed Delphi class relies on RTTI introduced in XE7. The REST server, its companions and the spec-first OpenAPI engine run on Delphi 7 to 13.

Seven Classes, Three Families

Four components on the SGC REST palette page, and three code-only OpenAPI server and client classes, declared across the sgcHTTP_REST_Server* and sgcHTTP_OpenAPI_* units.

ComponentClassPalette?Description
REST ServerTsgcHTTPRESTServerYesREST API server built on TsgcHTTPServer, with CORS handling and attachable stats/tenancy companions.
REST Server StatsTsgcHTTPServerStatsYesRequest counters, latency tracking, Prometheus /metrics and JSON /health.
REST Server TenancyTsgcHTTPServer_TenancyYesMulti-tenant resolution by host, path, header or JWT claim.
REST Server UsersTsgcHTTPServer_UsersYesLocal account store: add, validate, hash, role-tag and persist users.
OpenAPI Server, Spec-FirstTsgcOpenAPIServerHandlerNo, code-onlyServes an API from a loaded OpenAPI 3.0/3.1 document, with request validation.
OpenAPI Server, Code-FirstTsgcOpenAPICodeFirstScannerNo, code-onlyGenerates the OpenAPI spec from an RTTI-attributed Delphi class. Needs Delphi XE7+.
OpenAPI ClientTsgcOpenAPI_ClientNo, code-onlyGeneric runtime client for any OpenAPI-described endpoint.

CORS, Stats, Tenancy and a User Store

TsgcHTTPRESTServer is a TsgcHTTPServer descendant, so it starts from the same bindings and TLS handling every sgc HTTP server shares, and layers a REST API's usual extras on top.

CapabilityAPINotes
CORSCORSOptions (Enabled, AllowOrigins, AllowHeaders, AllowMethods)Off by default. Preflight OPTIONS requests are answered automatically once enabled.
Stats companionServerStats: TsgcHTTPServerStatsAttach a stats component and every request is counted and timed without touching route handlers.
Tenancy companionTenancy: TsgcHTTPServer_Tenancy, TenantAttach a tenancy component to resolve the caller's tenant; Tenant reads the result for the current request.
Request countersTotalRequests, Status1xx to Status5xxOn TsgcHTTPServerStats. Counted per status class as responses are sent.
LatencyLatencyMinMs, LatencyAvgMs, LatencyMaxMsTracked per request on TsgcHTTPServerStats, reset with Reset.
Metrics endpointGetMetricsText, IsMetricsRequestPrometheus text exposition format 0.0.4, served at /metrics.
Health endpointGetHealthJSON, IsHealthRequestJSON health payload served at /health, includes UptimeSeconds and ActiveConnections.
Per-endpoint statsGetEndpointStats, EndpointsOne path/count pair per endpoint, for a report or an admin console.
Tenant resolutionResolution, ResolveTenantOn TsgcHTTPServer_Tenancy. Resolves by host suffix, path segment, header or JWT claim.
Tenant sourcesHostSuffix, PathSegmentIndex, HeaderName, ClaimName, DefaultTenantThe source read for the configured Resolution mode, and the fallback when it yields nothing.
Custom resolutionOnResolveTenantOverride or extend the built-in resolution logic.
User accountsAddUser, DeleteUser, FindUser, ValidateCredentials, SetPassword, EnableUser, UserExistsOn TsgcHTTPServer_Users. Salted, hashed credentials, never returned in plain form.
RolesAddRole, RemoveRole, UserHasRole, GetUserRolesFree-form role tags per account, checked from a route handler.
EnumerationCount, GetUserCount, GetUserByIndex, GetUsernamesRead-only views for a report or an admin console; password hash and salt are never included.
PersistenceLoadUsers, SaveUsers, SaveToFile, LoadFromFile, ExportUsers, ImportUsersStorage.EncryptAtRest encrypts the store; OnLoadUsers/OnSaveUsers swap in a custom backend.
EventsOnStats, OnResolveTenant, OnValidateCredentials, OnFindUser, OnExceptionOne event per companion for the cases the built-in logic does not cover.

Spec-First Routing, Code-First Generation

Both approaches feed the same route table and request context; only the source of the OpenAPI document differs.

CapabilityAPINotes
Route tableTsgcOpenAPIRouteTable (Add, Match)Built from a spec's paths section; matches a verb and a path to an operationId.
Request contextTsgcOpenAPIServerContext (Request, Response, PathParams, QueryParams)One instance per matched request, freed when the request ends.
Typed parametersPathParamAsString, PathParamAsInteger, QueryParamAsString, QueryParamAsInteger, QueryParamAsBooleanReads and converts a path or query value in one call.
Body accessBodyAsString, BodyAsJSON, HeaderValueParses the request body once and caches the result.
RespondingRespondJSON, RespondErrorWrites a JSON body with a status code, or a structured error payload.
Request lifecycleBeforeHandle, AfterHandle, HandleExceptionOn TsgcOpenAPIServerHandler. Override to add logging, auth checks or custom error mapping.
ValidationTsgcOpenAPIJSONValidatorChecks request bodies, query and path parameters against the JSON Schemas the spec declares.
Spec generationGenerateSpec, Title, Description, Version, BasePathOn TsgcOpenAPICodeFirstScanner. Produces an OpenAPI 3.0 document from an attributed class's RTTI.
Contract attributessgcServiceContract, sgcRoute, sgcSummary, sgcDescription, sgcTag, sgcResponseClass- and method-level attributes that populate the generated spec.
Verb attributessgcHttpGet, sgcHttpPost, sgcHttpPut, sgcHttpDelete, sgcHttpPatch, sgcHttpHead, sgcHttpOptionsDeclares the HTTP verb an annotated method answers.
Parameter bindingsgcFromPath, sgcFromQuery, sgcFromHeader, sgcFromBody, sgcRequiredDeclares where each method parameter is read from.
DispatchTsgcOpenAPICodeFirstDispatcher (RegisterController, DispatchOperation, IsRegistered)Invokes the annotated method registered for an operationId directly, no manual if chain.
DependencyDelphi XE7 or laterCode-first scanning and dispatch rely on System.Rtti, unavailable before XE7. Spec-first has no such requirement.

One Runtime Client, Any OpenAPI-Described API

A generic client for any OpenAPI-described endpoint, with Basic auth, bearer tokens, generic OAuth2 and generic JWT built in.

CapabilityAPINotes
Base callHTTP_REQUESTOn TsgcOpenAPI_Client. Carries a TsgcOpenAPIRequest/TsgcOpenAPIResponse pair to any endpoint.
Base URLSetBaseURL, GetBaseURLThe endpoint every relative path in a request resolves against.
Generic authenticationAuthentication (Basic, Token, OAuth2, JWT)Basic auth and bearer tokens, plus generic OAuth2 and JWT flows.
TransportTLSOptions, ProxyOptions, EncodeBodyAsUTF8Standard TLS and proxy configuration shared with the rest of the sgc HTTP stack.
Progress & loggingOnUpload, OnDownload, Log, LogFileNameTrack large request/response bodies and optionally log every call to a file.
Request hookOnBeforeRequestInspect or amend a request before it is sent.
TLS hooksOnSSLVerifyPeer, OnSSLGetHandler, OnSSLAfterCreateHandlerCertificate verification and handler customization, shared with the rest of the sgc HTTP stack.

APIs, Compilers and Targets

Public standards on the wire, and the same source across every supported compiler.

AreaDetail
OpenAPIOpenAPI 3.0 and 3.1, both for the server's spec-first routing and for the JSON Schemas request validation checks against.
Client authenticationHTTP Basic authentication and bearer tokens, plus generic OAuth2 and JWT.
MetricsPrometheus text exposition format 0.0.4 at /metrics.
PlatformsWindows Win32, Windows Win64, Linux64, macOS, iOS and Android for all seven classes.
DependencyNone beyond the bundled sgcWebSockets Core runtime. No additional add-on for any of the seven classes.
CompilersDelphi and C++ Builder 7 through 13. Code-first OpenAPI needs Delphi XE7 or later.
EditionsThe REST server family also ships inside sgcWebSockets from Professional up, the OpenAPI server from Enterprise up, and the OpenAPI client from Standard up.
LicensingStandalone. The sgcWebSockets Core runtime is bundled in and full source code is included.
Best value: All-AccessEvery eSeGeCe product, Premium Support included, from €1,059/year.
See All-Access pricing

Build with sgcREST

Download the free trial and stand up your first REST endpoint or OpenAPI call from Delphi or C++ Builder.