LogoLogo
HomeProductSolutionsAbout usContactLog in
  • Overview
    • Welcome to answr
    • Our Features
    • Data Layer Availability
  • Start Here
    • How to make your first API call
  • Coding Examples
    • Code Samples
    • Simple climatic variables plotting
    • Climatic variables spatial plotting
    • Reporting tool
  • Integrations
    • Connect answr with Zapier
    • Connect answr with Make
  • Data Sources
    • Sentinel-1 imagery
    • Sentinel-2 imagery
    • Sentinel-3 imagery
    • Landsat 8 imagery
    • Landsat 9 imagery
    • MODIS
    • Global Surface Water
    • Flood Hazard Maps at European and Global Scale
    • AgERA5
    • Soil moisture
  • API Data Layers
    • Climate Analytics
      • Climatic Variables
      • Köppen–Geiger Zones
      • Universal Thermal Climate Index
    • Natural Disasters
      • Cold Wave Probability
      • Drought Probability
      • Flood Severity
      • Heat Wave Probability
      • Windstorm Probability
      • Wildfire Frequency Occurrence
      • Extreme Heat Probability
      • Extreme Cold Probability
  • API Reference
    • Authentication
    • Climatic Variables
    • Natural Disasters
  • Surveys
    • Feedback
Powered by GitBook
On this page
  • Step 1 - Open the answr API Reference
  • Step 2 - Choose your programming language
  • Step 3 - Authentication
  • Step 4 - First data request
  1. Start Here

How to make your first API call

Step by step guide

PreviousData Layer AvailabilityNextCode Samples

Last updated 2 years ago

Step 1 - Open the answr API Reference

Before you start making your first API call, open the answr API Reference. You can find it in the answr Web app or through the answr documentation.

The documentation provides complete reference on the authentication process, but also on how different statistics and data layers, like and , can be requested.

This guide provides you a short introduction on how to make your first answr API call.

Step 2 - Choose your programming language

Depending on what programming language you prefer, we have currently code examples for requests and responses in cURL, Python, Javascript, MATLAB and R available.

Check out the chapter and choose the programming language you want to use.

Copy the code from "Step 1" and set up your console for performing your authentication process!

If you wish to get code samples in other programming languages, please send us your request through our

Step 3 - Authentication

As a first step you will need to authenticate yourself.

Below you can find a code example in Python. Exchange the dummy email and password with your account credentials.

import requests
headers = { 'accept': 'application/json', 'Content-Type': 'application/json', 
} 
json_data = { 'email': 'youremail@mail.com', 'password': 'password', }
response = requests.post('https://api.answr.space/api:auth/auth/login',
 headers=headers, json=json_data)
response.content

If the request was successful (value = 200), you will receive a Authentication Token (Bearer), which will have the following format:

eyJhbGciOiJBMjU2S1ciLCJlbmMiOiJBMjU2Q0JDLUhTNTEyIiwiemlwIjoiREVGIn0

Use it to perform your first data requests.

Step 4 - First data request

For each API call, we cache the response for 30 minutes. This means that when you call multiple times a specific API endpoint with the same coordinates, the response is instantly available and we do not count additional requests from the authenticated account

Here is again an example in Python. Replace the word "TOKEN" with the Authentication Token you have received in the authentication process:

headers = { 'accept': 'headers = 
{ 'accept': 'application/json', 'Authorization': 'Bearer TOKEN', } 
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) 
response.content

Response: (Average frost days per month on the chosen location)

{
"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
}

Congratulations! You successfully performed your first data request.

Once you have authenticated yourself and received your Token, you can start requesting data through the answr API. You will find the Code how to perform your first data request in different programming languages, in "Step2" of the .

API Reference
Climatic variables
Natural disasters
👩💻Code Samples
Code Samples
community support form.
👩💻Code Samples
Code Samples