How to get Users Country

rest
api

#1

Hello

I’m using the rest api to develop an application that collects information about followers,
the issue is that i’m trying to get the follower’s country
using users/show.json the location attribute is sometimes null

so is there anyway to get the location or country using REST API

thanks


#2

Yes, the data is there in the User object - but only if a user has chosen to make that public / enter it in their profile. If not, then location is not something we expose in the API for privacy reasons.


#3

thanks for the answer,
another question please, isn’t there anything we can do to get a formalized country code or whatsoever, cz as i noticed each user’s location is specified with diffrent format like

Newcastle upon Tyne, England or Manchester or Beirut

and there’s no unified format for locations. is that true

thanks


#4

That depends on what the user enters into their profile. We don’t enforce an ISO standard country code in that selection.


#5

Hi, I want to do the same.

Try to get the country from the user profile information in the location field. But I’ve seen that in the predefined ones that Twitter shows, the language changes from one place to another being the same country.

Is there an official list of the predefined ones that shows twitter in that field?
There is still no way to relate the user to the country?

Thanks.


#6

There’s no list of those locations available, no. The fact is that the user is free to enter any value (for example, “outer space”), and not select one of the suggested locations.

There’s no way in the API to specifically identify a user’s country. The enterprise APIs do offer a geo profile enrichment as an optional add-on, but that still depends on the user’s choice to share that information.