Overview
Custom fields provide:- Flexible data storage - Attach to any Ralph model
- Type validation - String, integer, date, URL, or choice list
- API integration - Accessible via REST API
- Configuration variables - Export to configuration management tools
- Choice constraints - Define allowed values
Defining Custom Fields
Configuration Options
Basic Settings
Name- The display name shown in the UI
- Can contain spaces and special characters
- Slugified version of the name
- Used as the key in API responses
- Automatically generated from name
- Example: “Docker Version” →
docker_version
Field Types
String- Free-form text input
- No validation applied
- Numeric values only
- Validates that input is a whole number
- Date picker in UI
- Stored in YYYY-MM-DD format
- Validates that input is a valid URL
- Example:
https://example.com/manual.pdf
- Dropdown with predefined options
- Requires configuring the Choices field
Choices Configuration
For choice list type, define options separated by|:
Default Value
Optionally set a default value that will be used when the field is first attached to an object.Configuration Variable
Check “use as configuration variable” to:- Expose the field in the API’s
configuration_variablesfield - Use with Puppet, Ansible, or other automation tools
- Separate configuration data from general custom fields
Example Custom Field
Creating a “Monitoring System” field:- Name: Monitoring System
- Attribute name:
monitoring_system(auto-generated) - Type: Choice list
- Choices:
zabbix|nagios|prometheus - Default value:
zabbix - Use as configuration variable: ✓ Checked
Attaching Custom Fields to Objects
Select Field
Start typing the field name in the Key field.An autocomplete dropdown will appear with matching custom fields.
Enter Value
Select your custom field from the list.The Value field will adjust based on the field type:
- String/Integer/Date: Text input
- URL: URL input with validation
- Choice list: Dropdown menu
Using Custom Fields in the API
Reading Custom Fields
Custom fields appear as a dictionary in API responses:custom_fieldscontains ALL custom fieldsconfiguration_variablesonly contains fields marked as configuration variables- Keys use the
attribute_namefrom the custom field definition
Filtering by Custom Fields
Filter API results using custom field values:customfield__<attribute_name>=<value>
Managing Custom Field Values
List Custom Fields for an Object
Add Custom Field Value
POST to the customfields endpoint:Update Custom Field Value
PATCH or PUT to the specific custom field:Configuration Management Integration
Custom fields marked as configuration variables integrate with automation tools.Puppet Example
Fetch configuration variables via API:Ansible Example
Use as variables in playbooks:Common Use Cases
Asset Metadata
- Warranty information
- Procurement order numbers
- Internal asset classifications
- Compliance tags
Configuration Data
- Monitoring system preferences
- Backup schedules
- Software versions
- Feature flags
Business Information
- Cost center codes
- Department assignments
- Project identifiers
- Custom lifecycle stages
Tips and Best Practices
Troubleshooting
Custom field not appearing in autocomplete
Custom field not appearing in autocomplete
- Ensure the custom field is saved and active
- The field may not be enabled for that specific model type
- Try refreshing your browser
Can't attach same field twice
Can't attach same field twice
This is by design. Each custom field can only have one value per object. If you need multiple values, create separate custom fields (e.g.,
contact_email_1, contact_email_2).Configuration variables not showing in API
Configuration variables not showing in API
- Verify “use as configuration variable” is checked
- The field must have a value attached to the object
- Check API permissions for the user/token
Related Documentation
- DCIM - Using custom fields with data center assets
- Deployment - Configuration variables in deployment