Field

[!info] Overview The Field REST API manages dynamic form field configurations for payment recipients in the pkbillms billing system. Fields define UI input controls with validation rules, dependencies, and multilingual support for payment forms.

📋 Table of Contents


Quick Reference

[!abstract] API Configuration

  • Base URL: /api

  • Entity Name: Field

  • Controller: FieldResource

  • Framework: Spring Boot + JHipster

  • Auth: Required (Spring Security)

  • Content-Type: application/json

Endpoints Summary

Method
Endpoint
Description
Status

POST

/api/fields

Create new field

201

PUT

/api/fields/{id}

Full update

200

PATCH

/api/fields/{id}

Partial update

200

GET

/api/fields

Get all with pagination

200

GET

/api/fields/criteria

Get by criteria

200

GET

/api/fields/{id}

Get by ID

200

GET

/api/fields/byRecipient/{id}

Get by recipient

200

GET

/api/fields/count

Count by criteria

200

DELETE

/api/fields/{id}

Delete field

204

DELETE

/api/fields/cascaded/{id}

Cascaded delete

200


Data Models

Field Specifications

Field
Type
Required
Max/Range
DB Column
Description

id

Long

❌ Auto

-

id

Primary key

name

String

64

name

Field name

extId

Long

-

ext_id

External ID

type

FieldType

ENUM

type

Field type

controlType

ControlType

ENUM

control_type

UI control type

content

String

-

content

Content type

validation

String

128

validation

Regex pattern

placeholder

String

128

placeholder

Input placeholder

mask

String

256

mask

Input mask

maskSymbol

String

2

mask_symbol

Mask symbol

lengthMin

Integer

0-256

length_min

Min length

lengthMax

Integer

0-256

length_max

Max length

requireField

String

64

require_field

Parent field dependency

filterBy

String

16

filter_by

Filter by field

optional

Boolean

-

optional

Optional field

output

Boolean

-

output

Send to server

visibility

Visibility

ENUM

visibility

Visibility state

ord

Integer

-

ord

Display order

canBeUsedInSearch

Boolean

-

can_be_used_in_search

Search enabled

requestType

RequestType

ENUM

request_type

Request type

recipient

RecipientDTO

-

recipient_id

Recipient reference

titles

Set

-

rel_field__title

Multilingual titles

descriptions

Set

-

rel_field__description

Multilingual descriptions

values

Set

-

field_value

Predefined values

prefixes

Set

-

prefix

Phone/account prefixes

FieldType Enum

ControlType Enum

Visibility Enum

RequestType Enum

API Endpoints

Create Field

POST /api/fields

Creates a new field configuration.

Request

Headers:

Body:

[!warning] Validation Rules

  • id must be null (auto-generated)

  • name, extId, type, controlType are required

  • String fields must respect max length constraints

  • validation must be valid Java regex pattern

Response

✅ Success (201 Created):

❌ Error (400 - ID exists):


Update Field

[!example] PUT /api/fields/{id} Updates an existing field (full update).

Request

Headers:

Body:

[!warning] Validation Rules

  • id must match path parameter

  • id must not be null

  • Field must exist in database

Response

✅ Success (200 OK):

❌ Error (400 - Invalid ID):

❌ Error (400 - Not found):


Partial Update

[!example] PATCH /api/fields/{id} Partially updates field properties.

Request

Headers:

Body:

Response

✅ Success (200 OK):


Get All Fields

[!example] GET /api/fields Retrieves all fields with pagination and filtering.

Request

Headers:

Query Parameters:

Parameter
Type
Required
Description

page

Integer

Page number (default: 0)

size

Integer

Page size (default: 20)

sort

String

Sort field and direction

Example:

Response

✅ Success (200 OK):


FieldCriteria - Advanced Filtering

[!abstract] JHipster Criteria Filtering FieldCriteria provides powerful filtering capabilities for querying fields. All filter parameters support multiple operators for precise data retrieval.

Available Filter Types

String Filters:

Operator
Description
Example

equals

Exact match

name.equals=phone_number

notEquals

Not equal

name.notEquals=account

in

Match any value

name.in=phone,email,login

notIn

Not in list

name.notIn=hidden,temp

contains

Partial match

name.contains=phone

doesNotContain

Doesn't contain

name.doesNotContain=test

specified

Field exists/null

validation.specified=true

Numeric Filters (Long, Integer):

Operator
Description
Example

equals

Exact match

id.equals=5

notEquals

Not equal

extId.notEquals=1000

in

Match any value

id.in=1,2,3,4,5

notIn

Not in list

id.notIn=99,100

greaterThan

Greater than

ord.greaterThan=5

lessThan

Less than

ord.lessThan=10

greaterOrEqualThan

Greater or equal

lengthMin.greaterOrEqualThan=10

lessOrEqualThan

Less or equal

lengthMax.lessOrEqualThan=50

specified

Field exists/null

ord.specified=true

Boolean Filters:

Operator
Description
Example

equals

Exact match

optional.equals=true

notEquals

Not equal

output.notEquals=false

specified

Field exists/null

optional.specified=true

Enum Filters (FieldType, ControlType, Visibility, RequestType):

Operator
Description
Example

equals

Exact match

type.equals=TEXT

notEquals

Not equal

type.notEquals=SELECT

in

Match any value

type.in=TEXT,SELECT,DATE

notIn

Not in list

visibility.notIn=HIDDEN

specified

Field exists/null

requestType.specified=true

Get Fields by Criteria

[!example] GET /api/fields/criteria Retrieves fields filtered by recipient short name.

FieldCriteria Parameters

Common Query Examples

Filter by Recipient:

Filter by Multiple Types:

Filter Required Fields for PAY:

Filter with Validation Pattern:

Range Filter:

Search by Name:

Visible Fields Only:

Fields with Values:

Complex Filter (AND operation):

Combining Filters

[!tip] Multiple Criteria All criteria are combined with AND logic. Use .in operator for OR logic on same field.

Example:


Request

Headers:

Example:

Response

✅ Success (200 OK):


Get Single Field

[!example] GET /api/fields/{id} Retrieves a single field by ID.

Request

Headers:

Example:

Response

✅ Success (200 OK):

❌ Error (404 - Not found):


Get Fields by Recipient

[!example] GET /api/fields/byRecipient/{id} Retrieves all fields for a specific recipient.

Request

Headers:

Example:

Response

✅ Success (200 OK):


Count Fields

[!example] GET /api/fields/count Counts fields matching criteria.

Request

Headers:

Query Parameters:

Parameter
Type
Required
Description

recipientId

Long

Filter by recipient

requestType

String

Filter by type

Example:

Response

✅ Success (200 OK):


Delete Field

[!example] DELETE /api/fields/{id} Deletes a field.

Request

Headers:

Example:

Response

✅ Success (204 No Content):


Cascaded Delete Field

[!example] DELETE /api/fields/cascaded/{id} Deletes a field with all related entities (values, prefixes).

Request

Headers:

Example:

Response

✅ Success (200 OK):


Error Handling

Error Response Format

HTTP Status Codes

Code
Description
When

200

OK

Successful GET/PUT/PATCH

201

Created

Successful POST

204

No Content

Successful DELETE

400

Bad Request

Validation error

401

Unauthorized

Missing/invalid authentication

403

Forbidden

Insufficient permissions

404

Not Found

Resource doesn't exist

500

Internal Server Error

Server error


Validation Rules

Required Fields

[!check] Mandatory Fields

  • name - Field name

  • extId - External ID

  • type - Field type

  • controlType - Control type

Field Constraints

Field
Rules
Error Messages

id

Null for POST

"A new field cannot already have an ID"

id

Not null for PUT/PATCH

"Invalid id"

name

@NotNull, @Size(max=64)

"must not be null", "size must be between 0 and 64"

extId

@NotNull

"must not be null"

type

@NotNull

"must not be null"

controlType

@NotNull

"must not be null"

validation

@Size(max=128)

"size must be between 0 and 128"

placeholder

@Size(max=128)

"size must be between 0 and 128"

mask

@Size(max=256)

"size must be between 0 and 256"

maskSymbol

@Size(max=2)

"size must be between 0 and 2"

lengthMin

@Min(0), @Max(256)

"must be between 0 and 256"

lengthMax

@Min(0), @Max(256)

"must be between 0 and 256"

requireField

@Size(max=64)

"size must be between 0 and 64"

filterBy

@Size(max=16)

"size must be between 0 and 16"

Business Rules

[!info] Business Validation

  • validation must be valid Java regex pattern

  • mask format: Use # as placeholder symbol

  • lengthMin must be less than or equal to lengthMax

  • requireField references another field's name

  • filterBy references parent field for dependent values


🔧 cURL Command Reference

Create

Update

Partial Update

Get All

Get by Criteria

Get Single

Get by Recipient

Count

Delete

Cascaded Delete

Last updated