DAHITI-API

List selected targets from the DAHITI data holding

DAHITI-API arguments

Argument Value Description
username¹ e.g. 'username' Username to login on the DAHITI website
password¹ e.g. 'password' Password to login on the DAHITI website
action¹ 'list-targets' Action of the request
continent e.g. 'Asia' Name of continent (optional)
country e.g. 'de' Name of country using TLD (optional)
basin e.g. 'Amazon' Name of basin (optional)
min_lon e.g. '50.0' Minimum longitude of location (optional)
max_lon e.g. '60.0' Maximum longitude of location (optional)
min_lat e.g. '10.0' Minimum latitude of location (optional)
max_lat e.g. '20.0' Maximum latitude of location (optional)

¹ required


JSON response from DAHITI server

[
	{
		"id": "254",
		"target_name": "Aberdeen, Lake",
		"location": null,
		"longitude": "-98.8248",
		"latitude": "64.5122"
	},
	{
		"id": "85",
		"target_name": "Albert, Lake",
		"location": null,
		"longitude": "30.9210",
		"latitude": "1.6807"
	}, 
	... ,
	{
		"id": "77",
		"target_name": "lonZaysan, Lake",
		"location": null,
		"longitude": "83.8751",
		"latitude": "48.0230",
	},
	{
		"id": "1452",
		"target_name": "Ziway, Lake",
		"location": null,
		"longitude": "38.9314",
		"latitude": "8.0183",
	}
]

Python Example:

import requests
import json
import pprint

url = 'https://dahiti.dgfi.tum.de/api/v1/'

args = {}
""" required options """
args['username'] = 'username'
args['password'] = 'password'
args['action'] = 'list-targets'

""" optional options """
#args['basin'] = 'Amazon'
#args['continent'] = 'Asia'
#args['country'] = 'de'
#args['min_lon'] = 0
#args['max_lon'] = 10
#args['min_lat'] = 0
#args['max_lat'] = 10
#args['software'] = '3.1'

""" send request as method POST """
response = requests.post(url, data=args)

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

Curl Example:

curl --data "username=username&password=password&action=list-targets" -X POST https://dahiti.dgfi.tum.de/api/v1/

Find more topics on the central web site of the Technical University of Munich: www.tum.de