Documentation of DAHITI-API (Version 2) - "download-land-water-mask"
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-land-water-mask/
Response from DAHITI server
 Returns tar.gz archive or JSON Error
API-Request Examples:

Python request using POST method:

import requests
import json
import pprint

url = "https://dahiti.dgfi.tum.de/api/v2/download-land-water-mask/"

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

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

if response.status_code == 200:
	local_filename = args['dahiti_id']+'_land_water_mask.tar.gz'
	print ('writing ... '+local_filename)
	with open(local_filename, 'wb') as f:
		for chunk in response.iter_content(chunk_size=1024): 
			if chunk:
				f.write(chunk)
	print ('done!')
else:	
	data = json.loads(response.text)
	pprint.pprint(data)
	

Python request using GET method:

import requests
import json
import pprint

url = "https://dahiti.dgfi.tum.de/api/v2/download-land-water-mask/"

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


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

if response.status_code == 200:
	local_filename = args['dahiti_id']+'_land_water_mask.tar.gz'
	print ('writing ... '+local_filename)
	with open(local_filename, 'wb') as f:
		for chunk in response.iter_content(chunk_size=1024): 
			if chunk:
				f.write(chunk)
	print ('done!')	
else:
	data = json.loads(response.text)
	pprint.pprint(data)
				

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-land-water-mask/ --output 8813_land_water_mask.tar.gz
			

CURL request using GET method:

curl -X GET "https://dahiti.dgfi.tum.de/api/v2/download-land-water-mask/?api_key=### ADD HERE API_KEY ###&dahiti_id=8813" --output 8813_land_water_mask.tar.gz