EN/API/Countries

From Smart Biogas Wiki
Jump to navigation Jump to search

◀ Back to API Menu

List of countries used in SB

GET https://smartbiogas.it/api/v1/countries

Result: Json with an array of results

[
	{
		"eu_countries_id": countryId,
		"f_cod": "2-digit country identification code",
		"f_description": "description"
	},
	{
		"eu_countries_id": 2,
		"f_cod": "AL",
		"f_description": "Albania"
	},
	...
]


Single country details:

GET https://smartbiogas.it/api/v1/countries/{country_id}

Example: https://smartbiogas.it/api/v1/countries/19

Result: Same Json as above but with a single record


Search by code:

GET https://smartbiogas.it/api/v1/countries?f_cod={country code}

Example: https://smartbiogas.it/api/v1/countries?f_cod=IT

Result: Same Json as above but with a single record


Search by description:

GET https://smartbiogas.it/api/v1/countries?f_description={string to search in the description (multilingual)}

Example: https://smartbiogas.it/api/v1/countries?f_description=fra

Result: Same Json as above with 0 or more records

[edit | edit source]

This route also allows searching for cities filtered by the current Country.

GET https://smartbiogas.it/api/v1/countries/{countryId}/cities

By defining the country in {countryId}, you can obtain a list or search for cities.

Example: https://smartbiogas.it/api/v1/countries/19/cities (list of Italian cities)

Result:

[
	{
		"eu_cities_id": cityId,
		"eu_countries_id": countryId,
		"f_cod": "City code",
		"f_country_cod": "country code",
		"f_description": "City name",
		"f_validity_zone": 1 - North, 2- Central, 3-South, 4-Islands,
		"f_reg_description": "region description",
		"f_prov_description": "province description",
		"f_cod_catasto": "Cadastral code of the city"
	},
	{
		"eu_cities_id": 60000,
		"eu_countries_id": 19,
		"f_cod": "ITC44014047",
		"f_country_cod": "IT",
		"f_description": "Pedesina",
		"f_validity_zone": 1,
		"f_reg_description": "Lombardia",
		"f_prov_description": "Sondrio",
		"f_cod_catasto": "G410"
	},
	...
]


Search by cityId

GET https://smartbiogas.it/api/v1/countries/{countryId}/cities/{cityId}

Example: https://smartbiogas.it/api/v1/countries/19/cities/67664


Search by description

GET https://smartbiogas.it/api/v1/countries/{countryId}/cities?f_description={text to search}

Example: https://smartbiogas.it/api/v1/countries/19/cities?f_description=piner


Search by code

GET https://smartbiogas.it/api/v1/countries/{countryId}/cities?f_cod={code}

Example: https://smartbiogas.it/api/v1/countries/19/cities?f_cod=ITC11001234