User Location Object
The userLocation
request object contains properties specifying the
geographic location.
userLocation
request object contains
properties specific to a given request. The properties include continent
, country
, region
, city
, or zipCode
based on the IP address of
the requesting device. Refer to the EdgeScape documentation for more information. continent
Returns a userLocation
object that specifies the two letter code for the continent
of the incoming request. Refer to the Continent Code list for syntax. This is a read-only string
value.
// Request originates in North America request.userLocation.continent; // => "NA"
country
Returns a userLocation
object that specifies the ISO-3166, two letter code for the country of the incoming
request. Refer to the Country Code list for syntax. This is a read-only string
value.
// Request originates in United States request.userLocation.country; // => "US"
region
Returns an ISO-3166, two-letter code for the state, province, or region of
the incoming request. Refer to the State/Region Code list for syntax. This is a read-only string value.
// Request originates in the state of Massachusetts request.userLocation.region; // => "MA"
city
Returns a
userLocation
object that specifies the city name, within a 50-mile radius,
of the incoming request. Refer to the Cities
ZIP file ( 57MB uncompressed) for syntax. This is a read-only string value.
// Request originates in the city of Cambridge request.userLocation.city; // => "CAMBRIDGE"
zipCode
Returns a
userLocation
object that specifies the zip code of the incoming request.
Multiple values are supported. Contiguous zip codes are represented as a range
"FirstZipInRange-LastZipInRange". Multiple values are separated by the plus (+)
character). For example, the following strings are all valid zipCode values: - 10001
- 10001+10003
- 10001-10003+10005
- 10001-10003+10005-10008
// Request originates in a Cambridge zipcode request.userLocation.zipCode; // => "02114+02134+02138-02142+02163+02238"