Add Comment
Add a comment to any banking entity (Client, Loan, Deposit, or Policy) using a single unified command.
Command Nameโ
AddCommentCommand
Endpointโ
POST /api/core/cmd
Request Parametersโ
| Parameter | Type | Required | Description |
|---|---|---|---|
entity | string | Yes | Entity type: "Client", "Loan", "Deposit", or "Policy" |
entityId | long | No* | Entity database ID |
encodedKey | string | No* | Entity encoded key or account number |
comment | string | Yes | Comment text |
* Either entityId or encodedKey must be provided.
Request Example - Using Entity IDโ
{
"Cmd": "AddCommentCommand",
"Data": {
"entity": "Loan",
"entityId": 12345,
"comment": "Loan application approved by credit committee. Disbursement scheduled for 2025-12-30."
}
}
Request Example - Using Encoded Keyโ
{
"Cmd": "AddCommentCommand",
"Data": {
"entity": "Client",
"encodedKey": "CLIENT-12345",
"comment": "Customer called to inquire about savings account interest rates. Provided product brochure via email."
}
}
Response Structureโ
Success Response - Loan Commentโ
{
"IsSuccessful": true,
"StatusCode": "00",
"Message": "Comment added successfully.",
"Data": {
"commentId": 5001,
"loanId": 12345,
"loanEncodedKey": "LOAN-67890",
"accountNumber": "ACC-001-12345",
"timestamp": "2025-12-24T15:30:00Z"
}
}
Success Response - Client Commentโ
{
"IsSuccessful": true,
"StatusCode": "00",
"Message": "Comment added successfully.",
"Data": {
"commentId": 5002,
"clientId": 12345,
"clientEncodedKey": "CLIENT-67890",
"timestamp": "2025-12-24T15:30:00Z"
}
}
Success Response - Deposit Commentโ
{
"IsSuccessful": true,
"StatusCode": "00",
"Message": "Comment added successfully.",
"Data": {
"commentId": 5003,
"depositId": 12345,
"depositEncodedKey": "DEP-67890",
"accountNumber": "DEP-001-12345",
"timestamp": "2025-12-24T15:30:00Z"
}
}
Success Response - Policy Commentโ
{
"IsSuccessful": true,
"StatusCode": "00",
"Message": "Comment added successfully.",
"Data": {
"commentId": 5004,
"policyId": 12345,
"policyEncodedKey": "POL-67890",
"policyNumber": "INS-001-12345",
"timestamp": "2025-12-24T15:30:00Z"
}
}
Error Responsesโ
Missing Entity Typeโ
{
"IsSuccessful": false,
"StatusCode": "96",
"Message": "Entity type is required."
}
Missing Comment Textโ
{
"IsSuccessful": false,
"StatusCode": "96",
"Message": "Comment text is required."
}
Invalid Entity Typeโ
{
"IsSuccessful": false,
"StatusCode": "96",
"Message": "Invalid entity specified. Valid values are: Client, Loan, Deposit, Policy."
}
Entity Not Foundโ
{
"IsSuccessful": false,
"StatusCode": "96",
"Message": "Loan account not found."
}
Missing Identifierโ
{
"IsSuccessful": false,
"StatusCode": "96",
"Message": "Either entityId or encodedKey is required."
}
Code Examplesโ
C# Exampleโ
Code Removed
Implementation details removed for security.
Contact support for implementation guidance.
JavaScript/TypeScript Exampleโ
interface AddCommentRequest {
entity: 'Client' | 'Loan' | 'Deposit' | 'Policy';
entityId?: number;
encodedKey?: string;
comment: string;
}
async function addComment(request: AddCommentRequest) {
const response = await fetch('/api/core/cmd', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
},
body: JSON.stringify({
Cmd: 'AddCommentCommand',
Data: request
})
});
const result = await response.json();
if (result.IsSuccessful) {
console.log('Comment added:', result.Data.commentId);
} else {
console.error('Error:', result.Message);
}
return result;
}
// Usage - Add loan comment by ID
await addComment({
entity: 'Loan',
entityId: 12345,
comment: 'Disbursement completed successfully.'
});
// Usage - Add client comment by encoded key
await addComment({
entity: 'Client',
encodedKey: 'CLIENT-12345',
comment: 'Customer requested account statement.'
});
Python Exampleโ
import requests
import json
def add_comment(entity: str, comment: str, entity_id: int = None, encoded_key: str = None):
"""Add a comment to any entity."""
url = "https://api.banklingo.com/api/core/cmd"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {token}"
}
data = {
"Cmd": "AddCommentCommand",
"Data": {
"entity": entity,
"comment": comment
}
}
if entity_id:
data["Data"]["entityId"] = entity_id
elif encoded_key:
data["Data"]["encodedKey"] = encoded_key
else:
raise ValueError("Either entity_id or encoded_key must be provided")
response = requests.post(url, headers=headers, json=data)
result = response.json()
if result["IsSuccessful"]:
print(f"Comment added: {result['Data']['commentId']}")
else:
print(f"Error: {result['Message']}")
return result
# Usage
add_comment("Loan", "Loan approved", entity_id=12345)
Use Casesโ
Loan Processingโ
{
"Cmd": "AddCommentCommand",
"Data": {
"entity": "Loan",
"entityId": 12345,
"comment": "Credit committee approved loan of รขโยฆ5,000,000 at 12% interest rate for 24 months. Collateral: Property at 123 Main St valued at รขโยฆ8,000,000. DTI: 35%. Credit score: 750."
}
}
Customer Serviceโ
{
"Cmd": "AddCommentCommand",
"Data": {
"entity": "Client",
"encodedKey": "CLIENT-67890",
"comment": "Customer called regarding unauthorized transaction on 2025-12-20. Case escalated to fraud department. Ref: FRAUD-2025-001. Customer provided transaction details and filed dispute form."
}
}
Deposit Managementโ
{
"Cmd": "AddCommentCommand",
"Data": {
"entity": "Deposit",
"entityId": 54321,
"comment": "Fixed deposit matured on 2025-12-24. Principal รขโยฆ1,000,000 + Interest รขโยฆ120,000 = Total รขโยฆ1,120,000. Customer opted for renewal at 11% for 12 months."
}
}
Insurance Policyโ
{
"Cmd": "AddCommentCommand",
"Data": {
"entity": "Policy",
"encodedKey": "POL-99999",
"comment": "Premium payment of รขโยฆ50,000 received via bank transfer. Policy now active until 2026-12-24. Beneficiary updated to spouse per customer request."
}
}
Validation Rulesโ
- Entity: Must be one of: "Client", "Loan", "Deposit", "Policy" (case-sensitive)
- EntityId or EncodedKey: At least one must be provided
- Comment: Required, cannot be empty or whitespace only
- Comment Length: Maximum length varies by entity (typically 1000-5000 characters)
Automatic Fieldsโ
The following fields are automatically populated from the authenticated user context:
- UserName: Current user's username (from JWT token)
- UserEncodedKey: Current user's encoded key
- TimeStamp: Current UTC timestamp
Best Practicesโ
- Use entityId when available: More efficient than encoded key lookup
- Provide meaningful comments: Include context, decisions, and actions taken
- Include relevant details: Reference numbers, amounts, dates when applicable
- Standardize format: Use consistent formatting for similar comment types
- Error handling: Always check
IsSuccessfulbefore processing response
Related Commandsโ
- Retrieve Comments List - Query comments with filters
- Retrieve Client Comments - Get client-specific comments
- Retrieve Loan Comments - Get loan-specific comments
- Retrieve Deposit Comments - Get deposit-specific comments
- Retrieve Policy Comments - Get policy-specific comments