Code Samples
Here are a few simple snippets to get started
cURL
Initially login to get the temporary API key
curl -X 'POST'
'https://api.answr.space/api:auth/auth/login'
-H 'accept: application/json'
-H 'Content-Type: application/json'
-d '{ "email": "[email protected]", "password": "your_password" }'{ "authToken": "eyJhbGciOiJBMjU2S1ciLCJlbm", "user": 2 }Then make the GET request to one of the data layer API endpoint, using the requested API key and the latitude and longitude values.
curl -X 'GET'
'https://api.answr.space/api:climate-variables/a-frost-days?Input_point=%7B%22type%22%3A%22point%22%2C%22data%22%3A%7B%22lng%22%3A69.104192266327%2C%22lat%22%3A36.2471504211426%7D%7D'
-H 'accept: application/json'
-H 'Authorization: Bearer eyJhbGciOiJBMjU2S1ciLCJlbm'{ "CV88_M1": 30.26427069577304, "CV88_M2": 26.46405896273526, "CV88_M3": 23.403805472634055, "CV88_M4": 14.639534906907516, "CV88_M5": 9.528541202910922, "CV88_M6": 2.90803387879648, "CV88_M7": 0.089852011000568, "CV88_M8": 0.261099363761869, "CV88_M9": 4.987315048548308, "CV88_M10": 13.34038048847155, "CV88_M11": 20.978858622637663, "CV88_M12": 28.531385161659934 }Python
Initially login to get the temporary API key
import requests
headers = {
'accept': 'application/json',
# Already added when you pass json= but not when you pass data=
# 'Content-Type': 'application/json',
}
json_data = {
'email': '[email protected]',
'password': 'your_password',
}
response = requests.post('https://api.answr.space/api:auth/auth/login', headers=headers, json=json_data){ "authToken": "eyJhbGciOiJBMjU2S1ciLCJlbm", "user": 2 }Then make the GET request to one of the data layer API endpoint, using the requested API key and the latitude and longitude values.
import requests
headers = {
'accept': 'application/json',
'Authorization': 'Bearer eyJhbGciOiJBMjU2S1ciLCJlbm',
}
params = {
'Input_point': '{"type":"point","data":{"lng":69.104192266327,"lat":36.2471504211426}}',
}
response = requests.get('https://api.answr.space/api:climate-variables/a-frost-days', params=params, headers=headers){ "CV88_M1": 30.26427069577304, "CV88_M2": 26.46405896273526, "CV88_M3": 23.403805472634055, "CV88_M4": 14.639534906907516, "CV88_M5": 9.528541202910922, "CV88_M6": 2.90803387879648, "CV88_M7": 0.089852011000568, "CV88_M8": 0.261099363761869, "CV88_M9": 4.987315048548308, "CV88_M10": 13.34038048847155, "CV88_M11": 20.978858622637663, "CV88_M12": 28.531385161659934 }JavaScript
Initially login to get the temporary API key
Then make the GET request to one of the data layer API endpoint, using the requested API key and the latitude and longitude values.
MATLAB
Initially login to get the temporary API key
Then make the GET request to one of the data layer API endpoint, using the requested API key and the latitude and longitude values.
R
Initially login to get the temporary API key
Then make the GET request to one of the data layer API endpoint, using the requested API key and the latitude and longitude values.
Last updated
