← Back to Docs

smartConnectors SDK Reference

Cross-platform libraries and domain classes for integrating with smartObjx services. Not just DTOs — rich domain objects with built-in validation and behavior.

Installation

.NET (NuGet)

dotnet add package SmartObjx.Connectors

Or via the NuGet Package Manager:

Install-Package SmartObjx.Connectors

JavaScript / Node.js (npm)

npm install @smartobjx/smart.connectors @smartobjx/smart.objx.models

Two packages: @smartobjx/smart.connectors for API client classes and @smartobjx/smart.objx.models for the domain model classes.


Configuration

SDK clients are configured with a configuration object that holds your API base URL and authentication keys. The configuration class varies by product:

  • smartRules and smartStructures use ApiConfiguration
  • smartSettings uses smartConnectorInstace

C# Setup — smartRules / smartStructures

var config = new ApiConfiguration();
config.BasePath = "https://your-api-base-url";
config.ApiKey.Add("Ocp-Apim-Subscription-Key", "your-subscription-key");
config.ApiKey.Add("Ocp-Apim-POV-Key", "your-pov-key");

C# Setup — smartSettings

var config = new smartConnectorInstace();
config.BasePath = "https://your-settings-api-url";
config.ApiKey.Add("Ocp-Apim-Subscription-Key", "your-subscription-key");
config.ApiKey.Add("Ocp-Apim-POV-Key", "your-pov-key");

Sandbox Setup

var config = new ApiConfiguration();
config.BasePath = "https://api.dev.smartobjx.com/settings-demo";
config.ApiKey.Add("Ocp-Apim-Subscription-Key", "fd8efd80-f215-4c73-95f2-23841e98acbd");
config.ApiKey.Add("Ocp-Apim-POV-Key", "45ef2936-160e-47dc-bd17-3dc0060acec9");

API Client Classes

RulesApi

Client for the smartRules service.

ClassDescription
RulesApiAPI client for creating, retrieving, and evaluating rules
UseCaseEntry point for a body of rules in an application workflow
RuleSetCollection of rules or nested rulesets
RuleA conditional logic statement (true/false)
AbstractRuleBase class for Rule and RuleSet
FactbaseInput data for rule evaluation
PropositionConstantA named condition with a truth value

SettingsApi / ApplicationApi

Clients for the smartSettings service.

ClassDescription
SettingsApiAPI client for configurations, settings, and distributions
ApplicationApiAPI client for application-level operations
ApplicationSettings container for an application or module
ConfigurationCollection of settings, supports nesting
SettingIndividual setting with name, value, type, encryption
SettingDistributionDistribution of a setting value across clients

StructuresApi

Client for the smartStructures service.

ClassDescription
StructuresApiAPI client for perspectives and organizations
PerspectiveNamed view of an organizational hierarchy
OrganizationA node in the hierarchy tree
TreeHierarchical arrangement of organizations

Serialization

smartObjx domain objects use polymorphic serialization with $type discriminators. When sending objects via HTTP directly (without the SDK), include the type information:

{
  "$type": "smart.Objx.Rules.RuleSet, smart.Objx.Rules",
  "Name": "My RuleSet"
}

When using the SDK classes, serialization is handled automatically via JsonSerializationSettingsFactory:

var payload = JsonConvert.SerializeObject(
    ruleSet,
    typeof(AbstractRule),
    JsonSerializationSettingsFactory.GetSettingsInstance()
);

JavaScript / fetch

If you prefer using fetch() directly instead of the npm packages, all smartObjx APIs follow the same pattern:

const headers = {
  'Content-Type': 'application/json',
  'Ocp-Apim-Subscription-Key': 'your-subscription-key',
  'Ocp-Apim-POV-Key': 'your-pov-key'
};

// GET request
const data = await fetch('https://your-api-base-url/endpoint', {
  method: 'GET', headers
}).then(r => r.json());

// POST request
const result = await fetch('https://your-api-base-url/endpoint', {
  method: 'POST', headers,
  body: JSON.stringify(requestBody)
}).then(r => r.json());

Related