enhancing IBM i with APIs

Integrating APIs with your IBMi System-Is it Beneficial?

Today the trend of API economy is on the rise, and organizations are using them in abundance to call the hidden programs and reuse existing codes that can be beneficial in driving business value. APIs are very useful for your IBMi system as they give a competitive edge to your business along with speeding up the development. So, are APIs beneficial for your IBMi application? The answer is yes.

Since API may be a new term for new developers and business owners, understanding it might be difficult. So, let’s understand what APIs are.

What is API and how to leverage it?

API Leverage

Source: https://www.serviceobjects.com/

API (Application Programming Interface) is a computing interface that defines the communication between various software intermediaries. If you are thinking of modernizing your IBMi application, enhancing it using modern platforms or API integration, then enabling APIs is strongly recommended with your solutions, especially if you have non-IBMi users who need access to data.

If you require any kind of integration of a particular activity or service with your existing web application, then APIs are the best approach. For such integration use a standard interface that is cost effective. It reduces the cost of development and is not complex for users. Even if the user is using an IBMi application, the integration of a standard API makes it as user-friendly as any other application without a learning curve for how the IBMi system works.

The biggest benefit is consistency for all the applications built in your organization. This is because the standard APIs are shareable and reusable between multiple constituents, and they follow modern development standards. Additionally, the coding standard and languages used for the development processes do not need to change. This means the IBMi developers can continue to develop applications in their way without having to change their development methods.

How to go with API integration?

Deciding how to connect API with your IBMi system completely depends on the application and the customer requirements. Some of the simple API integration methods are: Direct DB2 access, using data queues, Using HTTP, Java and Krengel Tec RPG EML Suite.

Let’s discuss these integrations here:

Integrating API using Java

Java is one of the most reliable options to integrate APIs in IBMi system. Because IBMi provides a seamless integration with JAVA, it is one of the best alternatives to perform some out-of-the-box implementations.

The main benefits of using JAVA to integrate API with IBMi:

1. Supports SOAP/REST

2. Easy to manipulate complex request/response

3. Easy to handle XML as compared to RPG

4. Also handles multimedia formats (like files, images etc.)

5. Also use JAVA as a wrapper to upload the API content and later call the RPG programs from JAVA to perform business logic

Integrating API using tools in IBMi

1.LIBHTTP

LibHTTP is an MIT-licensed library written in C that implements a HTTP/HTTPS server with web socket capabilities. It is used for integrating because it also includes functionality for client connections to other servers. The LibHTTP library is based on the Mongoose (MIT)/Civetweb family of HTTP servers and shares code with these servers.

LibHTTP is often used as a HTTP/HTTPS library inside a larger application. A C-API is available to connect the LibHTTP functionality with other huge codebases.

2. DB2 methods to access HTTP services

Architectural overview of Data Web Services

Fig1: Architectural overview of Data Web Services

Source: https://www.ibm.com

HTTP has evolved over time. Protocols and usage patterns like REST or WebDAV maintain HTTP as the base. Many websites and applications provide HTTP-based interfaces to access information.

  • A REST API is a type of web service and is called so because it uses HTTP.
  • The REST API is not the same as a web page as they do not have an UI nor do they use any web browser.
  • It can be a green-screen application, mobile application, Windows application, etc.

Many XML-based message formats have been updated several times to be capable of exchanging data in conjunction with HTTP as transport layer. Some examples include SOAP, RSS, or Atom.

SQL extensions in the form of user-defined functions (UDFs) access URL-addressable resources via HTTP directly from SQL statements. SQL aggregation or XPath access can be used to manipulate and store data retrieved from the web. REST functions are used for issuing simple HTTP GET or POST requests.

The basic scalar functions are primarily used to access the content available on the web. REST functions are largely for the four most common HTTP verbs: GET, POST, PUT, and DELETE.

All basic REST functions return the content of the HTTP response message as BLOB (binary) or CLOB (textual). The DB2 schema for the functions is DB2XML.

The function signatures follow the below code:

DB2XML.HTTP<method><type>(url, httpHeader <,input>)

3. Krengle Tech RPG XML Suite

The RPG XML Suite is used by both experienced and up-and-coming RPG developers to reduce coding time and get a head start on new projects.

With the RPG-XML Suite developers can:

  • Compose – Templates and powerful APIs offer seamless composition of XML and JSON.
  • Transmit – Send business data via HTTP to remote servers.
  • Parse – Retrieve data from XML or JSON to store within DB2 database or utilize the data as per their requirement.

A basic API management solution

Reading all the above information provides a background about APIs and how they can be used in your IBMi system. It’s important to know that a basic API exposes business assets to any third party, so security and privilege rules should be considered. When exposing a business asset, there should be a set of rules to manage and secure those APIs that expose your business data.

The solution:

• Lifecycle and version management: After API is built, it is taken through a lifecycle for testing. When its version is changed, new versions are made available. The consumers can either be automatically moved to the new version when possible or notified that they need to move to the new version within a given time frame.

• Consumption management: Companies can establish policies to allow a controlled number of calls of the API. This requirement protects the core business assets and IT systems from being bombarded with requests.

• Analytics: There must be an understanding about who may use the asset and how often it is being used. This requirement is valuable data to analyse to make an appropriate use of resources and API initiative successful. The analytics data and dashboard convey to the company what is working and what isn’t.

API Examples

Most commonly used APIs, which are also the most integrated to the IBMi systems, include PayPal, Amazon Web Service (AWS), IBM Watson, texting services (such as Twillio) and more.

Advantages of API integration

API enablement of your IBMi system is definitely full of advantages. These reasons include: a standard interface for accessing business assets, consistency all through the development process even when new applications are being developed, and no requirement of advance knowledge about IBMi by the user.

The biggest benefit is that using API integration will not hamper the value of IBMi in your business. It will still be the center of your IT strategy. This is because enabling API on your IBMi system does not impact the process of development on the IBMi. Using this, you can easily enhance the development and provide flexibility to your IT team.

SHARE: