All Posts By

handyland

API + RESTful API. An introduction. Plain and simple

By | Others | No Comments

Connect!

From Appliance Plumbing Interface…

Imagine that you have just designed a water faucet/ tap which dispenses water only if your fingerprint matches (however strange this may sound, I believe creativity should know no bounds ;). Now, for this to be actually used in a real wash-room or a kitchen sink, it needs to have a receptacle that exactly fits the common water pipe end-point. Lets say, it needs to have the female threaded end 1/2 inch diameter pipe to couple neatly into the male threaded pipe end. In other words, this new contraption of yours needs to follow the same plumbing interface definition as the pipes it needs to work with.

…To Application Programming Interface

Now, imagine if you were more of a software dude/ dudette than a pipe-hardware one. You might design a piece of software that will allow money from your bank to flow out only if your fingerprint matches (this sounds a lot more familiar, right? :). For this widgety creation of yours to be actually used in a real banking app or website, it needs to be able to be ‘integrated’ into the money flow interface definition of the bank(s). As a developer of this new functionality, you therefore need to follow what is called as the Application Programming Interface (API) definition exposed by the banking entity that you intend your software to work with. There you are! You have been hereby introduced to APIs. Simple right?

Why API?

The advantage of defining an API is this. Once defined, and published, it opens your platform up to a limitless set of different applications by independent innovators. So you might see some developer making an app that sends money from a bank account every time someone likes her profile pic on Facebook, or another who develops an app that makes a donation to a random NGO every time you use a swear-word on twitter…I hope you get the drift. There is no limit to the variety of innovation this can spawn. And all this while you enjoy a nice cold iced lemon tea reading some news-feed on your tab.

In short, APIs decouple application use cases, innovation, revenue generation and growth from your core platform. The better defined your APIs and the partner on-boarding processes are, the more you can relax and count the beans 🙂

API is also important because it helps make as much sense of the options available, to the humans implementing it as it does to the machines consuming or exposing it. This is an act of fine balance.

An API once said, “I need some REST”

Lets now focus on something a bit more technical. RESTful APIs. For a start, Restful does not refer to the relaxation that I’d mentioned a short while ago. The REST in RESTful refers to REpresentational State Transfers.

From verbs…

A lot of us have come from the functional programming world. In simple terms, the interfaces defined there would correspond to the verbs that were being exposed. For instance, in a banking app, you could have an interface defined as getBalance(account) which would return the account balance for a given account. Or, sendMoney(account1, account2). Or, listAccounts(customer). These functions could also be exposed as APIs and they do something based on its input parameters. The response of the API call would be the action defined as the verb and output parameters that would provide more details on the action done.

This kind of API has one inherent problem. An API description could be really arbitrary and it would be difficult to imagine all the functionality exposed without having explicit access to the API creator’s documentation.

…To nouns

RESTful APIs are a different breed altogether. They focus a lot more on the resources or nouns, instead of verbs. For example, ‘customer’ could be a resource, ‘account’ could be another and so on. As for the actual action that you would want to take with a resource, REST simplifies it all down to a set of pre-defined verbs in the WWW HTTP definition.

When you visit google.com, for example; the browser actually executes a GET request for the index page based on the URL (Uniform Resource Locator) http://www.google.com.

The idea (RESTful lends its origin to the doctoral thesis of a genius named Roy Fielding) is that, given these constant verbs; All that a developer needs to know is the set of objects/ nouns that he might have to deal with.

For instance, assume a simplified banking application. It may have a resource called customer or transaction or account. So, in the simplest sense, assume the base URL is https://myxyzbank. Now the base URL is like to rootdirectory for all resources (nouns). So, accessing a customer within the bank would likely be baseURL/customer.

There are a few more properties of RESTful APIs. I would only want to touch upon the fact that these API calls are also stateless. That is, a RESTful API call is in itself complete and independent of previous or future calls. In other words, the API calling entity’s state is not preserved on the server in between calls.

Singular and plural

Also noteworthy is the singular and plural use of these nouns.

While /customer/id refers to a particular customer with a given ‘id’ as its identity;

/customers/ refers to all the customers collectively.

So, executing an HTTP GET request on https://myxyzbank/customers should likely return a list of all customers within the bank, executing GET request on https://myxyzbank/customer/id would return a particular customer only. So, simple plain English “get a list of all customers in this bank” translates to an API, GET on https://myxyzbank/customers/ and the bank should spew out its long list (Of course it ain’t that simple. Security, roles, access and privileges have been excluded from the scope of this article).

Now back to the 4 main primitives and why they are pretty much sufficient for most applications.

Get, Post, Put and Delete is all you need

GET- as the name suggests would simply fetch the resource(s) identified
POST- use it when you intend to create a new resource(s) on the server
PUT- updates an existing resource on the server
DELETE- deletes the identified resource(s)

This sounds a lot like CRUD framework (Create, Read, Update, Delete) used for data storage.

Parameters

Additional parameters could also be passed to and from the server along with each resource request. This data could be in different formats, the most popular and elegant one around is called JSON (Java Script Object Notation). Another excessively verbose and elaborate protocol from our good ‘ol days is XML (Extensible Markup Language).

Beauty and the beast

There is a certain sense of beauty, logic, crispness and cleanness in the structure of truly RESTful API. The sad part is that most implement it with varying degrees of RESTful-ness. To the extent that I have even seen a bank call GET /getCustomerBalance as a RESTful API! That’s a verb on verb action and totally looses the plot.


My attempt was to only provide a plain and simple outline to API and RESTful API. There is a lot more in it and the world wide web should be your best guide.

May the POST be with you!
And May is hot!

Further reading:


O’Reilly,

Restful Web APIs https://www.amazon.in/dp/9351102971/ref=cm_sw_r_cp_apa_i_2A0fzbJN3CK5T


Eko ties up with Prabhu Money to Boost Money Remittance Business to Nepal

By | Others | No Comments

Eko has expanded its Indo-Nepal remittance (money transfer) services in partnership with Prabhu Money Transfer. Through these integrations, Eko enables it’s agents to remit money to a wider audience in Nepal. Eko’s first international tie-up for remittance services was with Nepal’s Prabhu Money Group in 2016. The service will benefit 30 lakh Nepali migrants living across India.

WhatsApp Image 2017-05-13 at 12.04.12 PM

The service enables Indian and Nepali citizens living in India to send money to their dear ones in Nepal, and the recipient can avail the cash “instantly”. Citizens of both the countries can use the remittance service in the form of cash to cash, cash to bank account, cash to co-operative bank account and through top-up remittance cards. Eko has an India wide network of retail agent outlets that provide various financial services to customers. For using the Indo-Nepal service, users need to provide their KYC to an Eko retail agent. The remitter needs to provide his Indian or Nepali identity proof, while the recipient needs to show his identity proof in Nepal to receive the cash (in case of cash to cash transfer).

Abhishek Sinha, cofounder and chief executive officer, Eko shared, “This expansion is another big achievement for Eko. Millions of Nepali citizens move to India for better career opportunities and to earn their livelihood. Sending money to their families in Nepal has always been a major challenge for them. This service will help Indo–Nepal migrants remit money to their loved ones in a faster, easier and secure way, and will also add to the revenue opportunity for Eko agents and distribution partners. This is yet another milestone in our journey towards establishing international tie-ups for money remittance.

He further added “Indo-Nepal remittance business is estimated to grow to rupees 200 crore per annum and we look forward to capture the opportunity, with our expertise in remittance business, our India wide network of Eko retail agents and now a Nepal wide network of remittance disbursal agents, branches and ATMs through this partnership with Prabhu money Transfer

Till now, Eko platform has securely processed more than rupees 5.90 crore. With Eko, a remitter can do transactions of 50,000 rupees per day and is allowed up to 12 transactions in a year. A fee of 150 rupees is charged for remitting up to 30,000 rupees and 200 rupees for remitting up to 50,000.

Most popular mobile devices in the Eko merchant network

By | Money Transfer, Remittance, Technology, Wallet | No Comments

Eko works with a select network of almost 10,000 merchants across almost all the states in India who facilitate remittance services for our customers.

A good portion of our merchants transact on smart-devices. The following is a glimpse of the popular device (manufacturers) that our merchants have used in Aug/ Sept 2016:

ekodevicessep16

Samsung, Xiomi and Micromax win,
followed closely by LYF, Lenovo and Vivo,
surprisingly even Apple figures!

Smartphones ki jay!

Introducing Connect Doodles. A platform that celebrates :)

By | Others | No Comments

The New Connect portal that our partners and merchants use, is a dynamic platform that has a life of its own! In India, we celebrate our diversity through festivals. Each festival has its own colors, sights, experiences and sounds. Beginning this month, Connect too will participate in each such celebration by sporting its own colors through campaigns, festive donations and associated online services.

Therefore, introducing Connect Doodles (of course, inspired by Google Doodles).

Featured here are our August Connect Doodles:

Independence Day. August 15th

connect_logo_indipendence_day

Rakshabandhan. August 18th

connect_logo_rakhi

Janmashthami. August 25th

connect_logo_janmashtami

Connect. Celebrate life. Celebrate diversity.

Celebrate sending money home 🙂

How we built the Connect Web App – Part 1 – Breaking from our past

By | Technology | No Comments

This is a series of posts about our adventure with the most exciting project at Ekoconnectalpha.eko.co.in, the progressive web app enabling Eko‘s merchants to make payments and financial transactions.

The original post is at: blog.abhiweb.com/2016/08/how-we-built-the-connect-web-app-part-1-breaking-from-past

The Past

About eight years ago, Eko introduced the simplest of all interfaces to bring banking, payments and other financial transactions to the masses: by dialing numbers on a basic mobile phone. But as the smartphones and laptops grew in popularity with our merchants, we introduced other smart applications. One of them was a simple web portal for money remittance called “Connect”:

 

The old connect portalThe website was immediately successful with our partner merchants, thanks mostly to its simple three-pane interface for quickly transferring money to any bank account in India.

In the last three years, the old Connect portal has already been used to transact for more than 670 billion dollars.

But soon, money remittance service was not enough. We wanted to introduce more services. The only problem was that our engineers had to individually design and build interfaces for these new services. And we realized…

  • we had to manually design and code each page/interface separately. The process was too slow!
  • the three-pane interface was only suitable for the remittance workflow
  • we needed a different interface for different services

And, as a solution, us lazy folks at Eko came up again with our common mantra:

generalize and automate!

Breaking From The Past

So, we came up with the following solution:

  1. The Interaction Framework: to generalize all the financial services (transactions) supported by our platform into interactions that take place between two or more entities.
    For example, a money transfer is an interaction between two bank/wallet accounts.
    Over this generalization, we defined requests, responses, parameters, complex validations, interaction relationships, interaction flows, dynamic behavior, etc. This became our Interaction Framework!
  2. A Progressive Web App: to build a progressive web app and automate the process of providing new services by leveraging the Interaction-Framework. We decided to use Google’s Polymer (which was still in beta, back then) and build custom web components purely on the front-end web technologies.
  3. An API Backend: to design a backend service on Node.js that would be totally decoupled from the front-end app.

In the next articles of this series, I would elaborate on our design decisions and the final architecture and discuss how we finally built the modern progressive web app.


 

The original post is at: blog.abhiweb.com/2016/08/how-we-built-the-connect-web-app-part-1-breaking-from-past

 

IMPS Success Rate – Highest in the Industry!

By | Others | No Comments

info_finalas

We are happy to share that Eko is one of the top 5 IMPS transactions originators in India among PPI licensees as per the latest NPCI (http://www.npci.org.in/) reports.

Not just that, Eko’s system has the lowest failure rates in the industry. Eko’s robust platform, built over 5 years of money transfer business experience, has resulted into an unbeaten 1.3% transaction decline rate compared to the industry average of 4.7%.

“Eko is one of the top 5 IMPS transactions originators in India among PPI licensees”

The platform has processed more than Rs 2,500 crore worth of IMPS transactions and more than Rs 8,000 crores of domestic money transfers in the country.

Currently, the platform is being used by:

–  More than 7,000 merchants

–  22 API partners, who use Eko’s money transfer APIs

“Eko’s system has the lowest transaction failure rate in the industry”

Another reason why Eko is the best partner for you! More information for API partner at Eko Developer Portal

 

Eko goes open source!

By | Money Transfer, Others, Remittance | No Comments

Team Eko is glad to announce that we are getting started with open source! You now have access to the best optimised algorithms and UI to process money remittance transactions at your merchant network.

Till date, this money transfer web application has processed more than Rs 4,000 crores and is being used by more than 2000 agents across the country.

Available now at: https://github.com/EkoHub/Money-Transfer-Web-Applicaton

blog p1

Now, partners/organizations can use this standalone website and deploy it on their systems. Developers can now modify the code and are free to develop or test our remittance APIs.

Frameworks used:

    1. Python
    2. Django framework 1.5
    3. Knockout.js
    4. Gumby framework

It is recommended to run the project in Virtual Environment  instead of changing the global installations as it stores all the dependencies required for this project in the Project folder itself .

Instructions

  1. Download or Clone the Repository
  2. Please go through readme.txt for installation instructions
  3. After installation (including population of database), please review the workflow
  4.  Workflow
    1. Capture Sender Details
      • The merchant/agent enters “Sender Mobile Number” and presses “Go” button. This invokes “Get Customers API” which returns the following scenarios:
      • If customer does not exist – Invoke “Create Customer API”, which fires an OTP to the customer’s mobile number. On entering the OTP, the application invokes “Verify Customer API”.
      • If customer exists – Redirect to Recipient box
    2. Capture Recipient Details – In case customer exists, “Get All Recipients” API is invoked. If the list is empty or the customer wishes to send money to a new bank account, then the merchant/agent  can add a Recipient by clicking on “Add Recipient
      • Adding a recipient requires the merchant/agent to enter bank name, bank account details and recipient details. On entering the required details, the“Add Recipient APIgets  called. Different banks require different flows for adding a recipient efficiently, which has been explained here: http://blog.eko.co.in/add-recipient-workflow-simplified/
      • Selecting any recipient from the list invokes “Get Recipient API” and agent is taken to the Transaction box as shown in the image above.
    3. Capture Transaction Details
      1. Enter the amount of money to be sent and select the Transaction mode. Clicking on “Send moneybutton invokes Send Money API. The status of transaction is displayed as toast at the bottom of the webpage

This is yet another by-product of Eko’s Summer Internship  program under which we hire students from the best universities across the country and provide them a platform to explore our technology. The open source was developed by Siddharth Jandial (NIT J), Kunal Sachdeva (NIT J), Teja Surya (IIT D) and Alankar Verma (NIT R) under the guidance of Mr. Saurabh Mullick.


Recommended reading:

      1. Tutorial on Django – https://docs.djangoproject.com/en/1.9/intro/tutorial01/
      2. To know more about Virtual Environment – http://docs.python-guide.org/en/latest/dev/virtualenvs/