{"openapi":"3.1.0","info":{"title":"web.ohidur.com API","version":"3.0.0","description":"Utility endpoints behind ohidur.com: Bangladesh administrative divisions, random memes and the blog feed."},"servers":[{"url":"https://web.ohidur.com"}],"tags":[{"name":"Geo","description":"Divisions, districts, upazilas and unions of Bangladesh"},{"name":"Blog","description":"Feed from blog.ohidur.com"},{"name":"Assets","description":"Images"},{"name":"Meta","description":"Health check"},{"name":"Geo v1 (legacy)","description":"The endpoints of the old geoapi service, kept for existing clients"}],"components":{"schemas":{"Health":{"type":"object","properties":{"status":{"type":"string","enum":["ok"],"example":"ok"}},"required":["status"]},"DivisionList":{"type":"object","properties":{"status":{"type":"number","enum":[200],"example":200},"message":{"type":"string","enum":["success"],"example":"success"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Division"}}},"required":["status","message","data"]},"Division":{"type":"object","properties":{"id":{"type":"integer","exclusiveMinimum":0,"description":"Division id.","example":6},"name":{"type":"string","description":"Name in English.","example":"Dhaka"},"bn_name":{"type":"string","description":"Name in Bangla.","example":"ঢাকা"},"url":{"type":"string","description":"Host name of the official website, without `https://`.","example":"www.dhakadiv.gov.bd"}},"required":["id","name","bn_name","url"]},"DivisionResponse":{"type":"object","properties":{"status":{"type":"number","enum":[200],"example":200},"message":{"type":"string","enum":["success"],"example":"success"},"data":{"$ref":"#/components/schemas/Division"}},"required":["status","message","data"]},"Problem":{"type":"object","properties":{"type":{"type":"string","example":"about:blank"},"title":{"type":"string","example":"Bad Request"},"status":{"type":"integer","example":400},"detail":{"type":"string","example":"query.category: Invalid option"},"instance":{"type":"string","example":"/memes/random.jpg"},"requestId":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}},"required":["path","message"]},"description":"Individual validation failures, when the request was invalid."}},"required":["type","title","status"]},"DistrictList":{"type":"object","properties":{"status":{"type":"number","enum":[200],"example":200},"message":{"type":"string","enum":["success"],"example":"success"},"data":{"type":"array","items":{"$ref":"#/components/schemas/District"}}},"required":["status","message","data"]},"District":{"type":"object","properties":{"id":{"type":"integer","exclusiveMinimum":0,"description":"District id.","example":47},"division_id":{"type":"integer","exclusiveMinimum":0,"description":"Id of the division it is in.","example":6},"name":{"type":"string","description":"Name in English.","example":"Dhaka"},"bn_name":{"type":"string","description":"Name in Bangla.","example":"ঢাকা"},"lat":{"type":"number","description":"Approximate latitude.","example":23.7115253},"lon":{"type":"number","description":"Approximate longitude.","example":90.4111451},"url":{"type":"string","description":"Host name of the official website, without `https://`.","example":"www.dhaka.gov.bd"}},"required":["id","division_id","name","bn_name","lat","lon","url"]},"DistrictResponse":{"type":"object","properties":{"status":{"type":"number","enum":[200],"example":200},"message":{"type":"string","enum":["success"],"example":"success"},"data":{"$ref":"#/components/schemas/District"}},"required":["status","message","data"]},"UpazilaList":{"type":"object","properties":{"status":{"type":"number","enum":[200],"example":200},"message":{"type":"string","enum":["success"],"example":"success"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Upazila"}}},"required":["status","message","data"]},"Upazila":{"type":"object","properties":{"id":{"type":"integer","exclusiveMinimum":0,"description":"Upazila id.","example":365},"district_id":{"type":"integer","exclusiveMinimum":0,"description":"Id of the district it is in.","example":47},"name":{"type":"string","description":"Name in English.","example":"Savar"},"bn_name":{"type":"string","description":"Name in Bangla.","example":"সাভার"},"url":{"type":"string","description":"Host name of the official website, without `https://`.","example":"savar.dhaka.gov.bd"}},"required":["id","district_id","name","bn_name","url"]},"UpazilaResponse":{"type":"object","properties":{"status":{"type":"number","enum":[200],"example":200},"message":{"type":"string","enum":["success"],"example":"success"},"data":{"$ref":"#/components/schemas/Upazila"}},"required":["status","message","data"]},"UnionList":{"type":"object","properties":{"status":{"type":"number","enum":[200],"example":200},"message":{"type":"string","enum":["success"],"example":"success"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Union"}}},"required":["status","message","data"]},"Union":{"type":"object","properties":{"id":{"type":"integer","exclusiveMinimum":0,"description":"Union id.","example":3275},"upazila_id":{"type":"integer","exclusiveMinimum":0,"description":"Id of the upazila it is in.","example":365},"name":{"type":"string","description":"Name in English.","example":"Ashulia"},"bn_name":{"type":"string","description":"Name in Bangla.","example":"আশুলিয়া"},"url":{"type":"string","description":"Host name of the official website, without `https://`.","example":"ashuliaup.dhaka.gov.bd"}},"required":["id","upazila_id","name","bn_name","url"]},"UnionResponse":{"type":"object","properties":{"status":{"type":"number","enum":[200],"example":200},"message":{"type":"string","enum":["success"],"example":"success"},"data":{"$ref":"#/components/schemas/Union"}},"required":["status","message","data"]},"GeoLegacyList":{"type":"object","properties":{"status":{"type":"number","enum":[200],"example":200},"message":{"type":"string","enum":["success"],"example":"success"},"data":{"type":"array","items":{"$ref":"#/components/schemas/GeoLegacyRow"}}},"required":["status","message","data"]},"GeoLegacyRow":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"number"}]},"description":"A division, district, upazila or union with the same fields as in `/geo`, except that `id` and the parent id are strings, as the old geoapi service returned them.","example":{"id":"47","division_id":"6","name":"Dhaka","bn_name":"ঢাকা","lat":23.7115253,"lon":90.4111451,"url":"www.dhaka.gov.bd"}},"BlogPostList":{"type":"array","items":{"$ref":"#/components/schemas/BlogPost"}},"BlogPost":{"type":"object","properties":{"id":{"anyOf":[{"type":"number"},{"type":"string"}],"example":2},"title":{"type":"string","example":"Using Nginx container as a load balancer"},"description":{"type":["string","null"]},"section":{"type":["string","null"],"example":"posts"},"tags":{"type":["array","null"],"items":{"type":"string"},"example":["devops"]},"uri":{"type":"string","example":"https://blog.ohidur.com/posts/nginx-load-balancer/"},"content":{"type":"string","description":"Plain-text body. Only present with `content=true`."}},"required":["title","uri"],"additionalProperties":{}}},"parameters":{}},"paths":{"/health":{"get":{"operationId":"getHealth","tags":["Meta"],"summary":"Health check","description":"Answers `{\"status\": \"ok\"}` while the service is up. Use it for uptime monitors; `/` is the docs page.","responses":{"200":{"description":"The service is up.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Health"}}}}}}},"/geo/divisions":{"get":{"operationId":"listDivisions","summary":"List divisions","description":"All 8 divisions, ordered by id.","tags":["Geo"],"responses":{"200":{"description":"The divisions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DivisionList"}}}}}}},"/geo/divisions/{id}":{"get":{"operationId":"getDivision","summary":"Get a division","description":"One division by id.","tags":["Geo"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":0,"description":"Division id.","example":6},"required":true,"description":"Division id.","name":"id","in":"path"}],"responses":{"200":{"description":"The division.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DivisionResponse"}}}},"400":{"description":"`id` is not a positive integer.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"No division has this id.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/geo/divisions/{id}/districts":{"get":{"operationId":"listDivisionDistricts","summary":"List the districts in a division","description":"The districts in division `id`, ordered by id. Use it to fill the second step of an address picker.","tags":["Geo"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":0,"description":"Division id.","example":6},"required":true,"description":"Division id.","name":"id","in":"path"}],"responses":{"200":{"description":"The districts in the division.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DistrictList"}}}},"400":{"description":"`id` is not a positive integer.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"No division has this id.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/geo/districts":{"get":{"operationId":"listDistricts","summary":"List districts","description":"All 64 districts with their approximate coordinates, ordered by id.","tags":["Geo"],"responses":{"200":{"description":"The districts.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DistrictList"}}}}}}},"/geo/districts/{id}":{"get":{"operationId":"getDistrict","summary":"Get a district","description":"One district by id.","tags":["Geo"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":0,"description":"District id.","example":47},"required":true,"description":"District id.","name":"id","in":"path"}],"responses":{"200":{"description":"The district.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DistrictResponse"}}}},"400":{"description":"`id` is not a positive integer.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"No district has this id.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/geo/districts/{id}/upazilas":{"get":{"operationId":"listDistrictUpazilas","summary":"List the upazilas in a district","description":"The upazilas in district `id`, ordered by id.","tags":["Geo"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":0,"description":"District id.","example":47},"required":true,"description":"District id.","name":"id","in":"path"}],"responses":{"200":{"description":"The upazilas in the district.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpazilaList"}}}},"400":{"description":"`id` is not a positive integer.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"No district has this id.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/geo/upazilas":{"get":{"operationId":"listUpazilas","summary":"List upazilas","description":"All 494 upazilas, ordered by id.","tags":["Geo"],"responses":{"200":{"description":"The upazilas.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpazilaList"}}}}}}},"/geo/upazilas/{id}":{"get":{"operationId":"getUpazila","summary":"Get an upazila","description":"One upazila by id.","tags":["Geo"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":0,"description":"Upazila id.","example":365},"required":true,"description":"Upazila id.","name":"id","in":"path"}],"responses":{"200":{"description":"The upazila.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpazilaResponse"}}}},"400":{"description":"`id` is not a positive integer.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"No upazila has this id.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/geo/upazilas/{id}/unions":{"get":{"operationId":"listUpazilaUnions","summary":"List the unions in an upazila","description":"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.","tags":["Geo"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":0,"description":"Upazila id.","example":365},"required":true,"description":"Upazila id.","name":"id","in":"path"}],"responses":{"200":{"description":"The unions in the upazila.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnionList"}}}},"400":{"description":"`id` is not a positive integer.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"No upazila has this id.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/geo/unions":{"get":{"operationId":"listUnions","summary":"List unions","description":"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`.","tags":["Geo"],"responses":{"200":{"description":"The unions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnionList"}}}}}}},"/geo/unions/{id}":{"get":{"operationId":"getUnion","summary":"Get a union","description":"One union by id.","tags":["Geo"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":0,"description":"Union id.","example":3275},"required":true,"description":"Union id.","name":"id","in":"path"}],"responses":{"200":{"description":"The union.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnionResponse"}}}},"400":{"description":"`id` is not a positive integer.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"No union has this id.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/divisions":{"get":{"operationId":"legacyListDivisions","summary":"List divisions","description":"All divisions with string ids, as the old geoapi service returned them. Use `/geo/divisions` in new code.","tags":["Geo v1 (legacy)"],"deprecated":true,"responses":{"200":{"description":"The rows.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GeoLegacyList"}}}}}}},"/v1/districts":{"get":{"operationId":"legacyListDistricts","summary":"List districts","description":"All districts with string ids, as the old geoapi service returned them. Use `/geo/districts` in new code.","tags":["Geo v1 (legacy)"],"deprecated":true,"responses":{"200":{"description":"The rows.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GeoLegacyList"}}}}}}},"/v1/upazilas":{"get":{"operationId":"legacyListUpazilas","summary":"List upazilas","description":"All upazilas with string ids, as the old geoapi service returned them. Use `/geo/upazilas` in new code.","tags":["Geo v1 (legacy)"],"deprecated":true,"responses":{"200":{"description":"The rows.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GeoLegacyList"}}}}}}},"/v1/unions":{"get":{"operationId":"legacyListUnions","summary":"List unions","description":"All unions with string ids, as the old geoapi service returned them. Use `/geo/unions` in new code.","tags":["Geo v1 (legacy)"],"deprecated":true,"responses":{"200":{"description":"The rows.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GeoLegacyList"}}}}}}},"/v1/divisions/{id}":{"get":{"operationId":"legacyListDivisionDistricts","summary":"List the districts in a division","description":"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.","tags":["Geo v1 (legacy)"],"deprecated":true,"parameters":[{"schema":{"type":"integer","exclusiveMinimum":0,"description":"Division id.","example":6},"required":true,"description":"Division id.","name":"id","in":"path"}],"responses":{"200":{"description":"The districts in the division.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GeoLegacyList"}}}},"400":{"description":"`id` is not a positive integer.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/districts/{id}":{"get":{"operationId":"legacyListDistrictUpazilas","summary":"List the upazilas in a district","description":"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.","tags":["Geo v1 (legacy)"],"deprecated":true,"parameters":[{"schema":{"type":"integer","exclusiveMinimum":0,"description":"District id.","example":47},"required":true,"description":"District id.","name":"id","in":"path"}],"responses":{"200":{"description":"The upazilas in the district.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GeoLegacyList"}}}},"400":{"description":"`id` is not a positive integer.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/upazilas/{id}":{"get":{"operationId":"legacyListUpazilaUnions","summary":"List the unions in an upazila","description":"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.","tags":["Geo v1 (legacy)"],"deprecated":true,"parameters":[{"schema":{"type":"integer","exclusiveMinimum":0,"description":"Upazila id.","example":365},"required":true,"description":"Upazila id.","name":"id","in":"path"}],"responses":{"200":{"description":"The unions in the upazila.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GeoLegacyList"}}}},"400":{"description":"`id` is not a positive integer.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/memes/random.jpg":{"get":{"operationId":"getRandomMeme","tags":["Assets"],"summary":"Random meme image","description":"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":[{"schema":{"type":"string","enum":["programming","science"],"description":"Picked at random when omitted.","example":"programming"},"required":false,"description":"Picked at random when omitted.","name":"category","in":"query"}],"responses":{"200":{"description":"A meme image (JPEG or PNG).","content":{"image/*":{"schema":{"type":"string","format":"binary"}}}},"302":{"description":"Fallback: the image host could not be reached through the API."},"400":{"description":"Unknown category.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/blogposts":{"get":{"operationId":"listBlogPosts","tags":["Blog"],"summary":"List blog posts","description":"Posts from blog.ohidur.com. Responses are cached at the edge for 5 minutes.","parameters":[{"schema":{"type":"string","enum":["0","1","true","false"],"description":"Include each post's full `content`. Omitted by default to keep the response small.","example":"false"},"required":false,"description":"Include each post's full `content`. Omitted by default to keep the response small.","name":"content","in":"query"}],"responses":{"200":{"description":"All posts.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BlogPostList"}}}},"400":{"description":"Invalid query parameter.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"502":{"description":"The blog could not be reached or returned unexpected data.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"504":{"description":"The blog did not answer in time.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}}},"webhooks":{}}