def build_url(api_key, spot_id, fields=None, unit=None,
                  start=None, end=None):
    """
        This function builds the request url
        API details https://magicseaweed.com/developer/forecast-api

        key:        Magic Seaweed API key
        spot_id:    The ID of a location, available from the URL when visiting the
                    corresponding spot on the Magic Seaweed website. IE '616' in
                    http://magicseaweed.com/Pipeline-Backdoor-Surf-Report/616/
        fields:     Comma separated list of fields to include in the request
                    URL. Defaults to none, which returns all information. Specifying
                    fields may reduce response time. Example:
                    fields=timestamp,wind.*,condition.temperature
        units:      A string of the preferred unit of measurement. Defaults to unit at
                    location of spot_id. eu, uk, us are available
        start:      Local timestamp for the start of a desired forecast range
        end:        Local timestamp for the end of the desired forecast range
    """
    params = {'spot_id': spot_id}
    if fields:
        _validate_field_types(fields)
        params['fields'] = ','.join(fields)
    if unit:
        _validate_unit_types(unit)
        params['units'] = unit
    if start and end:
        params['start'] = start
        params['end'] = end

    baseURL = requests.Request(HTTP_GET, MSW_URL.format(api_key), params=params).prepare().url
    return baseURL