[UPCOMING WEBINARS] Save on Development Costs and Open Up Your IBM i via APIs. REGISTER NOW
[UPCOMING WEBINARS] Save on Development Costs and Open Up Your IBM i via APIs. REGISTER NOW.
Home ยป App Development ยป Integration: It’s Not As Difficult As You Think

Integration: It’s Not As Difficult As You Think

By LANSA Editors
Published On January 3, 2022

Build Robust Applications 3x Faster

Keep the light on.

Join our mailing list for development guides and solutions for constant IT innovation.


All businesses today face a pressing need to implement multiple automation solutions and new technologies in order to stay competitive in todayโ€™s rapidly transforming business environment. These include artificial intelligence (AI), machine learning (ML) and deep learning (DL) as well as Big Data. Just implementing a technology, however,ย  is not enough. Companies also need to integrate new tech with all the other layers and components of their IT networks.ย 

Several technologies play a crucial role in enabling organizations to leverage the power of digital transformation and Industry 4.0 technologies. Arguably, the most important ones are Progressive Web Apps (PWAs) and REST APIs. Both solutions can be key to any IBM i modernization initiative.

Are PWAs and REST APIs the key to integrating business processes?

PWAs are software applications delivered through the web. They use service workers, manifests, and various common web technologies in combination with progressive enhancement to give users a native app-like experience. Because PWAs are web applications, they donโ€™t require a unique development or distribution approach. This allows developers to deliver new apps quickly.ย 

PWAs support any modern web standard compliant browser. This makes them platform-independent. You can install them on both desktop and mobile devices. Because of this, organizations (as well as individuals) can build and deploy these cross-platform apps more easily than native apps.ย 

The second key element of easy business processes and technologies integration are REST APIs, also known as RESTful APIs (or RESTful web service). REST APIs are application programming interfaces (API) that support interaction with RESTful web services.ย  They use HTTP requests to rapidly access and move data. REST APIs are popular among developers due to their versatility and the fact that they do not require the installation of additional applications or libraries.

Is there one platform to harness the power of REST APIs and PWAs?

Even though these technologies significantly simplify the process of building apps, they still require highly qualified and experienced developers. In addition, using them often forces companies to hire new people to augment their IT teams. Generally, this is a costly and time-consuming process, especially since the demand for qualified programmers and digitization technology experts is going through the roof.ย 

There is, however, a solution to this challenge. It makes developing PWAs and implementing REST APIs accessible even for small and medium organizations. In other words, you don’t need massive IT teams or budgets to finance new app projects.ย 

That solution is Visual LANSA, a powerful low-code development platform. Visual LANSA enables accelerated application development by simplifying processes and minimizing the technical skills needed to develop apps. Using Visual LANSA allows organizations to build and deploy new PWAs rapidly and with minimum resources. In fact, it often takes only a few days from a project’s start to the successful deployment of a PWA.ย 

Using the Visual LANSA platform delivers proven and well-documented results. In some cases, it increases development productivity by 10X or more. This is because Visual LANSA allows organizations to turn any programmer into a full-stack developer. More importantly, developers don’t have to master and support a dozen different languages and server technologies. With LANSA, they use the same language and IDE for all parts of an applicationโ€”client-side, server-side, and everything in between. This increases the speed and cost-efficiency of the development process.ย 

The LANSA platform makes using REST APIs and integrating them into new apps as easy as possible. For example, here is some sample code:

Executing the Google Geocode REST API from within Visual LANSA


Define_Com Class(#XPRIM_HttpRequest) Name(#Req)
Define_Com Class(#XPRIM_RandomAccessJsonReader) Name(#Reader)

#Req.DoGet Url('https://maps.googleapis.com/maps/api/geocode/json?...')

* Check if request is successful

If (#Req.Response.IsSuccessHttpStatusCode)

 ย ย ย * Set the JSON reader source for response from the HTTP request

ย ย ย ย #Reader.SetSourceHttpResponse HttpResponse(#Req.Response)

ย ย ย ย * Navigate to the 'location' object (containing the 'lat' and 'lng' values)

ย ย ย ย * We'll specify a navigation path to navigate to the 'location' element

ย ย ย ย * Names and indexes in a path are separated by forward slashes

ย ย ย ย #Reader.BeginObjectWithPath Path('results/1/geometry/location')


 ย ย ย * Get the latitude and longitude value

ย ย ย ย #Latitude := #Reader.ReadNumberWithName('lat')

ย ย ย ย #Longitude := #Reader.ReadNumberWithName('lng')


 ย ย ย * Close "BeginObject" with "EndObject"

ย ย ย ย #Reader.EndObject

Endif

To make this task even less challenging for organizations and teams, read the detailed and extensive documentation covering all the aspects of this process available for all Visual LANSA users.ย 

How can I access real-time weather data?

Weatherstack is a real-time and historical weather data API. It allows organizations to retrieve instant, accurate weather information for any location in the world in lightweight JSON format. Over 75,000 companies worldwide use weatherstack.

The weatherstack API delivers both historical and future weather information for most locations worldwide. This solution, one of the most popular weather data REST API providers on the market, covers weather data for most of the planet. It is also affordable for organizations of all sizes, as well as developers, freelancers, and other individuals.ย 

Apilayer, a sister company of LANSA, built and maintains weatherstack. Apilayer has created some of the most popular API and SaaS products out there. Their popular APIs include currencylayer andย ipstack, as well as mediastack.ย 

What are the advantages of weatherstack API?

The weatherstack API is one of the most popular weather REST APIs due to these key strengths:

Reliable data sources

Weatherstack API gets its data from the most reliable, consistent, and accurate sources.

Great security

All data streams sent to and from the API are secured using industry-standard 256-bit HTTPS (SSL) encryption.

Well-structured documentation

The APIโ€™s documentation also includes a series of interactive code examples in multiple languages to minimize your integration effort.ย 

Millions of locations

You can look up millions of locations by city or region name. You can also lookup by ZIP code, IP address, or even using latitude and longitude.

Prompt response and real-time delivery

The API delivers weather data in lightweight JSON format to ensure a high level of speed and compatibility with any programming language.

Scalable Infrastructure

Finally, the weatherstack scalable cloud infrastructure by apilayer backs the API. It can handle billions of requests per day.

How to integrate Weatherstack API into your PWA?

Here are some basic code samples you can use to integrate the weatherstack API into other products.ย 

Code sample for current weather:

{

ย ย ย ย "request": {

ย ย ย ย ย ย ย ย "type": "City",

ย ย ย ย ย ย ย ย "query": "San Francisco, United States of America",

ย ย ย ย ย ย ย ย "language": "en",

ย ย ย ย ย ย ย ย "unit": "m"

ย ย ย ย },

ย ย ย ย "location": {

ย ย ย ย ย ย ย ย "name": "San Francisco",

ย ย ย ย ย ย ย ย "country": "United States of America",

ย ย ย ย ย ย ย ย "region": "California",

ย ย ย ย ย ย ย ย "lat": "37.775",

ย ย ย ย ย ย ย ย "lon": "-122.418",

ย ย ย ย ย ย ย ย "timezone_id": "America/Los_Angeles",

ย ย ย ย ย ย ย ย "localtime": "2019-09-03 05:35",

ย ย ย ย ย ย ย ย "localtime_epoch": 1567488900,

ย ย ย ย ย ย ย ย "utc_offset": "-7.0"

ย ย ย ย },

ย ย ย ย "current": {

ย ย ย ย ย ย ย ย "observation_time": "12:35 PM",

 ย ย ย ย ย ย ย "temperature": 16,

ย ย ย ย ย ย ย ย "weather_code": 122,

ย ย ย ย ย ย ย ย "weather_icons": [

ย ย ย ย ย ย ย ย ย ย ย ย "https://assets.weatherstack.com/images/symbol.png"

ย ย ย ย ย ย ย ย ],

ย ย ย ย ย ย ย ย "weather_descriptions": [

ย ย ย ย ย ย ย ย ย ย ย ย "Overcast"

ย ย ย ย ย ย ย ย ],

ย ย ย ย "wind_speed": 17,

ย ย ย ย "wind_degree": 260,

ย ย ย ย "wind_dir": "W",

ย ย ย ย "pressure": 1016,

ย ย ย ย "precip": 0,

ย ย ย ย "humidity": 87,

ย ย ย ย "cloudcover": 100,

ย ย ย ย "feelslike": 16,

ย ย ย ย "uv_index": 0,

ย ย ย ย "visibility": 16

ย ย ย ย }

}

 

Code for historical weather data:ย 

{

ย ย ย ย "request": {

ย ย ย ย ย ย ย ย "type": "City",

ย ย ย ย ย ย ย ย "query": "New York, United States of America",

ย ย ย ย ย ย ย ย "language": "en",

ย ย ย ย ย ย ย ย "unit": "m"

ย ย ย ย },

ย ย ย ย "location": {

ย ย ย ย ย ย ย ย "name": "New York",

ย ย ย ย ย ย ย ย "country": "United States of America",

ย ย ย ย ย ย ย ย "region": "New York",

ย ย ย ย ย ย ย ย "lat": "40.714",

ย ย ย ย ย ย ย ย "lon": "-74.006",

ย ย ย ย ย ย ย ย "timezone_id": "America/New_York",

ย ย ย ย ย ย ย ย "localtime": "2019-09-08 09:36",

ย ย ย ย ย ย ย ย "localtime_epoch": 1567935360,

ย ย ย ย ย ย ย ย "utc_offset": "-4.0"

ย ย ย ย },

ย ย ย ย "current": {

ย ย ย ย ย ย ย ย "observation_time": "01:36 PM",

 ย ย ย ย ย ย ย "temperature": 18,

ย ย ย ย ย ย ย ย "weather_code": 113,

ย ย ย ย ย ย ย ย "weather_icons": [

ย ย ย ย ย ย ย ย ย ย ย ย "https://assets.weatherstack.com/images/wsymbols01_png_64/wsymbol_0001_sunny.png"

ย ย ย ย ย ย ย ย ],

ย ย ย ย ย ย ย ย "weather_descriptions": [

ย ย ย ย ย ย ย ย ย ย ย ย "Sunny"

ย ย ย ย ย ย ย ย ],

ย ย ย ย ย ย ย ย "wind_speed": 7,

ย ย ย ย ย ย ย ย "wind_degree": 270,

ย ย ย ย ย ย ย ย "wind_dir": "W",

ย ย ย ย ย ย ย ย "pressure": 1018,

ย ย ย ย ย ย ย ย "precip": 0,

ย ย ย ย ย ย ย ย "humidity": 70,

ย ย ย ย ย ย ย ย "cloudcover": 0,

ย ย ย ย ย ย ย ย "feelslike": 18,

ย ย ย ย ย ย ย ย "uv_index": 5,

ย ย ย ย ย ย ย ย "visibility": 16

ย ย ย ย },

ย ย ย ย "historical": {

ย ย ย ย ย ย ย ย "2013-07-01": {

ย ย ย ย ย ย ย ย ย ย ย ย "date": "2013-07-01",

ย ย ย ย ย ย ย ย ย ย ย ย "date_epoch": 1372636800,

ย ย ย ย ย ย ย ย ย ย ย ย "astro": {

ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย "sunrise": "05:29 AM",

ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย "sunset": "08:31 PM",

ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย "moonrise": "12:59 AM",

ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย "moonset": "02:42 PM",

ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย "moon_phase": "Last Quarter",

ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย "moon_illumination": 40

ย ย ย ย ย ย ย ย ย ย ย ย },

ย ย ย ย ย ย ย ย ย ย ย ย "mintemp": 21,

ย ย ย ย ย ย ย ย ย ย ย ย "maxtemp": 25,

ย ย ย ย ย ย ย ย ย ย ย ย "avgtemp": 22,

ย ย ย ย ย ย ย ย ย ย ย ย "totalsnow": 0,

ย ย ย ย ย ย ย ย ย ย ย ย "sunhour": 12.5,

ย ย ย ย ย ย ย ย ย ย ย ย "uv_index": 5

ย ย ย ย ย ย ย ย }

ย ย ย ย }

}

And, next, the code for the APIโ€™s weather forecast:ย 

{

ย ย ย ย "request": {

ย ย ย ย ย ย ย ย "type": "City",

ย ย ย ย ย ย ย ย "query": "Chicago, United States of America",

ย ย ย ย ย ย ย ย "language": "en",

ย ย ย ย ย ย ย ย "unit": "m"

ย ย ย ย },

ย ย ย ย "location": {

ย ย ย ย ย ย ย ย "name": "Chicago",

ย ย ย ย ย ย ย ย "country": "United States of America",

ย ย ย ย ย ย ย ย "region": "Illinois",

ย ย ย ย ย ย ย ย "lat": "41.850",

ย ย ย ย ย ย ย ย "lon": "-87.650",

ย ย ย ย ย ย ย ย "timezone_id": "America/Chicago",

ย ย ย ย ย ย ย ย "localtime": "2019-09-08 08:39",

ย ย ย ย ย ย ย ย "localtime_epoch": 1567931940,

ย ย ย ย ย ย ย ย "utc_offset": "-5.0"

ย ย ย ย },

ย ย ย ย "current": {

ย ย ย ย ย ย ย ย "observation_time": "01:39 PM",

 ย ย ย ย ย ย ย "temperature": 19,

ย ย ย ย ย ย ย ย "weather_code": 122,

ย ย ย ย ย ย ย ย "weather_icons": [

ย ย ย ย ย ย ย ย ย ย ย ย "https://assets.weatherstack.com/images/wsymbols01_png_64/wsymbol_0004_black_low_cloud.png"

ย ย ย ย ย ย ย ย ],

ย ย ย ย ย ย ย ย "weather_descriptions": [

ย ย ย ย ย ย ย ย ย ย ย ย "Overcast"

ย ย ย ย ย ย ย ย ],

ย ย ย ย ย ย ย ย "wind_speed": 17,

ย ย ย ย ย ย ย ย "wind_degree": 100,

ย ย ย ย ย ย ย ย "wind_dir": "E",

ย ย ย ย ย ย ย ย "pressure": 1019,

ย ย ย ย ย ย ย ย "precip": 0,

ย ย ย ย ย ย ย ย "humidity": 73,

ย ย ย ย ย ย ย ย "cloudcover": 100,

ย ย ย ย ย ย ย ย "feelslike": 19,

ย ย ย ย ย ย ย ย "uv_index": 4,

ย ย ย ย ย ย ย ย "visibility": 16

ย ย ย ย },

ย ย ย ย "forecast": {

ย ย ย ย ย ย ย ย "2019-09-08": {

ย ย ย ย ย ย ย ย ย ย ย ย "date": "2019-09-08",

ย ย ย ย ย ย ย ย ย ย ย ย "date_epoch": 1567900800,

ย ย ย ย ย ย ย ย ย ย ย ย "astro": {

ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย "sunrise": "06:23 AM",

ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย "sunset": "07:13 PM",

ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย "moonrise": "04:25 PM",

ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย "moonset": "12:58 AM",

ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย "moon_phase": "First Quarter",

ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย "moon_illumination": 62

ย ย ย ย ย ย ย ย ย ย ย ย },

ย ย ย ย ย ย ย ย ย ย ย ย "mintemp": 10,

ย ย ย ย ย ย ย ย ย ย ย ย "maxtemp": 18,

ย ย ย ย ย ย ย ย ย ย ย ย "avgtemp": 16,

ย ย ย ย ย ย ย ย ย ย ย ย "totalsnow": 0,

ย ย ย ย ย ย ย ย ย ย ย ย "sunhour": 6.5,

ย ย ย ย ย ย ย ย ย ย ย ย "uv_index": 4

ย ย ย ย ย ย ย ย }

ย ย ย ย }

}

As you can probably tell from these examples, the weatherstack APIโ€™s code is extremely concise and clear, making its integration an easy task even for people with very limited technical or coding knowledge.

Ready to start building new PWAs with powerful REST APIs?

Visual LANSA combines all the right trends in modern-day software development and digital transformation. It also helps organizations to truly utilize the power of automation and digital transformation technologies. In addition, high-quality APIs from Apilayer provide companies with accurate and easily affordable data to empower their new progressive web apps. Learn how you can create universal experiences across all devices.

Ready to begin? Get in touch with us to start utilizing Visual LANSA for your automation needs.

A smarter, faster way to deliver business software

ABOUT THE AUTHOR

LANSA Editors

LANSA is a professional low-code development platform that helps businesses efficiently build and modernize software. In this blog, the team draws on decades of experience empowering enterprises to innovate on the IBM i and future-proof their mission-critical systems.

More Articles

Are you ready for better conversations?

Integrated solutions that deliver powerful results.

Keep the light on.

Join our mailing list for development guides and solutions for constant IT innovation.