RDN Custom Services Guide
Create customized REST services with JavaScript to implement your own business logic.
What Are Custom Services?
Custom services allow you to create customized REST services by implementing your own business logic with JavaScript. These services integrate seamlessly with the RDN platform and can be used alongside built-in RDN services.
Prerequisites
Before creating custom services, you should have:
- ✅ Basic JavaScript knowledge - Familiarity with syntax, functions, and key concepts
- ✅ Understanding of REST concepts - How REST services work
- ✅ RDN platform access - Ability to create and manage services
- ✅ Code best practices - Knowledge of clean, secure, and maintainable code
JavaScript Best Practices
When writing custom service code, follow these best practices:
- Write clean, optimized code - Ensures efficient service execution
- Follow security guidelines - Protect against common vulnerabilities
- Keep code maintainable - Make it easy for others to understand and modify
- Handle errors gracefully - Implement proper error handling
- Test thoroughly - Verify functionality before deployment
Key Features
✨ JavaScript-based - Use familiar JavaScript syntax ✨ Modular design - Create helper functions for complex logic ✨ Built-in RDN functions - Access service and utility functions ✨ Draft and Production modes - Develop safely before deploying ✨ Comprehensive testing - Validate before production deployment ✨ Logging capabilities - Debug with built-in logging functions ✨ External API calls - Make GET, POST, and PUT requests
How It Works
- Create a service - Give your service a unique name
- Choose script type - Select Draft for development
- Write JavaScript code - Implement your business logic
- Test your code - Verify functionality with test inputs
- Deploy to production - Move to production once tested
- Monitor execution - Use logs to track performance
Service Architecture
┌─────────────────────────────────────────┐
│ Custom Service (srv_...) │
├─────────────────────────────────────────┤
│ Input Arguments │
│ ↓ │
│ Main Function Logic │
│ ├─ Helper Functions │
│ ├─ RDN Service Functions │
│ └─ RDN Utility Functions │
│ ↓ │
│ Return Output (Value or Map) │
└─────────────────────────────────────────┘
Getting Started
The quickest way to get started:
- Set up your first service - Step-by-step creation guide
- Learn JavaScript basics - Code structure and examples
- Use RDN functions - Available helper functions
- Test your service - Validation and testing
- Deploy to production - Go live with confidence
Default Service
When you create an RDN account, a default custom service is automatically provided:
Service Name: srv_standardize_country
This service helps standardize country names and formats, providing an out-of-the-box solution for geographic data processing. You can use this as a reference when building your own services.
Common Use Cases
Custom services are perfect for:
- 🎯 Data transformation - Convert and standardize data formats
- 🔍 Data enrichment - Add calculated fields or derived values
- 🔗 External integrations - Call third-party APIs
- ✓ Data validation - Implement custom validation logic
- 📊 Complex calculations - Perform multi-step computations
- 🏷️ Categorization - Classify data based on custom rules
- 🔄 Data mapping - Transform between different data structures
Support & Next Steps
- Setup Guide - How to create a new custom service
- Code Guide - How to write custom service code
- Functions Reference - Available RDN functions
- Deployment Guide - Testing and going live
Ready to create your first custom service? Start with the Setup Guide! 🚀