DAHITI-APIv2 "get-nearest-target"
DAHITI-API arguments
Argument Value Description
api_key ---' DAHITI API-Key
(Where can I get the API key?)
longitude e.g. '11.1352717' Longitude
lattude e.g. '49.6355231' Latitude
API-Request URL
https://dahiti.dgfi.tum.de/api/v2/get-nearest-target/
JSON response from DAHITI server
{
	'code': 200,
	'message': 'Request successful!',
	'data': {
		'id': 1446,
		'target_name': 'Main-Danube Canal'
		'location': 'Bamberg',
		'continent': 'Europe',
		'country': 'Germany',
		'longitude': 10.8978,
		'latitude': 49.8839,
		'distance': 32.4612,
	},
}
API-Request Examples:

Python request using POST method:

import requests
import json
import pprint

url = "https://dahiti.dgfi.tum.de/api/v2/get-nearest-target/"

args = {}
args['api_key'] = '### ADD HERE API_KEY ###'
args['longitude'] = 11.1352717
args['latitude'] = 49.6355231

response = requests.post(url, json=args)

if response.status_code == 200:
	''' convert json string in python list '''
	data = json.loads(response.text)
	pprint.pprint(data)
else:
	print (response.text)
	print (response.status_code)				
				

Python request using GET method:

import requests
import json
import pprint

url = "https://dahiti.dgfi.tum.de/api/v2/get-nearest-target/"

args = {}
args['api_key'] = '### ADD HERE API_KEY ###'
args['longitude'] = 11.1352717
args['latitude'] = 49.6355231

response = requests.get(url,params=args)

if response.status_code == 200:
	''' convert json string in python list '''
	data = json.loads(response.text)
	pprint.pprint(data)
else:
	print (response.text)
	print (response.status_code)				
				

CURL request using POST method:

curl --data "api_key=### ADD HERE API_KEY ###&longitude=11.1352717&latitude=49.6355231" -X POST https://dahiti.dgfi.tum.de/api/v2/get-nearest-target/
			

CURL request using GET method:

curl -X GET "https://dahiti.dgfi.tum.de/api/v2/get-nearest-target/?api_key=### ADD HERE API_KEY ###&longitude=11.1352717&latitude=49.6355231"