Querying the API

The MSW forecast API provides access to core weather and ocean data purposed specifically for surfers and surfing. It drives our website and can be used to add information to yours. You'll need to sign up for a valid API key for each application here and ensure you stick to the terms and conditions here.

Querying for information for a location is as simple as making an HTYP request to:

http://magicseaweed.com/api/YOURAPIKEY/forecast/?spot_id=10

In this instance we're querying for MSW Spot 10 - Bantham, England.

To query data for a different location locate the beach on our website and note it's unique ID in the URL (in bold in the example below). eg:

http://magicseaweed.com/Pipeline-Backdoor-Surf-Report/616/

If you fail to pass the required spot_id or pass an invalid ID you'll receive an error code:

{
error_response: {
code: 501,
error_msg: "Invalid parameters were supplied and did not pass our validation, please double check your request."
}
}

If you don't need all the information available in your response you can specify only specific fields or groups of fields like this:

http://magicseaweed.com/api/YOURAPIKEY/forecast/?spot_id=10&fields=timestamp,wind.*,condition.temperature

This will (depending on your selection) reduce the turn around time for your request and keep data transfer to a minimum. It's always good practise to only request for what you actually require rather than filtering the full response, unless you need every field.