[!info] Overview The RecipientGroup REST API manages recipient groups (supplier groups) in the pkbillms billing system. Recipient groups organize payment recipients into logical collections for easier management and categorization.
📋 Table of Contents
Quick Reference
[!abstract] API Configuration
Entity Name: pkbillmsRecipientGroup
Controller: RecipientGroupResource
Framework: Spring Boot + JHipster
Auth: Required (Spring Security)
Content-Type: application/json
Endpoints Summary
Method
Endpoint
Description
Status
Create new recipient group
/api/recipient-groups/{id}
/api/recipient-groups/{id}
/api/recipient-groups/{id}
/api/recipient-groups/count
/api/recipient-groups/{id}
RecipientGroup DTO Structure
[!note] Data Transfer Object Represents a group of payment recipients with organizational metadata.
Field Specifications
Field
Type
Required
Max/Range
DB Column
Description
Audit Fields (Inherited)
[!success] Auto-managed These fields are automatically populated by the system.
Create RecipientGroup
POST /api/recipient-groups
Creates a new recipient group entity.
Headers:
Body:
[!warning] Validation Rules
id must be null (auto-generated)
name is required (max 64 characters)
recipients is required (must contain at least one recipient)
Recipients must exist in the database
✅ Success (201 Created):
❌ Error (400 - ID exists):
Update RecipientGroup
PUT /api/recipient-groups/{id}
Completely updates an existing recipient group.
Path Parameters
id (Long) - RecipientGroup identifier
Headers:
Body:
[!warning] Validation
Path id must match body id
RecipientGroup must exist in database
All recipients must exist in database
✅ Success (200 OK):
❌ Errors:
PATCH /api/recipient-groups/{id}
Updates only specified fields. Null fields are ignored.
Path Parameters
id (Long) - RecipientGroup identifier
Headers:
Body (Example - deactivate group):
Body (Example - update name and additional info):
[!tip] Partial Update Behavior
Only non-null fields are updated
Other fields remain unchanged
Perfect for status toggles or single field updates
Recipients can be updated without changing other fields
✅ Success (200 OK):
Get All RecipientGroups
GET /api/recipient-groups
Retrieves paginated list with filtering criteria.
Query Parameters
Pagination:
page - Page number (0-indexed, default: 0)
size - Items per page (default: 20)
sort - Sort criteria (e.g., name,asc)
unPaged - Boolean for unpaged results
Filters (RecipientGroupCriteria):
name.contains, name.equals
active.equals - Filter by status
recipientId.equals, recipientId.in - Filter by recipient
Example Requests
✅ Success (200 OK):
Get Single RecipientGroup
GET /api/recipient-groups/{id}
Retrieves a single recipient group by ID with all relationships.
Path Parameters
id (Long) - RecipientGroup identifier
✅ Success (200 OK):
❌ Error (404 Not Found):
Count RecipientGroups
GET /api/recipient-groups/count
Returns count of recipient groups matching criteria.
Query Parameters
Same filtering parameters as [[#Get All RecipientGroups]]
Example Requests
✅ Success (200 OK):
Delete RecipientGroup
DELETE /api/recipient-groups/{id}
Deletes a recipient group from the database.
Path Parameters
id (Long) - RecipientGroup identifier
✅ Success (204 No Content):
[!warning] Delete Behavior
Removes the recipient group entity
Removes many-to-many relationships with recipients
Does not delete the recipients themselves
Recipients remain available for other groups
Example 1: Create Group for Utility Providers
Setup Utility Providers Group Request:
Example 2: Update Group with New Recipients
Add Recipients to Existing Group Request:
Example 3: Deactivate Group
Temporarily Deactivate Group Request:
Response:
Example 4: Get Active Groups Only
Filter Active Groups Request:
Response:
Example 5: Search Groups by Name
Find Groups Containing "Mobile" Request:
[!failure] RFC 7807 Problem Details All errors follow standardized format.
HTTP Status Codes
Code
Type
Description
Common Causes
Validation failure, ID mismatch, null required fields
Invalid ID, deleted entity
Duplicate name (if enforced)
Database error, exception
Validation Error Example
[!bug] Field Validation Errors
Validation Rules
Required Fields
[!check] Mandatory Fields
✅ recipients - At least one recipient
Field Constraints
"A new recipientGroup cannot already have an ID"
"must not be null", "size must be between 0 and 64"
"must not be null", "must not be empty"
[!info] Business Validation
name should be descriptive and unique (recommended)
At least one recipient must be associated with the group
Recipients must exist in the database before association
Inactive groups may still maintain recipient associations
Many-to-many relationship allows recipients to belong to multiple groups
Security & Authentication
[!abstract] Access Control
The RecipientGroup API requires proper authentication and authorization:
Required Permissions:
CREATE - Create new recipient groups
UPDATE - Modify existing groups
READ - View groups and their details
Many-to-Many Relationship
[!info] Recipient Association
RecipientGroups use a many-to-many relationship with Recipients:
Join Table: rel_recipient_group__recipient
Foreign key to recipient_group
Characteristics:
One recipient can belong to multiple groups
One group can contain multiple recipients
Deleting a group removes associations but not recipients
Deleting a recipient removes it from all groups
Active Status Management
[!tip] Group Lifecycle
Groups can be activated or deactivated:
Best Practices:
[!note] Flexible Metadata
The more field provides flexibility for additional data:
Use Cases:
Detailed group descriptions
Business rules or criteria
JSON-formatted metadata (if needed)
Example:
🔧 cURL Command Reference
[!success] Key Features
Simple CRUD operations for group management
Flexible many-to-many recipient associations
Active/inactive status for lifecycle management
Pagination and filtering support
Full audit trail (created/modified by/date)
[!tip] Best Practices
Use descriptive group names
Leverage the more field for additional context
Deactivate instead of delete for data retention
Regularly review and update group memberships
Use pagination for large result sets
[!warning] Important Considerations
Deleting a group does not delete associated recipients
Recipients can belong to multiple groups simultaneously
All recipient IDs must exist before group creation/update
Group names should be unique for clarity (though not enforced by DB)