Skip to content

A REST API server for searching Indian banks, pincodes, HSN/SAC codes. Created using docker & meilisearch

Notifications You must be signed in to change notification settings

kskarthik/indian-fincodes-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Indian Financial codes API docker ci badge

image

This repository contains scripts which builds a REST API service in a docker image

The following data is provided:

How it's done

  1. The data is fetched from various sources
  2. Data is processed and indexed to the meilisearch docker image
  3. Tests are preformed against the docker image to make sure the data is properly indexed
  4. A new image is created & tagged
  5. Pushed to docker hub

Note

This process is automated using github actions.

Links

Usage

docker pull kskarthik/indian-fincodes-api:latest

# set MEILI_MASTER_KEY to your preferred value
docker run --rm -d \
  -p 7700:7700 \
  -e MEILI_MASTER_KEY='MASTER_KEY'\
  kskarthik/indian-fincodes-api:latest

To access the server, Visit http://localhost:7700 in the browser

API Examples

Note

Meilisearch API Reference has in-depth documentation regarding various search features

Get the list of indexes:

curl http://localhost:7700/indexes
{
  "results": [
    {
      "uid": "banks",
      "createdAt": "2024-03-27T10:57:53.787331548Z",
      "updatedAt": "2024-03-27T10:58:11.549315386Z",
      "primaryKey": "IFSC"
    },
    {
      "uid": "hsn_sac_codes",
      "createdAt": "2024-03-27T11:03:32.334812729Z",
      "updatedAt": "2024-03-27T11:03:34.449263657Z",
      "primaryKey": "id"
    },
    {
      "uid": "pincodes",
      "createdAt": "2024-03-27T11:03:16.545030985Z",
      "updatedAt": "2024-03-27T11:03:24.393231938Z",
      "primaryKey": "id"
    }
  ],
  "offset": 0,
  "limit": 20,
  "total": 3
}

Perform search on an index:

 curl -s -X POST 'http://localhost:7700/indexes/pincodes/search' \
 -H 'Content-Type: application/json' \
 --data-binary '{
    "q": "500001",
    "limit": 2
  }'

{
  "hits": [
    {
      "id": 4678,
      "officename": "Moazzampura S.O",
      "pincode": "500001",
      "officeType": "S.O",
      "Deliverystatus": "Non-Delivery",
      "divisionname": "Hyderabad City",
      "regionname": "Hyderabad City",
      "circlename": "Andhra Pradesh",
      "Taluk": "Nampally",
      "Districtname": "Hyderabad",
      "statename": "ANDHRA PRADESH"
    },
    {
      "id": 4704,
      "officename": "Seetharampet S.O",
      "pincode": "500001",
      "officeType": "S.O",
      "Deliverystatus": "Non-Delivery",
      "divisionname": "Hyderabad City",
      "regionname": "Hyderabad City",
      "circlename": "Andhra Pradesh",
      "Taluk": "Nampally",
      "Districtname": "Hyderabad",
      "statename": "ANDHRA PRADESH"
    }
  ],
  "query": "500001",
  "processingTimeMs": 0,
  "limit": 2,
  "offset": 0,
  "estimatedTotalHits": 213
}