EDC-API with Python

Dear API-User,

the EDC website has changed the protocol from http:// to https://. In order to continue using the API successfully, in the future, please use the following URL https://edc.dgfi.tum.de/api/v1/ for accessing the API.

List Satellites

List satellites from the EDC.

import requests
import json

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

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

''' optional options '''
#args['status'] = 'present'

''' 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)
	for record in data:
		print record
else:
	print response.status_code
	print response.text


Satellite Info

Returns detail information about selected satellite from the EDC.

import requests
import json

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

args = {}
''' required options '''
args['username'] = 'username'
args['password'] = 'password'
args['action'] = 'satellite-info'

''' optional options '''
#args['satellite_id'] = '0901301'
#args['satellite_name'] = 'goce'

''' 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)	
	for key in data.keys():
		print key,':',data[key]
else:
	print response.status_code
	print response.text


List Stations

List stations from the EDC.

import requests
import json

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

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

''' optional options '''
#args['active'] = 'yes'

''' 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)
	for record in data:
		print record
else:
	print response.status_code
	print response.text


Station Info

Returns detail information about selected station from the EDC.

import requests
import json

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

args = {}
''' required options '''
args['username'] = 'username'
args['password'] = 'password'
args['action'] = 'station-info'
args['station_id'] = '7080'

''' 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)	
	for key in data.keys():
		print key,':',data[key]
else:
	print response.status_code
	print response.text


List Predictions

List valid CPF prediction from the EDC data holding.

import requests
import json

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

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

''' optional options '''
#args['provider'] = 'COD'
#args['satellite'] = '0606203'

''' 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)
	for record in data:
		print record
else:
	print response.status_code
	print response.text


List Predictions (Version 2)

List valid CPF prediction (Version 2) from the EDC data holding.

import requests
import json

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

args = {}
''' required options '''
args['username'] = 'username'
args['password'] = 'password'
args['action'] = 'list-predictions-v2'

''' optional options '''
#args['provider'] = 'COD'
#args['satellite'] = '0606203'

''' 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)
	for record in data:
		print record
else:
	print response.status_code
	print response.text


Data Query

Search in the EDC data holding using user-defined criteria.

import requests
import json

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

args = {}
''' required options '''
args['username'] = 'username'
args['password'] = 'password'
args['action'] = 'data-query'
args['data_type'] = 'NPT'
# available data types: 'NPT','FRD','LTT','CPF','NP','FR','CPF_v2','NPT_v2','FRD_v2'

''' optional options '''
#args['start_data_date'] = '2016-02%'
#args['end_data_date'] = '2016-02%'
#args['satellite'] = '0803201'
#args['provider'] = 'COD'
#args['station'] = '78403501'

''' 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)
	for record in data:
		print record
else:
	print response.status_code
	print response.text


Data Info

Get detailed information about a certain dataset in the EDC data holding.

import requests
import json

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

args = {}
''' required options '''
args['username'] = 'username'
args['password'] = 'password'
args['action'] = 'data-info'
args['id'] = '1300505'
args['data_type'] = 'NPT'
# available data types: 'NPT','FRD','LTT','CPF','NP','FR','CPF_v2','NPT_v2','FRD_v2'

''' 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)	
	for key in data.keys():
		print key,':',data[key]
else:
	print response.status_code
	print response.text


Data Download

Download a dataset of the EDC data holding.

import requests
import json

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

args = {}
''' required options '''
args['username'] = 'username'
args['password'] = 'password'
args['action'] = 'data-download'
args['id'] = '1300505'
args['data_type'] = 'NPT'
# available data types: 'NPT','FRD','LTT','CPF','NP','FR','CPF_v2','NPT_v2','FRD_v2'

''' 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)
	for record in data:
		print record
else:
	print response.status_code
	print response.text


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