Development Quickstart
Get up and running with our Snow Cover API & Maps and kick-start your DeFROST integration.
Last updated
Was this helpful?
Get up and running with our Snow Cover API & Maps and kick-start your DeFROST integration.
Last updated
Was this helpful?
Integrating DeFROST in your apps can begin right after you create a DeFROST account, and in just three simple steps:
Obtain your API tokens
Make a test API Request
Display the snow cover map layer
Read below for a step by step guide:
To use DeFROST, you'll 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 page or obtain it programmatically using the .
You will obtain two tokens:
An Access Token, allowing you to make any API or Maps request
A Refresh Token, allowing you to obtain a new Access Token when this expires
Due to automated expiration of both tokens, you need to implement your integration taking this aspect into account. An expired Access Token will return an HTTP response code 401 Unauthorized
, a signal for you to use the to obtain a newly valid Access Token. If the Refresh Token is expired, obtain a new pair of tokens via the .
The tokens are standard . Their payload contain the expiration date, which allows you to easily test whether a token is expired or not:
To test that you are ready to start integrating with DeFROST API, make a test API request using your secret API Access and Refresh tokens to refresh the Access token or retrieve the available snow covers.
Make sure to modify the snippets with your API tokens obtained in the step above
Make sure to modify the snippets below with your API access token. The Mapbox snippet requires, in addition, your Mapbox token.
You are now ready to integrate DeFROST! You can check the following additional resources:
The code examples here are using the DeFROST . Check the if you are looking for coverage beyond this region.
To test that your integration with DeFROST Maps is working correctly, use the examples below for your web mapping library of choice. We provide examples for the most popular web mapping libraries: , , and .
Using the DeFROST API, you can - exclusively allowing requests from such referrers to use your tokens and DeFROST services. This is an added security layer that, while recommended for all cases, it is only mandatory for Google Maps users. Since this library does not support sending your token in each tile request's authorization header, you need to send it via a query parameter - making your token exposed.
The key point to keep in mind is that DeFROST Maps requires Bearer token Authentication. This forces libraries displaying tile layers to include the appropriate Authentication header in each tile request. While Mapbox supports this method out of the box, OpenLayers and Leaflet require a minor workaround: have a look in the examples above. In the special case of Google Maps, you have no option but to send the token as a query parameter, which forces you to .
: Full source code and starter project demonstrating integration of DeFROST Maps and API in supported platforms.