API, How It Helps To Build Applications

Photo by Kevin Ku on Unsplash

 

API stands for Application Programming Interface. Imagine the following scenario, where a web and mobile application shares the same data. For a web application, you can access the database layer by writing server-side code in PHP or ASP.net, etc. But what about a mobile application? Here arises the need for a well-defined API that provides access to data to any requesting application. An API avoids the complexity of interacting with database layer coding for each platform. The usage of API is now very common.

How API Helps?

Weather API is one of the best basic examples one can use to understand the benefits of API. This API [https://openweathermap.org/api] provides real-time data from a huge weather database containing data from around the world. Using this API, we can show the weather update in our application. This is one such example where API is used. Another example I can think about is the Products API provided by Amazon. Using this Products API, a developer can integrate thousands of Amazon products in a Web or Smartphone application.

Parsing API

Every programming language has its own set of libraries to parse data from the API. Using these libraries, a developer can parse the data and rendered it in a meaningful way as required by the end-user. Recently, I used a library called Retrofit in my latest Android application. It handles does all the heavy lifting API parsing, that frees a developer from writing code for efficiently parsing the API.

How API is Requested and parsed.

The following API request shows an API request and its response. Note that the request from the browser includes q=London, which tells the API to return the weather details of London. Next step is to parse the API response and render the output to appropriate html.

API Request: https://samples.openweathermap.org/data/2.5/weather?q=London,uk
API Response:
{“coord”:{“lon”:-0.13,”lat”:51.51},”weather”:
[{“id”:300,”main”:”Drizzle”,”description”:”light intensity drizzle”,”icon”:”09d”}],”base”:”stations”,
“main”:{“temp”:280.32,”pressure”:1012,”humidity”:81,
“temp_min”:279.15,”temp_max”:281.15},
“visibility”:10000,”wind”:{“speed”:4.1,”deg”:80},
“clouds”:{“all”:90},”dt”:1485789600,”sys”:
{“type”:1,”id”:5091,”message”:0.0103,”country”:
“GB”,”sunrise”:1485762037,”sunset”:1485794875},
“id”:2643743,”name”:”London”,”cod”:200}

We can parse the above JSON data to display data in the UI elements. The main advantage of an API is that it can bring data to any platform, like iOS App, Android App or a Web site.

Read our app development experience with an external API.

How To Avoid WordPress Upgrade Nightmare

woman working on computer

Photo by Thought Catalog on Unsplash

Why Do You Need An Upgrade?

A WordPress blog gets several updates periodically. The upgrade is necessary for the following reasons.

* Security

* Performance

* Features

* Compatibility

Be Cautious

If we are not careful about the upgrade, it can give us a hard time. It will be a nightmare for developers especially if the website has a large number of plugins. After the upgrade when you browse the website you may be shocked to find several errors due to reasons arising from breaking the plugin, theme compatibility with the new version and so on. Another reason for the errors can be due to the server upgraded to the latest PHP version.

Be Prepared

So the safest way to avoid such a difficult situation is to have a development server with the same environment ready by cloning the production server. First, perform a WordPress upgrade on the development server. If you find any errors with the plugin or theme, contact respective developers for a compatible version. The problem arises when the original developers are not available. You have to change the code all by yourself. Resolve the development server errors one by one by troubleshooting the plugin and the theme issues. Note down the changes you are making at the code level to repeat them in the production server.

Before doing the upgrade on the production side, have a backup of the database in case of any unexpected errors. In my experience, most of the errors are coming from the plugin side.

I have found a very nice blog post https://www.searchenginejournal.com/how-to-update-wordpress/282117/#close on the wordpress upgrade that describes the best approach.

Our Experience With Native Android Application Development

teamwork coding

Photo by Mimi Thian on Unsplash

Recently we had a project to be developed in Android to mimic an IOS app. As we had expertise in both native and hybrid application development, it was a big question of the approach suitable for the current project. We first decided to go with the hybrid approach. But later we decided to go with the native approach considering its benefits. Native app development has the significant advantage of being able to easily access and utilize the built-in capabilities of the device like Camera, Addressbook, and GPS. So the user experience with the app will be superior along with faster performance.

 

A Native Android app development requires good knowledge in Java coding.

Objective

The purpose of the app was to make the Doctor-Patient consultation easy. There were two apps to develop, one app for the doctors and one app for the patients. We were provided with API to get the data shared between Android and iOS apps.

Challenges

For getting data from the API, we decided to use a REST client which is better than writing our own code. Using such a library reduces the coding time and improves the performance of the app. We evaluated Volley and Retrofit for that purpose. After considering various factors we decided to use retrofit REST Client.

One problem we faced was getting push notification delivered to the app. The doctor should get a notification when a patient requests a consultation. We found firebase is the best option to use. Integration was easy by adding the library reference to gradle and coding was easy as expected.

For video chat feature we used OpenTok platform which iOS app was using. Chat with the single user was easy but adding multiple users to the chat was an issue. We resolved it quickly by contacting the OpenTok support team.

Another issue we faced was regarding the image size. The profile image was taking more time to render. We used the Picasso library to improve performance. Picasso handled images, while also taking care of caching and keeping a low memory impact when doing image manipulations.