- 26 Jun 2023
- 6 Minutes To Read
- Print
- DarkLight
- PDF
Branches Configuration
- Updated On 26 Jun 2023
- 6 Minutes To Read
- Print
- DarkLight
- PDF
A branch in Mambu is the default label for an organization's subdivision. Often branches represent:
- A geographical subdivision of an organization.
- A product line.
- Any other entity that represents a subdivision of an organization.
The terminology branch is the default label used for a subdivision. You can choose to change this label. For more information about changing this label, see Labels. For more information about managing your organization's branches, see Branches and Centres. For the rest of this article we will refer to an organization's subdivision as branch.
With Configuration as Code (CasC), you may batch configure your branches configuration via the API using YAML. For general information on CasC, see Configuration as Code Overview.
API operations
CasC for branches supports two operations.
Action | Endpoint | Description |
---|---|---|
GET | /configuration/branches.yaml | Get current branches configuration. |
PUT | /configuration/branches.yaml | Write a new branches 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/branches.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/branches.yaml' \
-H 'Accept: application/vnd.mambu.v2+yaml' \
-H 'Content-Type: application/yaml' \
-H 'Authorization: Basic {auth}' \
--data-binary @branches.yaml
@branches.yaml
represents the absolute path of the file on your device.
Use “--data-raw” if you want to specify the YAML body inline.
{auth} is the base-64-encoded value of username:password
. For more information, see Authentication in our API reference.
Configuration example
branches:
- id: "2"
name: "Matola City"
state: "ACTIVE"
phoneNumber: "+7534987676"
emailAddress: "matola@BofAlg.es"
notes: "Is currently under construction to add an extra room that can be used for\
\ the meetings.<p></p>Have <b>six new computers</b> for their staff."
address:
line1: "1 Bank Street"
line2: "Old Town"
city: "Matola City"
region: "Matola"
postcode: "10775"
country: "Bankistan"
holidays:
- id: 13
name: "joe matola only day"
dayOfMonth: 26
monthOfYear: 8
year: 2020
isAnnuallyRecurring: true
- id: "demoBranchId"
name: "Maputo Downtown"
state: "ACTIVE"
phoneNumber: "0049302345678"
emailAddress: "petula.clark@downtown.com"
notes: "Is located in the surroundings of the local market with a <i>lot of potential</i>\
\ to reach new clients."
holidays:
- id: 12
name: "only maputo holiday day"
dayOfMonth: 30
monthOfYear: 7
year: 2020
isAnnuallyRecurring: true
customFieldValueSets:
- id: "_branches_grouped_cf_set"
groupedCustomFieldValues:
- index: 0
customFieldValues:
- customFieldId: "cf_group_field_1"
value: "group field 1"
- customFieldId: "cf_group_field_2"
value: "2"
- index: 1
customFieldValues:
- customFieldId: "cf_group_field_2"
value: "500"
- id: "_example_branch_custom_field_set"
standardCustomFieldValues:
- customFieldId: "cf_branch"
value: "TRUE"
General attributes
Name | Type | Description | Required |
---|---|---|---|
id | String | ID for the branch. | Yes |
name | String | Name of the branch. | Yes |
state | String | ACTIVE or INACTIVE | Yes |
phoneNumber | String | Phone number associated with the branch. | No |
emailAddress | String | Email address associated with the branch. | No |
notes | String | Notes for the branch. | No |
address | Address | Address associated with the branch. For a list of fields, see Dependencies. | No |
holidays | Array | List of holidays associated with the branch. For a list of fields, see Dependencies. | No |
customFieldValueSets | List of custom field value sets and associated custom field values. For a list of fields, see Dependencies. | No |
Dependencies
The CasC for branches configuration has three dependencies: address
, holidays
, and customFieldValueSets
.
address
Every branch has one address associated to it with the following fields:
Name | Type | Description | Required |
---|---|---|---|
line1 | String | First line of address. | No |
line2 | String | Second line of address. | No |
city | String | City of address. | No |
region | String | Region of address. | No |
postcode | String | Postcode for address. | No |
country | String | Country of address. | No |
holidays
Every branch has a list of holidays associated to it. Each holiday has the following fields:
Name | Type | Description | Required |
---|---|---|---|
id | Number | ID of holiday. | Yes |
name | String | Name of holiday. | Yes |
dayOfMonth | Number | Day in the month of holiday. | Yes |
monthOfYear | Number | Month in the year of holiday. | Yes |
year | Number | The year of the holiday. | Yes |
isAnnualRecurring | Boolean | Whether the holiday recurs every year. | Yes |
customFieldValueSets
Every branch can have a list of custom field value sets with their associated custom field values. Custom field sets can either be GROUPED
or SINGLE
.
The grouped custom field sets field is represented by an array of array of custom field values. The single custom field set field is represented by an array of custom field values.
Name | Type | Description | Required |
---|---|---|---|
customFieldValueSets | Array | A list of custom field sets and associated custom field values related to the branch. | No |
id | String | ID for grouped custom field set. | Yes |
groupedCustomFieldValues | array | List of groups of custom field definition IDs and custom field values associated to grouped custom field set. | No |
index | Number | Index of group of custom field definition IDs and custom field values in grouped custom field set. | Yes |
customFieldValues | Array | List of custom field definition IDs and custom field values in grouped custom field set. | Yes |
customFieldId | String | ID of a custom field definition in a grouped custom field value set. | Yes |
value | String | Custom field value in a grouped custom field set. | Yes |
id | String | ID for a single custom field set. | Yes |
standardCustomFieldValues | Array | List of custom field definition IDs and custom field values in single custom field set. | No |
customFieldId | String | ID for custom field definition in single custom field set. | Yes |
value | String | Custom field value in single custom field set. | Yes |
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
The Mambu API runs validation to ensure the following:
- Content is correct.
- References are properly mapped and exist in the target system.
- Branches properties are accurate.
Name | Input requirement |
---|---|
id | The ID length must not exceed 32 characters and the ID must be unique. |
name | The name length must not exceed 256 characters. |
emailAddress | The email address must be valid. A valid email address consists of an email prefix before the @ sign and an email domain after the sign. The email prefix must not exceed 64 characters. The email domain must not exceed 63 characters. The email address in total must not exceed 256 characters. |
phoneNumber | The phone number length must not exceed 256 characters. |
address | None of the address fields can exceed 256 characters. |
For information on validation for the holidays fields, see Holidays Configuration.
Warnings
There are three warning messages you can receive when you attempt to update the CasC for branches configuration file.
You cannot deactivate (disable) a branch that has active centres assigned to it. If you do not include a branch that has active centres assigned to it in the YAML file then you will get the following warning message: "Branch [ id -
BRANCH_ID
] could not be deactivated since it has active centre(s)."If a branch does not have any active centres assigned to it and you do not include it in the YAML file then the branch will be deactivated (disabled). You will receive the following warning message: "Branch [ id -
BRANCH_ID
] has been deactivated."If you try to deactivate a branch which is already deactivated then you will receive the following warning message: "Branch [ id -
BRANCH_ID
] could not be deactivated since it is already deactivated."