Integrating with API
You can provide Weather Guarantees by integrating with Sensible Weather via an API
Auth
To interact with any Sensible APIs, your app must be able to authorize using our auth API
Bearer Token
A bearer token Auth header is required in requests to our REST APIs. The token contains not only authentication data for your app, but a set of permissions. To receive a token, send a request using your API keys to our Auth API as outlined in the below reference:
The token's expiration in seconds can be found in the response from the auth endpoint as expires_in
. By default it is 24 hours. Since creating a new token is expensive, we recommend storing the token in a cache, such as Memcached, after retrieving it to reduce the number of requests. You can set the expiration time in the cache to be slightly less than the actual token expiration as a buffer.
When a token is expired, a 401: Unauthorized error will be returned. A new token should be retrieved in this scenario to complete the API request.
Creating and Accepting or Declining a Quote
- Request a bearer token via the Create Access Token endpoint and store the token to use in subsequent calls until expiration
- Send a request with all required fields populated to the Create Guarantee Quote endpoint
- If the customer would like to purchase the guarantee, accept the Quote
a. Send a request to the Accept Guarantee Quote endpoint
b. You now have a live Guarantee which will be active during its start/end dates - If the customer would like to make a reservation without purchasing the guarantee, decline the Quote
a. Send a request to the Decline Guarantee Quote endoint
Cancelling a Guarantee
- Request a bearer token via the Create Access Token endpoint and store the token to use in subsequent calls until expiration
- Send a request to the Cancel Guarantee endpoint using an ID of a valid Guarantee
Updating a Booking
If a customer would like to update the dates or location of a stay you must cancel the existing guarantee and offer an updated quote as the price of coverage may have changed.
Note: If the update to the booking does not change the coverage amount, the dates, or the location, the existing Weather Guarantee can remain in place.
- Cancel the existing Weather Guarantee and refund the charge
- Create a new Weather Guarantee Quote and allow the customer the option of purchasing the new Weather Guarantee Coverage, the UI should indicate that their previous coverage has been refunded to them
- Accept the Weather Guarantee and send a new charge request
Updated 5 months ago