evergrowth consulting ltd.
  • Home
  • Core Values
  • Support Services
  • Accounting Services
  • Product Help
    • DimLogic
    • 1099 Per-Line Control for Business Central
    • Business Central Build Tasks for Azure Devops
  • Policies
    • Privacy
    • Telemetry
    • AI Usage
    • Terms and Conditions
  • Insights Articles
  • Contact Us or Submit an Issue

DimLogic Documentation - API

Get DimLogic here (AppSource Marketplace:) AppSource Marketplace
  • API Documentation Glossary Reference
  • Overview
  • Permission Set [EVG DIMLOGIC API]
  • Configuration
    • API Functions
  • Operations
    • Headers
    • Endpoints
    • Payloads
      • Operation Payload(s)
      • Operation Response(s)
      • Evaluation payload

API Documentation Glossary Reference

ConceptDetailsReference
API Version2.0
Tenant identifier (Entra / Business Central){{tenantId}}
Sandbox vs. Production identifiers{{environmentName}}
Company idA guid representing the company system id (usually not available or obvious to front end users){{companyId}}
Company nameAn url-encoded variant of the company name, i.e. CRONUS%20Canada%2C%20Inc.{{companyName}}

Postman Examples

TypeLink
EnvironmentDimLogic_Template.postman_environment.json
CollectionDimLogic.postman_collection.json

Overview

DimLogic has an API available that allows for create, modify, update and deletion of rules and rulesets. It also has the ability to evaluate the result of a dimension setting to test the system. This will allow for integrating programs to anticipate the actions of DimLogic. The API leverages the Microsoft Dynamics 365 Business Central native API scaffolding to handle authentication.

Permission Set [EVG DIMLOGIC API]

In order to configure the system for service to service, please see the Microsoft Learn article here:

MS Learn - Using service-to-service (S2S) authentication

Once the Entra user is set up, apply the security group EVG DIMLOGIC API to the Entra user in order to enable the service to use the API.

Configuration

In addition to the service configuration and Entra configuration, DimLogic allows you to granularly control what is exposed through DimLogic.

Configuration Window

Enable API Functions: this setting will enable query mode only, and must be set to true (on) in order for any other functions to operate. This maps to read-only state for the API with no other settings turned on.

API Functions

Enable API Create: this setting will allow the API service to create DimLogic rules.

Enable API Modification: this setting will allow the API service to modify existing rules.

Enable API Delete: this setting will allow the API service to delete rules.

Enable API Evaluate: this setting will allow the API service to evaluate a payload to determine what the outcome will be if the payload were applied to DimLogic.

Note that deactivating the “Enable API Functions” setting will disable all other API functions.

Operations

Headers

Business Central’s API requires the following headers:

HeaderTypeValue
AuthorizationStringBearer <token>
Content-TypeStringapplication/json
If-MatchStringIf interacting with an existing document (i.e. PATCH or DELETE) you must put the last @odata.etag value in this field (record-safe), or use If-Match * (cowboy variant; will not bother to match the record)

Endpoints

The evaluation endpoint by definition is different from the operational endpoint for Business Central. The initial endpoint as specified by Microsoft for Business Central endpoints is:

LocationReference
Base Endpointhttps://api.businesscentral.dynamics.com/v2.0/{{tenantId}}/{{environmentName}}
Operation endpoints/api/evergrowth/dimlogic/v2.0/companies({{companyId}})
Evaluation endpoint/ODataV4/dimlogicActions_Evaluate?company={{companyName}}

Operational (query, insert, modify, delete) endpoints use the operation endpoint. Evaluate uses the evaluation endpoint.

OperationHTML VerbEndpointEffectReturns
Query rulesetsGET/rulesetsAcquires list of all rule headers in DimLogicRulesets Query
Query individual rulesetGET/rulesets({{rulesetId}})Acquires single rule header in DimLogic based on rulesetIdRuleset Query
Query individual ruleset linesGET/rulesets({{rulesetId}})/ruleDetailsAcquires all rule details associated with rule header referenced by rulesetId
Query individual ruleset individual lineGET/rulesets({{rulesetId}})/ruleDetails({{ruleLineId}})Acquires single rule detail referenced by ruleLineId of rule header rulesetId
Insert rulesetPOST/rulesetsCreates a DimLogic rule complete with lines based on payloadRuleset Query
Modify rule headerPATCH/rulesets({{rulesetId}})Modifies a rule header referenced by rulesetIdRuleset Query
Modify rule detailPATCH/rulesets({{rulesetId}})/ruleDetails({{ruleLineId}})Modifies a rule detail line referenced by ruleLineId for of rule header rulesetId
Remove ruleDELETE/rulesets({{rulesetId}})Deletes the rule referenced by rulesetId204 No Content
Evaluate rulePOSTEvaluation endpoint; parameter company set to url encoded company nameReturns a list of the dimensions to be suggested by DimLogic based on the payload

Examples:

ActionVerbSample
Query rulesetsGEThttps://api.businesscentral.dynamics.com/v2.0/{{tenantId}}/{{environmentName}}/api/evergrowth/dimlogic/v2.0/companies({{companyId}})/rulesets
Query individual rulesetGEThttps://api.businesscentral.dynamics.com/v2.0/{{tenantId}}/{{environmentName}}/api/evergrowth/dimlogic/v2.0/companies({{companyId}})/rulesets(9e55cf42-ad02-f111-8405-0022483bf831)
Query individual ruleset linesGEThttps://api.businesscentral.dynamics.com/v2.0/{{tenantId}}/{{environmentName}}/api/evergrowth/dimlogic/v2.0/companies({{companyId}})/rulesets(e5d66c5e-1905-f111-8405-0022483e7497)/ruleDetails
Insert rulesetPOSThttps://api.businesscentral.dynamics.com/v2.0/{{tenantId}}/{{environmentName}}/api/evergrowth/dimlogic/v2.0/companies({{companyId}})/rulesets
Modify rule headerPATCHhttps://api.businesscentral.dynamics.com/v2.0/{{tenantId}}/{{environmentName}}/api/evergrowth/dimlogic/v2.0/companies({{companyId}})/rulesets(a3a40fc4-2601-f111-8405-7c1e528ce16c)
Module rule detailPATCHhttps://api.businesscentral.dynamics.com/v2.0/{{tenantId}}/{{environmentName}}/api/evergrowth/dimlogic/v2.0/companies({{companyId}})/rulesets(a3a40fc4-2601-f111-8405-7c1e528ce16c)/ruleDetails(a5a40fc4-2601-f111-8405-7c1e528ce16c)
Remove ruleDELETEhttps://api.businesscentral.dynamics.com/v2.0/{{tenantId}}/{{environmentName}}/api/evergrowth/dimlogic/v2.0/companies({{companyId}})/rulesets(264ad0e5-cd03-f111-8405-002248b38831)
Evaluate rulePOSThttps://api.businesscentral.dynamics.com/v2.0/{{tenantId}}/{{environmentName}}/ODataV4/dimlogicActions_Evaluate?company=CRONUS%20Canada%2C%20Inc.

Payloads

Operation Payload(s)

At current time, the only scopes available in dimLogicScope are:

DimLogic Scope Name
All
GeneralJournal
Purchases
Sales

In all cases of “String” data type below, note that Business Central will capitalize the string. (All strings convert to a Business Central datatype of Code[n].)

NameParentDataTypeMaxLengthUsage
ruleIdString20Specifies the rule id. Note that Business Central will capitalize this value.
parentControlDimensionString20Specifies the controlling dimension code.
controllingValueCodeString20Specifies the dimension value that triggers the rule.
dimLogicScopedimLogicScopeN/ASpecifies the scope to which the DimLogic rule applies; see DimLogic scope names above.
ruleDetailsArray of rule objectsN/Ainserts only: this array contains all of the rule lines for a DimLogic ruleset.
dimensionCoderuleDetailsString20Specifies the dimension code of a rule detail.
dimensionValueruleDetailsString20Specifies the dimension value of the code for the rule detail.

An example payload for a deep insert of a new ruleset is as follows:

{
	"ruleId": "RULETWO",
	"parentControlDimension": "AREA",
	"controllingValueCode": "60",
	"dimLogicScope": "All",
	"ruleDetails": [
		{
			"dimensionCode": "BUSINESSGROUP",
			"dimensionValue": "INDUSTRIAL"
		},
		{
			"dimensionCode": "CUSTOMERGROUP",
			"dimensionValue": "SMALL"
		}
	]
}

In order to accomplish an update for rulesets (rule header) the payload example is:

{
	"ruleId": "RULETWO",
	"parentControlDimension": "AREA",
	"controllingValueCode": "60",
	"dimLogicScope": "GeneralJournal"
}

Detail updates for specific rules can be made using this example:

{
    "dimensionValue": "MEDIUM"
}

Operation Response(s)

The operation responses are dictated in large part by Business Central. The resulting JSON objects adhere to Business Central’s return types.

Rulesets Query
NameParentDataTypeUsage
@odata.contextStringBusiness Central provided link to record result
valueArray of ruleHeaderThe actual values of the return
@odata.etagvalueStringThe OData tag of the document; required for interaction with the document
systemIdvalueString (Guid)The Business Central system id assigned to the record
ruleIdvalueString (Code[20])The rule id of the rule header
parentControlDimensionvalueString (Code[20])The trigger (control) dimension of the rule
controllingValueCodevalueString (Code[20])The trigger (control) dimension value of the rule
dimLogicScopevaluedimLogicScopeThe scope of the rule
activevalueBooleanActive flag of the rule
invocationCountvalueIntegerThe number of times that the rule has been executed; read only
versionNovalueIntegerThe version number of the rule; read only
versionTimestampUTCvalueString (DateTime)UTC timestamp of the creation (unused at this time}
modifiedByvalueStringUser name of last modification (unused at this time)
modifiedOnUTCvalueString (DateTime)UTC timestamp of the last modification (unused at this time)

Example

{
    "@odata.context": "https://api.businesscentral.dynamics.com/v2.0/{{tenantId}}/{{environmentName}}/api/evergrowth/dimlogic/v2.0/$metadata#companies({{companyId}})/rulesets",
    "value": [
        {
            "@odata.etag": "W/\"JzIwOzE1MTg3ODk3NjUxOTAyNTAyNzk5MTswMDsn\"",
            "systemId": "9e55cf42-ad02-f111-8405-0022483bf831",
            "ruleId": "RULEONE",
            "parentControlDimension": "AREA",
            "controllingValueCode": "70",
            "dimLogicScope": "All",
            "active": true,
            "invocationCount": 22,
            "versionNo": 0,
            "versionTimestampUTC": "0001-01-01T00:00:00Z",
            "modifiedBy": "",
            "modifiedOnUTC": "0001-01-01T00:00:00Z"
        }
    ]
}
Ruleset Query (singleton)
NameParentDataTypeUsage
@odata.contextStringBusiness Central provided link to record result
@odata.etagStringThe OData tag of the document; required for interaction with the document
systemIdString (Guid)The Business Central system id assigned to the record
ruleIdString (Code[20])The rule id of the rule header
parentControlDimensionString (Code[20])The trigger (control) dimension of the rule
controllingValueCodeString (Code[20])The trigger (control) dimension value of the rule
dimLogicScopedimLogicScopeThe scope of the rule
activeBooleanActive flag of the rule
invocationCountIntegerThe number of times that the rule has been executed; read only
versionNoIntegerThe version number of the rule; read only
versionTimestampUTCString (DateTime)UTC timestamp of the creation (unused at this time}
modifiedByStringUser name of last modification (unused at this time)
modifiedOnUTCString (DateTime)UTC timestamp of the last modification (unused at this time)

Example

{
    "@odata.context": "https://api.businesscentral.dynamics.com/v2.0/{{tenantId}}/{{environmentName}}/api/evergrowth/dimlogic/v2.0/$metadata#companies({{companyId}})/rulesets/$entity",
    "@odata.etag": "W/\"JzIwOzE1MTg3ODk3NjUxOTAyNTAyNzk5MTswMDsn\"",
    "systemId": "9e55cf42-ad02-f111-8405-0022483bf831",
    "ruleId": "RULEONE",
    "parentControlDimension": "AREA",
    "controllingValueCode": "70",
    "dimLogicScope": "All",
    "active": true,
    "invocationCount": 22,
    "versionNo": 0,
    "versionTimestampUTC": "0001-01-01T00:00:00Z",
    "modifiedBy": "",
    "modifiedOnUTC": "0001-01-01T00:00:00Z"
}
Rule lines query
NameParentDataTypeUsage
@odata.contextStringBusiness Central provided link to record result
valueArray of ruleLinesThe actual values of the return
@odata.etagvalueStringThe OData tag of the document; required for interaction with the document
ruleIdvalueString (Guid)The rule header system id of the line
idvalueString (Guid)The rule line system id of the line
headerNovalueString (Code[20])The rule header id of the ruleset for which the line belongs
headerIdvalueString (Guid)The rule header system id of the line (duplication of ruleId above; unavoidable due to the operation of deep inserts)
dimensionCodevalueString (Code[20])The rule line dimension code to be set
dimensionValuevalueString (Code[20])The rule line dimension value to be set
activevalueBooleanIndicates active flag of rule line; currently unused
modifiedByvalueStringName of user who last modified the rule line
modifiedUTCvalueString (DateTime)UTC timestamp of the last modification (unused at this time)

Example

{
    "@odata.context": "https://api.businesscentral.dynamics.com/v2.0/{{tenantId}}/{{environmentName}}/api/evergrowth/dimlogic/v2.0/$metadata#companies({{companyId}})/rulesets({{rulesetId}})/ruleDetails",
    "value": [
        {
            "@odata.etag": "W/\"JzIwOzE2MzcxNjY0NTgyMTQxNDEwMTI3MTswMDsn\"",
            "ruleId": "e6d66c5e-1905-f111-8405-0022483e7497",
            "id": "e6d66c5e-1905-f111-8405-0022483e7497",
            "headerNo": "RULETWO",
            "headerId": "e5d66c5e-1905-f111-8405-0022483e7497",
            "dimensionCode": "BUSINESSGROUP",
            "dimensionValue": "INDUSTRIAL",
            "active": true,
            "modifiedBy": "",
            "modifiedUTC": "0001-01-01T00:00:00Z"
        },
        {
            "@odata.etag": "W/\"JzE5Ozg3MTg4OTkwNTUwNjE2NDk4OTQxOzAwOyc=\"",
            "ruleId": "e7d66c5e-1905-f111-8405-0022483e7497",
            "id": "e7d66c5e-1905-f111-8405-0022483e7497",
            "headerNo": "RULETWO",
            "headerId": "e5d66c5e-1905-f111-8405-0022483e7497",
            "dimensionCode": "CUSTOMERGROUP",
            "dimensionValue": "SMALL",
            "active": true,
            "modifiedBy": "",
            "modifiedUTC": "0001-01-01T00:00:00Z"
        }
    ]
}

Evaluation payload

NameParentDataTypeMaxLengthUsage
dimensionCodeString20Specifies the evaluation dimension code to check.
dimensionValueString20Specifies the evaluation dimension code value to check.
{
    "dimensionCode": "AREA",
    "dimensionValue": "70"
}
Evaluation Response
NameParentDataTypeUsage
odata.contextStringBusiness Central provided link to record result
valueStringJSON encoded data package; this is Business Central’s normal operation for data responses from codeunits
dimensionsvalueArray of evaluationPayloadThis array is contained inside the value as JSON encoded text
dimensionCodevalue.ArrayThis is the dimension code of the response to the evaluation
dimensionValuevalue.ArrayThis is the dimension value of the response to the evaluation

Example

Raw response:

{
    "@odata.context": "https://api.businesscentral.dynamics.com/v2.0/{{tenantId}}/{{environmentName}}/ODataV4/$metadata#Edm.String",
    "value": "{\"dimensions\":[{\"dimensionCode\":\"AREA\",\"dimensionValue\":\"70\"},{\"dimensionCode\":\"BUSINESSGROUP\",\"dimensionValue\":\"INDUSTRIAL\"},{\"dimensionCode\":\"CUSTOMERGROUP\",\"dimensionValue\":\"LARGE\"}]}"
}

Parsed response after extracting coded JSON from value:

{
	"dimensions": [
		{
			"dimensionCode": "AREA",
			"dimensionValue": "70"
		},
		{
			"dimensionCode": "BUSINESSGROUP",
			"dimensionValue": "INDUSTRIAL"
		},
		{
			"dimensionCode": "CUSTOMERGROUP",
			"dimensionValue": "LARGE"
		}
	]
}