From RPG to REST: A Practical Transition Guide for IBM i Developers

While you can rely on a platform like Eradani Connect to do all the heavy lifting for you, understanding the nuts and bolts of REST APIs is invaluable for any IBM i developer. Think of it like driving a car with an automatic transmission – sure, you don’t need to understand how the gearbox works, but knowing what’s happening under the hood makes you a better driver. 

Why REST APIs Are Everywhere 

Before we dive in, let’s talk about why REST APIs have become the de facto standard for modern integration. It’s not just another tech buzzword – REST APIs solve real problems: 

  • Language and Platform Independence: REST APIs communicate over HTTP using standard data formats like JSON. This means your IBM i can talk to anything – Node.js applications, Python scripts, mobile apps, or cloud services – without caring about what technology they’re built with. 
  • Scalability: REST’s stateless nature means each request contains all the information needed to process it. This makes it easier to scale your systems by adding servers or load balancers without worrying about session management. 
  • Developer Experience: REST APIs are intuitive to work with. The combination of HTTP methods (GET, POST, PUT, DELETE) with URLs creates a natural way to interact with resources. You can provide REST APIs that call programs, run stored procedures, or execute database queries. Plus, tools like Swagger make it easy to document and test your APIs. 
  • Firewall Friendly: Since REST APIs typically use standard HTTP/HTTPS ports, they usually work seamlessly with existing firewall configurations. No need to open special ports or configure complex networking rules. 
  • Caching: REST’s architecture makes it easy to cache responses at various levels (browser, proxy, server), improving performance and reducing server load. 
  • Loose Coupling: REST APIs create a clean separation between systems. Your IBM i can change its internal implementation without affecting external systems as long as the API contract remains the same. 
  • Secure Access: With REST APIs, you can avoid providing direct ODBC access to your database tables. You can limit access to specific rows and columns within the tables and you can grant that access based on who the user is and to what they should have access. REST APIs also allow you to manage the connections and traffic flow at the API level (before the user gets to the IBM i). 

The Modern Integration Challenge 

Let’s face it – if you’re an IBM i developer, you’re probably juggling requests to integrate with web services, mobile apps, and cloud platforms. Your RPG code runs your business perfectly, but now it needs to talk to the outside world. While platforms like Eradani Connect can automatically generate these integrations for you (complete with enterprise-grade security and monitoring), understanding the underlying concepts will make you much more effective at designing and maintaining these systems. 

Understanding REST (Without the Jargon) 

Think of REST like this: instead of calling programs directly, you’re creating endpoints that can be accessed over HTTP. If you’re used to writing RPG programs that take input parameters and return data, you’re already halfway there. The main difference is the format and how these programs are called. 

In RPG, you might write: 

dcl-pi Customer_Inquiry; 

  custNumber char(10); 

end-pi;  

With REST, you’re essentially doing the same thing, but your endpoint might look like: 

GET /api/customers/1234567890 

A Word of Caution 

Before we dive into building APIs from scratch, let’s be clear: production APIs need robust security, authentication, monitoring, throttling, and error handling. While learning by building is valuable, remember that platforms like Eradani Connect provide these critical enterprise features out of the box. They handle the complex security protocols (OAuth2, JWT, SSO), monitoring, alerting, and high-availability requirements that production systems need. 

Starting Small 

For learning purposes, start with something simple, like a customer inquiry program. Here’s a practical approach: 

  1. Pick a simple RPG program that retrieves data 
  2. Install Node.js on your IBM i (it’s free and IBM-supported) 
  3. Create a basic REST endpoint that calls your existing RPG program 
  4. Return the data as JSON  

Remember: this is for learning. In production, you’d want to consider: 

  • Authentication and authorization (which Eradani handles with support for hundreds of security options) 
  • Request throttling to prevent overload 
  • Comprehensive monitoring and logging 
  • Error handling and alerting 
  • High availability and redundancy  

The Power of JSON 

One of the biggest shifts you’ll encounter is moving from fixed-format records to JSON. Here’s the good news: JSON is actually simpler than DDS. Instead of worrying about positions and lengths, you’re working with a format that’s much more flexible. 

For example, instead of: 

DDS 

A          R CUSTREC 

A            CUSTNO         10A 

A            CUSTNAME       30A 

A            CUSTADDR       50A 

 

You’ll work with: 

 
JSON 

{ 

  “customerNumber”: “1234567890”, 

  “name”: “ACME CORP”, 

  “address”: “123 Business Ave” 

} 

Security Matters 

Security isn’t optional in modern API development. While you can implement basic authentication yourself, enterprise applications need multiple layers of security. This is where integration platforms shine – Eradani Connect, for instance, supports everything from basic HTTP authentication to complex OAuth2 flows, Active Directory integration, and SAML. 

Learning vs. Production 

As you experiment with building APIs, remember there’s a significant difference between learning exercises and production-ready code. Production APIs need: 

  • High-performance processing capabilities 
  • Redundancy and failover 
  • Comprehensive monitoring and logging 
  • Proactive alerting 
  • Deployment management 
  • Security compliance 

These are complex features that typically require significant development time – or a platform like Eradani Connect that provides them out of the box.

Moving Forward 

Whether you’re building APIs from scratch or using an integration platform, understanding the fundamentals of REST will make you more effective. Start with simple experiments to learn the concepts but remember that production systems need enterprise-grade security, monitoring, and management capabilities. 

The good news is you don’t have to choose between understanding and efficiency. Learn the concepts by building simple APIs, but leverage platforms like Eradani Connect for production deployments where security, performance, and reliability are critical. 

Have questions about getting started with REST on IBM i? Drop us an email. We’d love to hear from you! 

 

 

 

Mike Samboy is the COO of Eradani. For more information, reach out to us here!

Get the latest Eradani Blog posts sent to your email.

Facebook
Pinterest
Twitter
XING
LinkedIn
WhatsApp