Development Quickstart

Get up and running with our Wegaw API and kick-start your Wegaw integration.

Integrating the Wegaw API in your apps can begin right after you receive a Wegaw account, and in just four simple steps:

  1. Obtain your API tokens

  2. Check the basins available via API Request

  3. Get data via API Request

  4. Find available maps and download them via API Request

Step 1: Obtain your API tokens

To use the Wegaw API, you will need an access token. We use this token to associate any of your requests to your account. Find your token or refresh it in your Account Dashboard page or obtain it by using the Create Token API endpoint.

You will obtain two tokens:

  • One Access Token, allowing you to make any API or Maps request

  • One Refresh Token, allowing you to obtain a new Access Token when this expires

To increase the security of your account, Access tokens automatically expire after 24 hours, while Refresh tokens expire after 1 day.

Due to automated expiration of both tokens, you will need to implement an automatic token retrieval in your system. An expired Access Token will return an HTTP response code 401 Unauthorised. This indicates that you must use the Refresh Token API endpoint to obtain a newly valid Access Token. If the Refresh Token is expired, obtain a new pair of tokens via the Create Token API endpoint.

curl -X POST 'https://api.staging.defrost.io/v2/token/' --header 'Content-Type: application/json' --data '{"username":"string","password":"string"}'                                                                                                         

Step 2: Check the catchments available via API Request

Use the following code to check the catchments for which data can be downloaded. You can use the following code:

Step 3: Get data via API Request

In this snip of code, we will request Snow Water Equivalent (SWE) data via API.

Step 4: Find available maps and download them via API Request

In this snip of code, we will request Snow Water Equivalent (SWE) available maps via API.

And we will receive an array of files with information about the filename, the date and the URL to download the file.

In this snip of code, we will download a SWE map, using the filename, via API.

To learn more about how to use the API and to access some useful examples of code, please visit https://api.staging.defrost.io/

Last updated