[LIVE WEBINAR] Integrate Visual LANSA with Salesforce. Register to join on April 30.
[LIVE WEBINAR] Integrate Visual LANSA with Salesforce. Register to join on April 30.
Home » App Development » Integration: It’s Not As Difficult As You Think
Home / Blog / Integration: It’s Not As Difficult As You Think

Integration: It’s Not As Difficult As You Think

by | Jan 3, 2022 | App Development | 0 comments

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.

RECOMMENDED POSTS

0 Comments

Submit a Comment