I work with the users.search VK API method to get a list of users for a specific query:

https://api.vk.com/method/users.search?q=' + searchQuery + '&count=1000&fields=city&online=0&has_photo=0&country=1&access_token=' + accessToken + '&v=5.57 

As you can see, I specified country = 1, which means that I only need users from Russia. Next, I want to get a list of cities in which the first 1000 users live (if they have specified a city), but the received object also contains cities from other countries. How can I weed them out (preferably without an additional API request)? Is it possible to do this simply by ID (for example, if a city with ID> 150,000, then it is not in Russia)?

  • Can you provide an example API request and an example response? I have now checked that only Russian cities are returned to me in the city object with the indication country = 1. Also, the user can fill in the city field only from the page for editing his contacts, where there is a rigid binding of cities to countries. - neluzhin
  • @terron, you are right! I made the output of cities on the map via geocoding with transliteration, apparently some of the cities he mistakenly found in other countries. Added to the request + Russia and everything fell into place. - Deka87

0