Documentation of DAHITI-API (Version 2) - "download-discharge"
DAHITI-API arguments
Argument Value Description
api_key ---' DAHITI API-Key
(Where can I get the API key?)
dahiti_id e.g. '8813' DAHITI ID
API-Request URL
https://dahiti.dgfi.tum.de/api/v2/download-discharge/
JSON response from DAHITI server
{
	'code': 200,
	'message': 'Request successful!'
	'target': {
		'id': '8813',
		'target_name': 'Tawakoni, Lake',
		'location': None,
		'country': 'United States of America',
		'continent': 'North America',
		'longitude': -95.9748,
		'latitude': 32.8696,
		'points': 259,
		'software': '8.0',
		'download': '2024-01-31 14:50:48',
	},
	'data': [
		{
			'date': '2018-12-11',
			'discharge': 18956.719,
			'error': None
		},{
			'date': '2018-12-11', 
			'discharge': 17624.933,
			'error': None
		}, ..., {
			'date': '2021-12-22',
			'discharge': 8214.326,
			'error': None
		},{
			'date': '2021-12-22',
			'discharge': 7569.59, 
			'error': None
		}
	]
}
API-Request Examples:

Python request using POST method:

import requests
import json
import pprint

url = "https://dahiti.dgfi.tum.de/api/v2/download-discharge/"

args = {}
args['api_key'] = '### ADD HERE API_KEY ###'
args['dahiti_id'] = 8813

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/download-discharge/"

args = {}
args['api_key'] = '### ADD HERE API_KEY ###'
args['dahiti_id'] = 8813


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 ###&dahiti_id=8813" -X POST https://dahiti.dgfi.tum.de/api/v2/download-discharge/
			

CURL request using GET method:

curl -X GET "https://dahiti.dgfi.tum.de/api/v2/download-discharge/?api_key=### ADD HERE API_KEY ###&dahiti_id=8813"