Consuming RESTful API to get Bank Details using IFSC code in C#

Introduction

Suppose If you assigned the task to write code to get bank details using IFSC code. Details may be Bank name, IFSC code, MICR(Magnetic Ink Character Recognition), Branch, Address, Contact, City, District, and State. What you’ll do ?

All bank IFSC codes are regularly updated on RBI website, you can download in Excel sheet and rearrange it. and the same can be used in your website but this is not an easy task to gather such a large data and integrate into your database to get details. So you just need only a RESTful API to accomplish this task but unfortunately, there is no such API which can provide updated details.  IFSC codes are obtained from different banks by RBI  every month, new banks branches are going to add every time. so technically its very hard to maintain the all bank IFSC list.

You can try Datayuge IFSC Code API. Their database is weekly updated and service is free without any restriction.

How to Consume API :

In order to consume the API, you need an API Key (get the API key here)
Once you register, you’ll get API there in the dashboard, containing the key.

API Root : https://ifsc.datayuge.com/api/v1/
Example Request Route #1: https://ifsc.datayuge.com/api/v1/{IFSC_CODE}
Request Type: GET
API Authentication Header : DY-X-Authorization: {API KEY}
Response Type: JSON
Sample Response:

get Bank Details using IFSC code

get Bank Details using IFSC code

Let test this API first using Fiddler. Follow steps described in below image.

Using the C# Code :

In this tip, I will show you the consumption of RESTful API in client applications.
I found https://ifsc.datayuge.com/api/v1/ RESTful API which is running online. I tried to consume that live service in the console application.
Code to consume JSON data of bank details after passing IFSC Code

https://gist.github.com/186d7b46b32fd34b03e6d26e1960cd79

But this is JSON Data and you may want to convert it into object so you can print each record as per your need. To accomplish that you have to Deserialize JSON Data. Ok Fine! but how to do ?

Create a class and have all the required properties that you want to consume from API.

Now, Add Newtonsoft.Json package in your application and write code given below to parse JSON data to appropriate property of BankDet class.

Complete Code :

Output :

5 thoughts on “Consuming RESTful API to get Bank Details using IFSC code in C#”

  1. titanfall 2 hack says:

    Very interesting points you have remarked, appreciate it for putting up.

  2. K Roy says:

    Thanks for letting me know about this service. I was looking for such service where I can get basic details using IFSC code.

    1. Chandra Mani Gupta says:

      We are glad that this article helped you. Kindly subscribe our blog for more interesting stuffs. If you are looking for any specific article, kindly let us know in the comment section. Thanks

  3. Rahul says:

    Very nice guide. I have also used this method to get IFSC data on one my clients’s website yobola.com

    1. Chandra Mani Gupta says:

      We appreciate your feedback. In case of any issue, kindly let us know.

Leave a Reply