Get information of selected DAHITI target
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 | 'target-info' | Action of the request |
dahiti_id | e.g. '85' | DAHITI ID |
JSON response from DAHITI server
{
"id": "85",
"target_name": "Albert, Lake",
"location": null,
"continent": "Africa",
"country": "cd"
}
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'] = 'target-info'
args['dahiti_id'] = '85'
""" send request as method POST """
response = requests.post(url, data=args)
if response.status_code == 200:
""" convert json string in python dictionary """
data = json.loads(response.text)
pprint.pprint(data)
else:
print response.status_code
Curl Example:
curl --data "username=username&password=password&action=target-info&dahiti_id=85" -X POST https://dahiti.dgfi.tum.de/api/v1/