Update Branch
Overview
Update an existing branch's information including contact details and address.
Command Details
Command Name: UpdateBranchCommand
Operation Type: Command (Write Operation)
Use Cases
- Branch Information Updates: Modify branch details
- Contact Information Changes: Update phone numbers and email addresses
- Address Updates: Correct or update branch physical address
- Branch Rebranding: Update branch names or codes
API Endpoint
POST /api/bpm/cmd
Content-Type: application/json
Authorization: Bearer {access_token}
Request Structure
Request Body
{
"commandName": "UpdateBranchCommand",
"data": {
"id": 123,
"key": "BR001",
"name": "Main Branch - Updated",
"contactInformation": {
"emailAddress": "mainbranch.updated@bank.com",
"mobileNumber": "+234-123-456-7890"
},
"addressInformation": {
"addressLine1": "123 Main Street",
"addressLine2": "Suite 200",
"addressCity": "Lagos",
"addressState": "Lagos State",
"addressCountry": "Nigeria",
"zipCode": "100001"
}
}
}
Request Fields
| Field Name | Type | Mandatory | Description |
|---|---|---|---|
id | Integer | Yes | Branch ID to update |
key | String | Yes | Branch code/identifier |
name | String | Yes | Branch name |
contactInformation | Object | Yes | Branch contact details |
contactInformation.emailAddress | String | Yes | Branch email address |
contactInformation.mobileNumber | String | Yes | Branch phone number |
addressInformation | Object | Yes | Branch physical address |
addressInformation.addressLine1 | String | Yes | Primary address line |
addressInformation.addressLine2 | String | No | Secondary address line |
addressInformation.addressCity | String | Yes | City name |
addressInformation.addressState | String | Yes | State/Province |
addressInformation.addressCountry | String | Yes | Country name |
addressInformation.zipCode | String | Yes | Postal/ZIP code |
Sample Requests
1. Update Branch Contact Information
{
"commandName": "UpdateBranchCommand",
"data": {
"id": 123,
"key": "BR001",
"name": "Main Branch",
"contactInformation": {
"emailAddress": "mainbranch.new@bank.com",
"mobileNumber": "+234-111-222-3333"
},
"addressInformation": {
"addressLine1": "123 Main Street",
"addressCity": "Lagos",
"addressState": "Lagos State",
"addressCountry": "Nigeria",
"zipCode": "100001"
}
}
}
2. Update Branch Address
{
"commandName": "UpdateBranchCommand",
"data": {
"id": 456,
"key": "BR-LAGOS-002",
"name": "Victoria Island Branch",
"contactInformation": {
"emailAddress": "vi@bank.com",
"mobileNumber": "+234-987-654-3210"
},
"addressInformation": {
"addressLine1": "789 New Location Street",
"addressLine2": "Floor 5",
"addressCity": "Lagos",
"addressState": "Lagos State",
"addressCountry": "Nigeria",
"zipCode": "101001"
}
}
}
Response Structure
Success Response
{
"isSuccessful": true,
"statusCode": "00",
"message": "Branch has been updated successfully.",
"data": {
"id": 123,
"name": "Main Branch - Updated",
"key": "BR001",
"encodedKey": "8a8e87e87d1234567890abcd",
"objectState": 0,
"objectStateDescription": "Active"
}
}
Response Fields
| Field Name | Type | Description |
|---|---|---|
id | Integer | Branch ID |
name | String | Updated branch name |
key | String | Branch code |
encodedKey | String | Unique encoded identifier |
objectState | Integer | Branch state (see ObjectStateEnum below) |
objectStateDescription | String | Human-readable state description |
Enumerations
ObjectStateEnum
| Value | Name | Description |
|---|---|---|
| 0 | Active | Branch is active and operational |
| 1 | NotActive | Branch is not active |
| 2 | Deleted | Branch has been deleted |
Error Handling
Common Error Responses
Branch Not Found
{
"isSuccessful": false,
"statusCode": "CBS_404",
"message": "Branch with ID 123 not found."
}
Validation Errors
{
"isSuccessful": false,
"statusCode": "CBS_400",
"message": "Validation failed.",
"errors": {
"id": ["Branch ID is required."],
"key": ["Branch code is required."],
"contactInformation.emailAddress": ["Valid email address is required."]
}
}
Error Codes
| Status Code | Message | Cause |
|---|---|---|
CBS_400 | Validation failed | Missing or invalid required fields |
CBS_401 | Unauthorized | Invalid authentication token |
CBS_403 | Forbidden | Insufficient permissions |
CBS_404 | Branch not found | Invalid branch ID |
CBS_500 | Internal server error | System error |
Code Examples
cURL
curl -X POST https://api.example.com/api/bpm/cmd \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-d '{
"commandName": "UpdateBranchCommand",
"data": {
"id": 123,
"key": "BR001",
"name": "Main Branch - Updated",
"contactInformation": {
"emailAddress": "mainbranch.new@bank.com",
"mobileNumber": "+234-123-456-7890"
},
"addressInformation": {
"addressLine1": "123 Main Street",
"addressCity": "Lagos",
"addressState": "Lagos State",
"addressCountry": "Nigeria",
"zipCode": "100001"
}
}
}'
C# Example
var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", accessToken);
var request = new
{
commandName = "UpdateBranchCommand",
data = new
{
id = 123,
key = "BR001",
name = "Main Branch - Updated",
contactInformation = new
{
emailAddress = "mainbranch.new@bank.com",
mobileNumber = "+234-123-456-7890"
},
addressInformation = new
{
addressLine1 = "123 Main Street",
addressCity = "Lagos",
addressState = "Lagos State",
addressCountry = "Nigeria",
zipCode = "100001"
}
}
};
var response = await client.PostAsJsonAsync(
"https://api.example.com/api/bpm/cmd",
request
);
var result = await response.Content.ReadFromJsonAsync<ApiResponse>();
JavaScript/TypeScript Example
const response = await fetch('https://api.example.com/api/bpm/cmd', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${accessToken}`
},
body: JSON.stringify({
commandName: 'UpdateBranchCommand',
data: {
id: 123,
key: 'BR001',
name: 'Main Branch - Updated',
contactInformation: {
emailAddress: 'mainbranch.new@bank.com',
mobileNumber: '+234-123-456-7890'
},
addressInformation: {
addressLine1: '123 Main Street',
addressCity: 'Lagos',
addressState: 'Lagos State',
addressCountry: 'Nigeria',
zipCode: '100001'
}
}
})
});
const result = await response.json();
Best Practices
- Verify Branch ID: Ensure the branch ID exists before updating
- Complete Updates: Always provide all required fields even if not changing
- Validation: Validate contact information before submission
- Concurrency: Handle concurrent updates appropriately
- Audit Trail: Log all branch updates for compliance
Related Commands
- Create Branch - Create new branch
- Retrieve Branch By ID - Get current branch details
- Retrieve Branch List - Query branches
Handler: AdministrationBranchCommandHandlers