# Demographics

This service returns the variables with socioeconomic and demographic information from a requested address (home). Such location may come from online addresses or from information stored in its data repositories.

Required parameters in a Demographics request with address:

  • address: Specify addresses according to the format used by the national postal service of the country in question. Additional address elements such as business names and unit, suite, or floor numbers should be avoided. Postal address elements must be delimited by spaces (shown here as a %20-escaped URL).
  • key: the API key of your application. This key identifies your application for quota management purposes. Learn to get API key.

# Demographics example with address

The following base service request would have the following structure:

https://apis.geodir.co/demographics/v1/json?address=jr pedro ruiz gallo nro 668&key=YOUR_KEY

Note: Be sure to enter a valid address for the address parameter.

{
    "status": "OK",
    "groups": [
        {
            "name": "grid_code",
            "description": "Codigo de Identificación Unica",
            "fields": [
                {
                    "name": "grid_code",
                    "value": 660136,
                    "typeField": "integer",
                    "description": "Codigo de Identificación Única"
                }
            ]
        },
        {
            "name": "socioeconomic_level",
            "description": "Nivel Socioeconomico",
            "fields": [
                {
                    "name": "socioeconomic_level",
                    "value": B,
                    "typeField": "text",
                    "description": "Nivel Socioeconomico"
                },
                {
                    "name": "income",
                    "value": 5531.0,
                    "typeField": "double",
                    "description": "Ingreso Promedio Familiar"
                }
            ]
        },
        {
            "name": "population",
            "description": "Población",
            "fields": [
                {
                    "name": "total_population",
                    "value": 387,
                    "typeField": "integer",
                    "description": "Población Total"
                },
                {
                    "name": "male_population",
                    "value": 185,
                    "typeField": "integer",
                    "description": "Según sexo Hombre"
                },
                {
                    "name": "female_population",
                    "value": 202,
                    "typeField": "integer",
                    "description": "Según sexo Mujer"
                }
            ]
        },
        
    ]
}

# Demographics responses with direction

A continuación se muestran los códigos de estado posibles en una respuesta de Demographics.

# Códigos de Estado de Demographics con dirección

The "status" field within the demographics response object contains the status of the request and may contain debugging information to help you figure out why geocoding isn't working. The "status" field can contain the following values:

  • "OK" indicates that the demographics service produced no errors; the service performed the action correctly.
  • "ZERO_RESULTS" indicates that the demographics service succeeded but returned no results. This can happen if the geocoder was passed a non-existent latlon or out of zone.
  • "OVER_QUERY_LIMIT" indicates that you have exceeded your quota.
  • "REQUEST_DENIED" indicates that your request was denied.
  • "INVALID_REQUEST" generally indicates one of the following:
    • Missing query (address, groups or latlon).
    • Invalid groups or demographics_type was provided.
  • "UNKNOWN_ERROR" indicates that the request could not be processed due to a server error. The request may be successful if you try again.

# Optional parameters

Optional parameters:

  • Groups: Is a filter with elements separated by a pipe (|). The group filter is also accepted as an optional parameter. Each element consists of a group pair which is a value and completely restricts the demographics results. See more information about the group filtering.
  • info: is a series of values ​​useful to the client to store complementary information or metadata, these elements must be separated by a pipe (|).

# Group filtering

In a Demographics response, the Demographics API can return results restricted to a specific area. You can specify the restriction using the groups filter. A filter consists of a list of group:value pairs separated by a pipe (|). Filter values ​​support the same partial matching and spell checking methods as other Demographics requests.

The following groups can be used to influence the results, but will not be applied:

  • locality matches locality and sublocality types.

Notes on group filtering:

  • Results are consistent with Geodir Maps, which occasionally produces ZERO_RESULTS responses.
  • For each address segment, specify it in the group parameter.

A geographic code for "jr pedro ruiz gallo nro 668" con groups=locality_id:150105

https://apis.geodir.co/demographics/v1/json?address=jr pedro ruiz gallo nro 668&groups=locality_id:150105&info=cod_peticion:1020|canal:abc|origen_sistema:cde
Last updated: 09/18/2023, 10:30:49 PM