- 03 May 2023
- 3 Minutes To Read
- Print
- DarkLight
- PDF
Accounting Rules Configuration
- Updated On 03 May 2023
- 3 Minutes To Read
- Print
- DarkLight
- PDF
Accounting rules can be set up to automate closures and manage transactions affecting General Ledger balances across different branches. Configuration as Code allows batch configuration of accounting rules using YAML via the API. API Operations for Configuration as Code support GET and PUT requests, with authentication and required headers. Validation checks ensure correct syntax and content in uploaded files. If a 200 OK status code is not received, fix validation errors and retry the PUT request. The process ensures adherence to YAML standards and template requirements.
Accounting rules allows you to create general rules for your accounts such as setting automatic accounting closures that recur on a regular basis and defining rules for how to handle any transactions that affect General Ledger (GL) balances in two different branches. For more information about these types of rules, see inter-branch transfer rules.
With Configuration as Code (CasC), you may batch configure your accounting rules configuration via the API using YAML. For general information on CasC, see Configuration as Code Overview.
API Operations
CasC for accounting rules supports two operations.
Action | Endpoint | Description |
---|---|---|
GET | /configuration/accountingrules.yaml | Get current accounting rules configuration. |
PUT | /configuration/accountingrules.yaml | Write a new accounting rules configuration to Mambu. |
If you PUT
a configuration to Mambu, any current configuration settings not included in the new YAML configuration will be deleted. PATCH
requests are not currently supported.
Requests
For general information on CasC requests such as authentication and required headers, see Configuration as Code Overview.
The following section shows sample requests using curl and basic authentication. For all examples, replace TENANT_NAME
with your actual tenant name.
GET configuration
curl -X GET 'https://TENANT_NAME.mambu.com/api/configuration/accountingrules.yaml' \
-H 'Accept: application/vnd.mambu.v2+yaml' \
-H 'Authorization: Basic {auth}'
{auth} is the base-64-encoded value of username:password
. For more information, see Authentication in our API reference.
PUT configuration
curl -X PUT 'https://TENANT_NAME.mambu.com/api/configuration/accountingrules.yaml' \
-H 'Accept: application/vnd.mambu.v2+yaml' \
-H 'Content-Type: application/yaml' \
-H 'Authorization: Basic {auth}' \
--data-binary @accountingrules.yaml
{auth} is the base-64-encoded value of username:password
. For more information, see Authentication in our API reference.
“@accountingrules.yaml” represents the absolute path of the file on your device.
(Use “--data-raw” if you want to specify the YAML body inline).
Configuration body example
---
defaultGlCode: "defaultGlAccountCode"
automatedAccountingClosuresInterval: 7
customRules:
- id: "ruleId1"
leftBranchId: "branchId1"
rightBranchId: "branchId2"
glCode: "glCode1"
- id: "ruleId2"
leftBranchId: "branchId3"
rightBranchId: "branchId1"
glCode: "glCode2"
Attributes
Name | Type | Description | Required |
---|---|---|---|
defaultGlCode | String | Default GL account code. | ✔ |
automatedAccountingClosuresInterval | Number | Number of days between the execution of automated accounting closures. If this number is zero, no automated closure is performed. | ✔ |
customRules | List | Custom rules in which new accounting rules can be added between branches. | ✘ |
id | String | User-defined unique ID. Rules are ordered by ID in the YAML file. | ✔ |
rightBranchId | String | ID of the right branch of the rule. | ✔ |
leftBranchId | String | ID of the left branch of the rule. | ✔ |
glCode | String | The unique identifier of the account that is mapped to the financial resource. | ✔ |
Replies
If you do not receive a 200 OK
status code then fix any validation errors and make another PUT
request until you receive a 200 OK
status code.
If you PUT
a valid YAML configuration to the API and you do not receive a 200 OK
status code within 60 seconds, you may receive a 504 Gateway Timeout
status code. We expect all responses to be below 60 seconds.
If you encounter this issue, please contact us through Mambu Support so we can investigate it.
Validations
With all use cases, a validation of the uploaded file will be done, ensuring the following:
- Syntax is correct as per YAML standards and the template for holidays.
- Minimum requirements indicates the line with the syntax error.
- Content is correct.
Name | Validation |
---|---|
defaultGlCode | Can be null. If it is not null, it must be for an existing GL account that is in the organization's base currency. |
automatedAccountingClosuresInterval | Must be a non-negative whole number. Can be null or empty, in which case it will be considered zero. |
id | Required, must not exceed 32 characters in length, must be unique in the configuration. |
leftBranchId | Must be the ID of an existing branch, can’t be the same as rightBranchId . If empty, the rule will apply for “All Branches“, if that is a valid case in the configuration. |
rightBranchId | Must be the ID of an existing branch, can’t be same as leftBranchId . If empty, the rule will apply for “All Branches“ if that is a valid case in the configuration. |
glCode | Must be the GL Code of an existing GL account. |