How to get all places in the world?

I am trying to collect all cities, states of different countries in the world (better if there are corresponding region ids), I have read through the documentation of map apis and libraries, but still cannot find one. Is there any method I could use to make that happen?