BillableFeatureRpc
This endpoint group provides JSON-RPC methods for creating, updating, archiving, retrieving, and listing billable features. It also exposes a field-value lookup helper intended for reference fields in DataForm.
Endpoints
POST /api/rpc (Method: BillableFeatureRpc.create)
This method creates a new billable feature template.
Request Body:
{ "method": "BillableFeatureRpc.create", "params": { // fields defined by `BillableFeatureSchema` except `_id`, `createdAt`, and `updatedAt` } }Parameters:
Name Type Required Description paramsObjectYes Request payload validated against BillableFeatureSchemawith_id,createdAt, andupdatedAtomitted. The exact field structure is defined by the imported schema and was not inspected here.Response:
{ "success": true, "data": { // return value from `BillableFeatureService.createFeature(data)` } }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "BillableFeatureRpc.create", "params": { "...": "..." } }'
POST /api/rpc (Method: BillableFeatureRpc.update)
This method updates an existing billable feature.
Request Body:
{ "method": "BillableFeatureRpc.update", "params": { "_id": "string", // any additional fields allowed by `BillableFeatureSchema.partial()` } }Parameters:
Name Type Required Description _idStringYes Identifier of the billable feature to update. paramsObjectYes Partial billable feature data merged into the update payload and validated by BillableFeatureSchema.partial().extend({ _id: z.string() }). The remaining editable fields were not inspected from the imported schema.Response:
{ "success": true, "data": { // return value from `BillableFeatureService.updateFeature(_id, updates)` } }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "BillableFeatureRpc.update", "params": { "_id": "FEATURE_ID", "...": "..." } }'
POST /api/rpc (Method: BillableFeatureRpc.delete)
This method archives a billable feature and returns a confirmation message.
Request Body:
{ "method": "BillableFeatureRpc.delete", "params": { "_id": "string" } }Parameters:
Name Type Required Description _idStringYes Identifier of the billable feature to archive. Response:
{ "success": true, "data": { "success": true, "message": "Feature archived." } }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "BillableFeatureRpc.delete", "params": { "_id": "FEATURE_ID" } }'
POST /api/rpc (Method: BillableFeatureRpc.findById)
This method retrieves a single billable feature by its ID.
Request Body:
{ "method": "BillableFeatureRpc.findById", "params": { "_id": "string" } }Parameters:
Name Type Required Description _idStringYes Identifier of the billable feature to retrieve. Response:
{ "success": true, "data": { // return value from `BillableFeatureService.getFeatureById(_id)` } }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "BillableFeatureRpc.findById", "params": { "_id": "FEATURE_ID" } }'
POST /api/rpc (Method: BillableFeatureRpc.getData)
This method lists active billable features with pagination and sorting options.
Request Body:
{ "method": "BillableFeatureRpc.getData", "params": { "filter": {}, "sort": {}, "page": 1, "pageSize": 20 } }Parameters:
Name Type Required Description filterAnyYes Filter object passed through to BillableFeatureService.listFeatures(...). The accepted shape was not inspected.sortAnyYes Sort configuration passed through to BillableFeatureService.listFeatures(...). The accepted shape was not inspected.pageNumberYes Page number. Used to calculate the skip value as (page - 1) * pageSize.pageSizeNumberYes Number of records per page. Used as the limitvalue.Response:
{ "success": true, "data": { // return value from `BillableFeatureService.listFeatures(filter, options)` } }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "BillableFeatureRpc.getData", "params": { "filter": {}, "sort": {}, "page": 1, "pageSize": 20 } }'
POST /api/rpc (Method: BillableFeatureRpc.getFieldValues)
This method provides a list of billable features formatted for reference fields in DataForm.
Request Body:
{ "method": "BillableFeatureRpc.getFieldValues", "params": { "fieldName": "string", "reference": { "valueField": "string", "displayField": "string", "filter": {} } } }Parameters:
Name Type Required Description fieldNameStringYes Name of the field requesting reference values. The method accepts it but does not use it in the shown implementation. referenceObjectYes Reference configuration used to map feature records into { value, label }pairs.reference.valueFieldStringYes Property name used as the returned value.reference.displayFieldStringYes Property name used as the returned label.reference.filterObjectNo Optional filter passed to BillableFeatureService.listFeatures(...). If omitted, an empty object is used.Response:
{ "success": true, "data": [ { "value": "string", "label": "string" } ] }Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \ -H "Content-Type: application/json" \ -d '{ "method": "BillableFeatureRpc.getFieldValues", "params": { "fieldName": "featureId", "reference": { "valueField": "_id", "displayField": "name", "filter": {} } } }'