Regional data from a region resource

The regional_data endpoint provides detailed data for specific subjects within a specified region or its subregions. For instance, you can obtain population statistics for all U.S. states by querying the demographic data model for the United States with a region_level of 3.

# retrieve demographics data for all states of the United States
>>> url = "https://www.the-datagarden.io/country/united-states-of-america/"
>>> 
>>> headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer <access_token>'}
>>> payload = {
	"region_level": "3",
    "model": "demographics"
}	
>>> response = requests.request("POST", url, headers=headers, data = payload)
>>> print(response.json())
		

In this example, the payload uses the region_level and the data model arguments to request demographics data on state level (which is level 3 in the US region hierarchy).

Refer to the next section for detailed information on available payload attributes and their possible values.