HOPCOMS (Horticultural Producers’ Co-operative Marketing and Processing Society Ltd) was established to help farmers to sell their products. They connect farming community and the consumers. They are based out of Banagalore. They have hundreds of stores in five districts of Karnataka - Bangalore Urban, Bangalore Rural, Kolar, Ramanagar and Chikkaballapura Districts.



Like many Bangaloreans I buy my fruits and vegetables from HOPCOMS. I love them. For sometime I have been thinking about how to make them more accessible and visible. One of the idea was to build some alerts. HOPCOMS as such doesn't have any APIs1 on which I could build things. But they had a web page where they publish the daily rates. Well I took it upon myself to build an API so others can use it too. It also reduces burden on HOPCOMS servers. All in all serves HOPCOMS, Consumers and Farmers.

There are two ways to use the API. Use the code provided and run your own. Or email me and get access to my small API server.


Data is hosted on CouchDB. APIs are simple CouchDB restful APIs. For the external world it's mostly GET access only. All responses are in JSON format.

Do remember the returned Content-Type is text/plain even though the information returned by the request is in JSON format. To get the content-type application/json set need to explicitly set your request Accept header as Accept: application/json .

Assuming CouchDB runs at https://mycouchdb.ext there are two databases available.


This stores the daily rate data. The primary key _id is date in the YYYYMMDD format. For example Jan 16, 2018 will be 20180116. It's accessible at https://mycouchdb.ext/hopcoms_daily/20180116 with a simple GET. The response data is JSON and is simple key:value pair of item_code and rate.


You could do other CouchDB key based queries to get data worth of a month or year or between specific dates etc. See queries section for some examples.


Item Details

hopcoms_meta table stores other meta data. To get the item details. You can issue you a GET request like https://mycouchdb.ext/hopcoms_meta/item_details. It returns a simples JSON with item_code as the key and names in different languages. A partial response looks like this

For the rate list published before 2019 Sept 23, use item_details.

  "_id": "item_details",
  "_rev": "3-b3808e206cd2263b5ae67e7fd543f245",
  "1": {
    "name_en": "Apple Delicious",
    "name_kn": "ಸೇಬು ಡಲೀಷಿಯಸ್"
  "2": {
    "name_en": "Apple Simla",
    "name_kn": "ಸೇಬು ಶಿಮ್ಲ"


For the rate list published after 2019 Sept 23, use item_details2. Read this blog post for details of this change.

  "_id": "item_details2",
  "_rev": "1-7a682471c33b9e0a449dd09babb827b4",
  "1": {
    "name_en": "Apple Delicious",
    "name_kn": "ಸೇಬು ಡಲೀಷಿಯಸ್"
  "2": {
    "name_en": "Apple Simla",
    "name_kn": "ಸೇಬು ಶಿಮ್ಲ"


So using both you can figure that on 20180116 rate of Apple Delicious was INR 110. It's that easy. Its better to cache the item_details in your application environment.


hopcoms_meta also has other details like when was the DB last updated available at https://mycouchdb.ext/hopcoms_meta/last_modified_timestamp. Response looks like


It's the last time daily rate was updated. So gives you an idea how update the data is.


API details are available at https://mycouchdb.ext/hopcoms_meta/api. Response looks like

{"_id":"api_details","_rev":"1-b9e51ee6a16a0bc711b2d7d6cf4f52bc","version":"1", "date":"20180313", "author":"Thejesh GN", "author_url:"https://thejeshgn.com", "documentation":"https://thejeshgn.com/projects/hopcoms-api/"}

Hosted version of API

I do host the version of API where I run the server and maintain it. As of now its running on a small server and hence not public. Email me, I will send the access details.

Self host the API

You can host it yourself. All you need is CouchDB, ability to run python programs and CRON for scheduling. I am going to explain the broad steps.

  1. Install CouchDB, make it web accessible or may be use hosted CouchDB from IBM Cloud. Whatever works for you. This is not the best place for it.
  2. Create hopcoms_daily and hopcoms_meta databases. Setup auth etc.
  3. Install python, virtualenvwrapper, git
  4. Clone https://github.com/thejeshgn/hopcoms
  5. Go to hopcoms folder and create a virtual env
  6. pip install all packages in requirements.txt
  7. Edit load.py and update the db_full_url with your CouchDB url
  8. Run python script load.py to load historical data and meta data
  9. Then setup a cron to run daily.sh to run everyday post 11AM IST. This is the one which keeps the data updated on daily basis
  10. Setup your firewall, CouchDB database security etc. This is not the best place to say everything about it
  11. You should have hopcoms_daily and hopcoms_meta with data available now


Get all for year 2016


By date range


By months


By year


Specific day


Item details



You can keep track of what I am working on here. I have TODO list.


  • Add meta data table
  • Add store list
  • Add store lat/long locations in the format of GEOJSON

This API documentation was last updated on Oct 4, 2019 @ 12:07 PM.


Contact me using the email or contact form for any feedback or comments.


  1. Of-course HOPCOMS is not in the business of building APIs. They do what they are expected to do very well.
Do you like this post? Please rate, its just a click :) 1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)