web.ohidur.com

web.ohidur.com API

The small public API behind ohidur.com. Look up the divisions, districts, upazilas and unions of Bangladesh, read the blog feed or show a random meme. Responses are JSON, any website can call it, and no key is needed.

Base URL https://web.ohidur.com

Find any union in Bangladesh

Each choice calls the next /geo endpoint and shows you the response.

Division
District
Upazila
Union
Choose a division to start.

Basics

Send requests to https://web.ohidur.com. There is no sign-up and no API key, and every response allows cross-origin requests, so a web page can call the API directly.

curl https://web.ohidur.com/geo/divisions/6/districts
const res = await fetch('https://web.ohidur.com/geo/divisions/6/districts');
const { data: districts } = await res.json();

Errors

Errors use the Problem Details format, with the content type application/problem+json. Each error has a requestId that matches the X-Request-Id response header. Include it when you report a problem.

{
  "type": "about:blank",
  "title": "Not Found",
  "status": 404,
  "detail": "No division has id 99",
  "instance": "/geo/divisions/99",
  "requestId": "iad1::7xk2m-1731024000000-3f9c2a1b8e4d"
}

Caching

Location data is cached for a day in browsers and a week at the edge, and refreshed on every deploy. The blog feed is cached for 5 minutes. Images are never cached, so each load fetches a fresh one.

Geo

Bangladesh is divided into 8 divisions, 64 districts (zila), 494 upazilas and 4,540 unions. Each one has an English name, a Bangla name and the host name of its government website.

To build an address picker, load the divisions, then follow each choice one level down with /geo/divisions/{id}/districts, /geo/districts/{id}/upazilas and /geo/upazilas/{id}/unions. The explorer at the top of this page works that way.

The data comes from ohidurbappy/geoapi.

List divisions

GET/geo/divisions

All 8 divisions, ordered by id.

Responses

  • 200The divisions.application/json

Example request

curl https://web.ohidur.com/geo/divisions

Example response

{
  "status": 200,
  "message": "success",
  "data": [
    {
      "id": 6,
      "name": "Dhaka",
      "bn_name": "ঢাকা",
      "url": "www.dhakadiv.gov.bd"
    }
  ]
}

Get a division

GET/geo/divisions/{id}

One division by id.

Parameters

NameInTypeDescription
idrequired path integer Division id. Example: 6

Responses

  • 200The division.application/json
  • 400id is not a positive integer.application/problem+json
  • 404No division has this id.application/problem+json

Example request

curl https://web.ohidur.com/geo/divisions/6

Example response

{
  "status": 200,
  "message": "success",
  "data": {
    "id": 6,
    "name": "Dhaka",
    "bn_name": "ঢাকা",
    "url": "www.dhakadiv.gov.bd"
  }
}

List the districts in a division

GET/geo/divisions/{id}/districts

The districts in division id, ordered by id. Use it to fill the second step of an address picker.

Parameters

NameInTypeDescription
idrequired path integer Division id. Example: 6

Responses

  • 200The districts in the division.application/json
  • 400id is not a positive integer.application/problem+json
  • 404No division has this id.application/problem+json

Example request

curl https://web.ohidur.com/geo/divisions/6/districts

Example response

{
  "status": 200,
  "message": "success",
  "data": [
    {
      "id": 47,
      "division_id": 6,
      "name": "Dhaka",
      "bn_name": "ঢাকা",
      "lat": 23.7115253,
      "lon": 90.4111451,
      "url": "www.dhaka.gov.bd"
    }
  ]
}

List districts

GET/geo/districts

All 64 districts with their approximate coordinates, ordered by id.

Responses

  • 200The districts.application/json

Example request

curl https://web.ohidur.com/geo/districts

Example response

{
  "status": 200,
  "message": "success",
  "data": [
    {
      "id": 47,
      "division_id": 6,
      "name": "Dhaka",
      "bn_name": "ঢাকা",
      "lat": 23.7115253,
      "lon": 90.4111451,
      "url": "www.dhaka.gov.bd"
    }
  ]
}

Get a district

GET/geo/districts/{id}

One district by id.

Parameters

NameInTypeDescription
idrequired path integer District id. Example: 47

Responses

  • 200The district.application/json
  • 400id is not a positive integer.application/problem+json
  • 404No district has this id.application/problem+json

Example request

curl https://web.ohidur.com/geo/districts/47

Example response

{
  "status": 200,
  "message": "success",
  "data": {
    "id": 47,
    "division_id": 6,
    "name": "Dhaka",
    "bn_name": "ঢাকা",
    "lat": 23.7115253,
    "lon": 90.4111451,
    "url": "www.dhaka.gov.bd"
  }
}

List the upazilas in a district

GET/geo/districts/{id}/upazilas

The upazilas in district id, ordered by id.

Parameters

NameInTypeDescription
idrequired path integer District id. Example: 47

Responses

  • 200The upazilas in the district.application/json
  • 400id is not a positive integer.application/problem+json
  • 404No district has this id.application/problem+json

Example request

curl https://web.ohidur.com/geo/districts/47/upazilas

Example response

{
  "status": 200,
  "message": "success",
  "data": [
    {
      "id": 365,
      "district_id": 47,
      "name": "Savar",
      "bn_name": "সাভার",
      "url": "savar.dhaka.gov.bd"
    }
  ]
}

List upazilas

GET/geo/upazilas

All 494 upazilas, ordered by id.

Responses

  • 200The upazilas.application/json

Example request

curl https://web.ohidur.com/geo/upazilas

Example response

{
  "status": 200,
  "message": "success",
  "data": [
    {
      "id": 365,
      "district_id": 47,
      "name": "Savar",
      "bn_name": "সাভার",
      "url": "savar.dhaka.gov.bd"
    }
  ]
}

Get an upazila

GET/geo/upazilas/{id}

One upazila by id.

Parameters

NameInTypeDescription
idrequired path integer Upazila id. Example: 365

Responses

  • 200The upazila.application/json
  • 400id is not a positive integer.application/problem+json
  • 404No upazila has this id.application/problem+json

Example request

curl https://web.ohidur.com/geo/upazilas/365

Example response

{
  "status": 200,
  "message": "success",
  "data": {
    "id": 365,
    "district_id": 47,
    "name": "Savar",
    "bn_name": "সাভার",
    "url": "savar.dhaka.gov.bd"
  }
}

List the unions in an upazila

GET/geo/upazilas/{id}/unions

The unions in upazila id, ordered by id. A few recently created upazilas have no unions in this data set yet, and return an empty list.

Parameters

NameInTypeDescription
idrequired path integer Upazila id. Example: 365

Responses

  • 200The unions in the upazila.application/json
  • 400id is not a positive integer.application/problem+json
  • 404No upazila has this id.application/problem+json

Example request

curl https://web.ohidur.com/geo/upazilas/365/unions

Example response

{
  "status": 200,
  "message": "success",
  "data": [
    {
      "id": 3275,
      "upazila_id": 365,
      "name": "Ashulia",
      "bn_name": "আশুলিয়া",
      "url": "ashuliaup.dhaka.gov.bd"
    }
  ]
}

List unions

GET/geo/unions

All 4,540 unions, ordered by id. The response is about 500 KB; to fill a picker, load one upazila at a time with /geo/upazilas/{id}/unions.

Responses

  • 200The unions.application/json

Example request

curl https://web.ohidur.com/geo/unions

Example response

{
  "status": 200,
  "message": "success",
  "data": [
    {
      "id": 3275,
      "upazila_id": 365,
      "name": "Ashulia",
      "bn_name": "আশুলিয়া",
      "url": "ashuliaup.dhaka.gov.bd"
    }
  ]
}

Get a union

GET/geo/unions/{id}

One union by id.

Parameters

NameInTypeDescription
idrequired path integer Union id. Example: 3275

Responses

  • 200The union.application/json
  • 400id is not a positive integer.application/problem+json
  • 404No union has this id.application/problem+json

Example request

curl https://web.ohidur.com/geo/unions/3275

Example response

{
  "status": 200,
  "message": "success",
  "data": {
    "id": 3275,
    "upazila_id": 365,
    "name": "Ashulia",
    "bn_name": "আশুলিয়া",
    "url": "ashuliaup.dhaka.gov.bd"
  }
}

Blog

Feed from blog.ohidur.com

List blog posts

GET/blogposts

Posts from blog.ohidur.com. Responses are cached at the edge for 5 minutes.

Parameters

NameInTypeDescription
content query one of 0, 1, true, false Include each post's full content. Omitted by default to keep the response small. Example: false

Responses

  • 200All posts.application/json
  • 400Invalid query parameter.application/problem+json
  • 502The blog could not be reached or returned unexpected data.application/problem+json
  • 504The blog did not answer in time.application/problem+json

Example request

curl 'https://web.ohidur.com/blogposts?content=false'

Example response

[
  {
    "id": 2,
    "title": "Using Nginx container as a load balancer",
    "section": "posts",
    "tags": [
      "devops"
    ],
    "uri": "https://blog.ohidur.com/posts/nginx-load-balancer/"
  }
]

Assets

Images

Random meme image

GET/memes/random.jpg

Picks a random meme and streams it back with no-cache headers, so <img src> shows a new one on every load. If the image host fails, answers with a 302 redirect to the image instead.

Parameters

NameInTypeDescription
category query one of programming, science Picked at random when omitted. Example: programming

Responses

  • 200A meme image (JPEG or PNG).image/*
  • 302Fallback: the image host could not be reached through the API.
  • 400Unknown category.application/problem+json

Example request

curl 'https://web.ohidur.com/memes/random.jpg?category=programming' \
  -o random.jpg

Responds with the image itself (image/*).

Meta

Health check

Health check

GET/health

Answers {"status": "ok"} while the service is up. Use it for uptime monitors; / is the docs page.

Responses

  • 200The service is up.application/json

Example request

curl https://web.ohidur.com/health

Example response

{
  "status": "ok"
}

Geo v1 (legacy)

These are the endpoints of the old geoapi service. They return exactly the JSON it did, so existing clients only need the new host name. They differ from /geo in two ways: ids are strings, and /v1/{level}/{id} returns the units inside that one, with an empty list for an unknown id.

Old pathUse instead
/v1/divisions/geo/divisions
/v1/districts/geo/districts
/v1/upazilas/geo/upazilas
/v1/unions/geo/unions
/v1/divisions/{id}/geo/divisions/{id}/districts
/v1/districts/{id}/geo/districts/{id}/upazilas
/v1/upazilas/{id}/geo/upazilas/{id}/unions

List divisions

GET/v1/divisionsDeprecated

All divisions with string ids, as the old geoapi service returned them. Use /geo/divisions in new code.

Example request

curl https://web.ohidur.com/v1/divisions

List districts

GET/v1/districtsDeprecated

All districts with string ids, as the old geoapi service returned them. Use /geo/districts in new code.

Example request

curl https://web.ohidur.com/v1/districts

List upazilas

GET/v1/upazilasDeprecated

All upazilas with string ids, as the old geoapi service returned them. Use /geo/upazilas in new code.

Example request

curl https://web.ohidur.com/v1/upazilas

List unions

GET/v1/unionsDeprecated

All unions with string ids, as the old geoapi service returned them. Use /geo/unions in new code.

Example request

curl https://web.ohidur.com/v1/unions

List the districts in a division

GET/v1/divisions/{id}Deprecated

The districts in division id (not the division itself), with string ids. An unknown id gives an empty list. Use /geo/divisions/{id}/districts in new code.

Parameters

NameInTypeDescription
idrequired path integer Division id. Example: 6

Example request

curl https://web.ohidur.com/v1/divisions/6

List the upazilas in a district

GET/v1/districts/{id}Deprecated

The upazilas in district id (not the district itself), with string ids. An unknown id gives an empty list. Use /geo/districts/{id}/upazilas in new code.

Parameters

NameInTypeDescription
idrequired path integer District id. Example: 47

Example request

curl https://web.ohidur.com/v1/districts/47

List the unions in an upazila

GET/v1/upazilas/{id}Deprecated

The unions in upazila id (not the upazila itself), with string ids. An unknown id gives an empty list. Use /geo/upazilas/{id}/unions in new code.

Parameters

NameInTypeDescription
idrequired path integer Upazila id. Example: 365

Example request

curl https://web.ohidur.com/v1/upazilas/365